Skip to content

Instantly share code, notes, and snippets.

@smarr
Created May 15, 2016 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarr/a2709444f192b971e97a8ffbe931c678 to your computer and use it in GitHub Desktop.
Save smarr/a2709444f192b971e97a8ffbe931c678 to your computer and use it in GitHub Desktop.
Issue with field containing class reference
class Benchmark
end
class A < Benchmark
end
class B < Benchmark
end
class Run
@benchmark_suite : Benchmark.class
def initialize(args)
@benchmark_suite = process_arguments(args)
end
def process_arguments(args)
case args[0]
when "A"
A
when "B"
B
else
Benchmark
end
end
end
Run.new(ARGV)
~/tmp/crystal-0.16.0-1/bin/crystal build --release issue.cr
Bug: trying to assign Benchmark+:Class <- (A:Class | Benchmark+:Class)
[4532347627] *raise<String>:NoReturn +155
[4539587621] *Crystal::CodeGenVisitor#assign<Crystal::CodeGenVisitor, LLVM::Value, Crystal::Type+, Crystal::Type+, LLVM::Value>:LLVM::Value +4709
[4539677934] *Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Assign>:Bool? +1870
[4539596406] *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +2150
[4539652542] *Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +3438
[4539670331] *Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +4827
[4539708158] *Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +6238
[4539595451] *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +1195
[4539595757] *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +1501
[4539652542] *Crystal::CodeGenVisitor#codegen_fun<Crystal::CodeGenVisitor, String, Crystal::Def+, Crystal::Type+, Bool, LLVM::Module, Bool, Bool>:LLVM::Function +3438
[4539670331] *Crystal::CodeGenVisitor#target_def_fun<Crystal::CodeGenVisitor, Crystal::Def+, Crystal::Type+>:LLVM::Function +4827
[4539708158] *Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::Call>:Bool +6238
[4539595451] *Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::ASTNode+, Crystal::CodeGenVisitor>:Nil +1195
[4539430093] *Crystal::Compiler#codegen<Crystal::Compiler, Crystal::Program, Crystal::Expressions, Array(Crystal::Compiler::Source), String>:Nil +5453
[4533063406] *Crystal::Compiler#compile<Crystal::Compiler, Array(Crystal::Compiler::Source), String>:Crystal::Compiler::Result +4350
[4532462688] *Crystal::Command#run<Crystal::Command>:(Array(Crystal::ImplementationTrace) | Array(Crystal::Init::View+:Class) | Array(String) | Bool | Crystal::Compiler::Result | Hash(String, String) | IO::FileDescriptor+ | Nil) +1392
[4532345615] __crystal_main +24607
[4532396574] main +46
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment