Open ergl opened 3 years ago
Changing the iftype
to be iftype T <: None
(or any other type different from the one in the constraint) makes the code work.
We discussed this on sync today. @jemc thinks that is probably due to a missing call to gen_assign_cast
when generating the iftype
. Probably the issue is that the body of the iftype
is not boxing 0
correctly, so trying to cast it to (U8 | None)
fails because of that.
The following code:
Fails with
The actual code generation failure is here:
https://github.com/ponylang/ponyc/blob/a37b32d03b23bb7200a1145cee70eedb3edde9ed/src/libponyc/codegen/genbox.c#L20-L21
In the code above, it is assuming that
l_type
is a pointer toi8
.