You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should generate a type error in the Erase function, since it expects a Box value but we're giving it a Unit.
Based on the match expression, the type of Erase should be Box -> var, while according to the call it should be Unit -> var. When unifying these two we expect a type error, which never happens.
The final infered type is Box -> var, which specializes to Box -> None when checking against the annotation.
The issue was that the type constructors inside of constructor fields were not being resolved and were kept as variables. So, even though the type of the Box/Box constructor was being updated to Unit -> Box with Unit as a constructor, the type of x was still Unit as a type variable.
This means that all fields inside of match expressions were being inferred variable types for the nullary constructors in their types.
Reproducing the behavior
Considering the following program
This should generate a type error in the
Erase
function, since it expects aBox
value but we're giving it aUnit
.Based on the match expression, the type of
Erase
should beBox -> var
, while according to the call it should beUnit -> var
. When unifying these two we expect a type error, which never happens.The final infered type is
Box -> var
, which specializes toBox -> None
when checking against the annotation.System Settings
Bend commit: 4d6f461
Additional context
No response
The text was updated successfully, but these errors were encountered: