Open sungshik opened 2 months ago
The subtype conputation in the Interpreter goes through a big forwarding and multiple nesting levels of the "double dispatch" design pattern to resolve all the different cases.
Handling aliases in there is quirky because aliases are type equivalences (and thus have commutativity for subtype unlike the other type constructors).
My hunch would be that aliases were not considered for the variance (co- and contra) of function argument types. At least not in all the right places.
Thanks for the clear report btw @sungshik
Describe the bug
An error sometimes occurs when a (non-keyword) parameter of a function type has a name. The occurrence of the error seems to depend on whether the type of the parameter is user-defined or builtin.
To Reproduce
Example 1 (succeeds):
Example 2 (fails):
Expected behavior
head1
,head2
,head3
,HEAD1
,HEAD2
, andHEAD3
, so the more detailed expectation would be that both Examples 1/2 succeed (i.e., the name of the argument is not part of the type)