Open Blacksmoke16 opened 4 years ago
Duplicate of https://github.com/crystal-lang/crystal/issues/8551
Reopening as this seems to be a different issue not resolved via #10729.
Reduced:
class Foo
end
class Bar(T1) < Foo
def initialize(@value : T1)
end
def value
@value
end
end
class Baz(T2) < Bar(T2)
def initialize(@value : T2)
end
end
Bar.new(10).as(Foo).as(Bar).value
BUG: called create_llvm_type for T2 (Exception)
from src/compiler/crystal/codegen/llvm_typer.cr:254:7 in 'create_llvm_type'
from src/compiler/crystal/codegen/llvm_typer.cr:88:37 in 'llvm_type'
from src/compiler/crystal/codegen/unions.cr:34:28 in 'create_llvm_type'
from src/compiler/crystal/codegen/llvm_typer.cr:90:26 in 'llvm_type'
from src/compiler/crystal/codegen/llvm_typer.cr:84:5 in 'llvm_type'
from src/compiler/crystal/codegen/llvm_typer.cr:429:7 in 'llvm_return_type'
from src/compiler/crystal/codegen/codegen.cr:182:18 in 'initialize'
from src/compiler/crystal/codegen/codegen.cr:171:5 in 'new:single_module:debug'
from src/compiler/crystal/codegen/codegen.cr:66:7 in 'codegen'
from src/compiler/crystal/codegen/codegen.cr:65:5 in 'codegen:debug:single_module'
from src/compiler/crystal/progress_tracker.cr:22:7 in 'codegen'
from src/compiler/crystal/compiler.cr:172:16 in 'compile'
from src/compiler/crystal/command.cr:296:3 in 'compile'
from src/compiler/crystal/command.cr:208:14 in 'run_command'
from src/compiler/crystal/command.cr:117:7 in 'run'
from src/compiler/crystal/command.cr:49:5 in 'run'
from src/compiler/crystal/command.cr:48:3 in 'run'
from src/compiler/crystal.cr:11:1 in '__crystal_main'
from src/crystal/main.cr:110:5 in 'main_user_code'
from src/crystal/main.cr:96:7 in 'main'
from src/crystal/main.cr:119:3 in 'main'
from __libc_start_main
from _start
from ???
Calling .@value
instead of .value
produces BUG: called create_llvm_type for T1 (Exception)
instead.
Came up while debugging #8967.
https://play.crystal-lang.org/#/r/8sai