Bug Report
code to reproduce:
abstract class A
abstract def foo : Int32
def bar
foo
end
end
class B < A
@test = 0
def foo : Int32
@test
end
end
puts B.new.as(A).bar
Interpreter fails with error while compiled binary succeeds.
$ cr i local/abstract_method_bug.cr
Using compiled compiler at .build/crystal
Crystal interpreter 1.18.2 [635ca37a6] (2025-10-21).
EXPERIMENTAL SOFTWARE: if you find a bug, please consider opening an issue in
https://github.com/crystal-lang/crystal/issues/new/
Nil assertion failed (NilAssertionError)
from src/nil.cr:113:7 in 'not_nil!'
from src/nil.cr:109:3 in 'not_nil!'
from src/compiler/crystal/interpreter/context.cr:396:18 in 'ivar_offset'
from src/compiler/crystal/interpreter/compiler.cr:3500:7 in 'ivar_offset'
from src/compiler/crystal/interpreter/compiler.cr:1038:21 in 'compile_instance_var'
from src/compiler/crystal/interpreter/compiler.cr:1862:11 in 'visit'
from src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from src/compiler/crystal/interpreter/compiler.cr:243:5 in 'compile_def'
from src/compiler/crystal/interpreter/compiler.cr:2174:7 in 'create_compiled_def'
from src/compiler/crystal/interpreter/compiler.cr:1908:22 in 'visit'
Add a 👍 reaction to issues you find important.
Bug Report
code to reproduce:
Interpreter fails with error while compiled binary succeeds.
Add a 👍 reaction to issues you find important.