Open chalcolith opened 6 years ago
The explicit recover block here is a red herring - this fails in the same way even if that is removed.
The array inference logic here is flawed: https://github.com/ponylang/ponyc/blob/46668e275032586af18f2495d5b99a36cf106951/src/libponyc/expr/array.c#L379-L385
Here, the right side is coming back as Array[Foo ref]
, while the antecedent is Array[Foo box]
. Even though Foo ref
is a subtype of Foo box
, the same isn't true of Array[Foo ref]
and Array[Foo box]
. The logic needs to do something else here - it needs to recognize the subtype relationship for the element type, and then just use the antecedent type directly without trying to recover. That check should happen before this check I'm highlighting here, but it isn't.
I can't guarantee I'll find time for this soon, but I'll try. I'll assign myself to this ticket if I start working on it. Otherwise, it's fair game for someone else.
The following program
Produces the output
I don't see why the variable
f
is being treated as aFoo tag
in the array literal.