-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: called type_id for A+.class (Crystal::VirtualMetaclassType) #11668
Comments
Actually unintentionally managed to reproduce this in a different way: ccrystal eval 'Union(ArgumentError, IndexError)'
Using compiled compiler at /home/george/dev/git/crystal/.build/crystal
BUG: called type_id for Exception+.class (Crystal::VirtualMetaclassType) (Exception)
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/llvm_id.cr:43:5 in 'type_id'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/type_id.cr:68:9 in 'type_id_impl'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/type_id.cr:9:5 in 'type_id'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/codegen.cr:1493:15 in 'visit'
from /home/george/dev/git/crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/codegen.cr:2281:7 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/codegen.cr:667:9 in 'visit'
from /home/george/dev/git/crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/codegen.cr:2281:7 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/codegen.cr:69:7 in 'codegen'
from /home/george/dev/git/crystal/src/compiler/crystal/codegen/codegen.cr:67:5 in 'codegen:debug:single_module'
from /home/george/dev/git/crystal/src/compiler/crystal/progress_tracker.cr:22:7 in 'codegen'
from /home/george/dev/git/crystal/src/compiler/crystal/compiler.cr:173:16 in 'compile'
from /home/george/dev/git/crystal/src/compiler/crystal/command/eval.cr:29:14 in 'eval'
from /home/george/dev/git/crystal/src/compiler/crystal/command.cr:99:7 in 'run'
from /home/george/dev/git/crystal/src/compiler/crystal/command.cr:51:5 in 'run'
from /home/george/dev/git/crystal/src/compiler/crystal/command.cr:50:3 in 'run'
from /home/george/dev/git/crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
from /home/george/dev/git/crystal/src/crystal/main.cr:115:5 in 'main_user_code'
from /home/george/dev/git/crystal/src/crystal/main.cr:101:7 in 'main'
from /home/george/dev/git/crystal/src/crystal/main.cr:127:3 in 'main'
from /usr/lib/libc.so.6 in '__libc_start_main'
from /home/george/dev/git/crystal/.build/crystal in '_start'
from ?? Assuming it's the same bug based on the exception, but 🤷. |
|
Oh, you're right. Still a compiler bug :-) . I'll take a closer look at the actual problem code in my application, but what I am getting is that a class derived from |
I got the same error message (don't have a stack trace) in another case (Crystal 1.6.2): require "json"
abstract class A
include JSON::Serializable
use_json_discriminator "type", {b: B, c: C}
property type : String
end
class B < A
end
class C < A
end
Tuple(String, A).from_json("") It seems to only happen with |
I reached this while tracing the cause of #11657
This program:
Causes the compiler to report a bug this way:
Use case is a table of classes derived from
A
, which are instantiated by callingtable[n].new
. My code does not hit the above report, but code generation for instantiating the derived class fails with a null reference inllvm
if the derived class has any member variables.The text was updated successfully, but these errors were encountered: