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
Run all MatchType reduction under Mode.Type (#17937)
Transcribing and paraphrasing from @smarter's comment in
#16408 (comment) :
Type erasure assumes method signatures aren't simplified, since
simplification logic is implementation-defined. For instance, some
intersection types can be simplified down, but intersection types and
their simplification can erase to different types - prefering classes
over traits, for instance (for Java interop, as it matches Java's
erasure).
Also note, simplify doesn't simplify intersections and unions in Type
mode. But Match Types will cache their reduction without considering
the type mode as a cache input, thus the simplified reduction leaks even
when called in Type mode.
So we call simplified in Mode.Type, in both cases (another desire), so
only that result is cached instead.
Using normalise doesn't work because, for example, that doesn't
normalise match types that are applied type args (e.g. args of Pair).
And not caching the result of those reductions means that they'll get
repeat over and over.
0 commit comments