Open j-hui opened 2 years ago
Isn't that just a scope-of-type-variables issue? @j-hui doesn't your "scoping" pass go through and make all names globally unique by assigning them, say, a unique integer? The same thing should be done with type variables.
My scoping pass does not do that---it just checks that everything is scoped correctly. I can easily change it to name mangle the program but I haven't seen a need for that yet.
This is being handled in #103
If we write something like:
This should be the same as writing:
That is, the type variable
t
across the annotations fora
,b
, and the return type should be quantified as the same name.However, the lowering pass lowers these as three separate type annotations, which means they technically become separately quantified, since they reside in three separate type annotations.
I fear this kind of scoping might be tricky to get recover in the type-checking phase, so I should fix the lowering phase to collapse the three annotations into a single type annotation.
@XijiaoLi something to keep in mind while you work on type inference; to be safe, stick with the postfix type annotation syntax (using
:
) for now.