-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normalize MatchAlias in unrollTupleTypes #19565
Conversation
Similar to #19199 |
@@ -443,6 +443,9 @@ object Inlines: | |||
unrollTupleTypes(tail).map(head :: _) | |||
case tpe: TermRef if tpe.symbol == defn.EmptyTupleModule => | |||
Some(Nil) | |||
case tpRef: TypeRef => tpRef.info match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix works, but I am not sure if this is the correct way to handle MatchAlias
es.
@sjrd could you have a look at this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks reasonable, although usually we would rather expect
case tpe: AppliedType if tpe.isMatchAlias => ... tpe.tryNormalize ...
It is a bit suspicious that we directly encounter the tycon
here, rather than the surrounding AppliedType
. What are tpe
and tpe.dealias
when we get here on the problematic test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I noticed that for instance isMatchAlias
is defined on AppliedType
s.
But in this case, we have tpe := TypeRef(NoPrefix, Alias)
which remains the same after dealias
since the info of Alias
is not a TypeAlias
but a MatchAlias
. The case is not covered here:
https://github.com/lampepfl/dotty/blob/997103d818ead17d528d320b01edefb8792579ac/compiler/src/dotty/tools/dotc/core/Types.scala#L1438-L1445
I'm not sure whether the normalisation of
MatchAlias
should be done indealias
.I suppose it is safer to only add the change in
unrollTupleTypes
where it is necessary.Fixes #19385