Open Smarre opened 3 years ago
The snippet seems not to break when Array
has a generic type argument.
I don't think @excluded : Hash(String, Array) | Nil
should ever compile, for the same reason you cannot do x = uninitialized Hash(String, Array) | Nil
.
Yes, though I’d expect to have some better error than that stack trace.
Definitely! The bug is that restricting an ivar to Hash(String, Array) | Nil
should be a proper compiler error.
The rest is secondary.
Might be related to #3770.
Using
try { .. }
to guard against type that may a value or nil causes an error to be thrown:I can reproduce the bug with following code:
Crystal version: