Open Apprentice-Alchemist opened 3 weeks ago
Using structural equality is almost certainly not correct here. We never want to do this for Type.t
because that might end up comparing tclass
and other terrible things, which can even lead to compiler hangs because of recursive data.
However, I acknowledge that the result is correct here, so we'll have to investigate why the original lookup fails. If the problem comes from a macro transformation then the solution is likely to avoid the loss of identity. We had similar issues before with tvar
which has a special mechanism in place to retain its identity.
This fixes a bug where typed exprs coming from macros won't have their types properly substituted in generic functions. A simple example is
AST dump for
foo<Int>
without this change:Note there is still a
foo.T
left. AST dump forfoo<Int>
with this change:Now all occurences of
foo.T
have been replaced byInt
.