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
Fix parents of tuple classes #13659
Fix parents of tuple classes #13659
Conversation
@@ -349,7 +349,11 @@ object TypeOps: | |||
val doms = dominators(commonBaseClasses, Nil) | |||
def baseTp(cls: ClassSymbol): Type = | |||
tp.baseType(cls).mapReduceOr(identity)(mergeRefinedOrApplied) | |||
doms.map(baseTp).reduceLeft(AndType.apply) | |||
def meet(tp1: Type, tp2: Type) = | |||
if !tp1.exists then tp2 |
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.
I don't understand why this is needed, we do:
val commonBaseClasses = tp.mapReduceOr(_.baseClasses)(intersect)
(btw, how is this different from tp.baseClasses
?)
So I would expect tp.baseType
on any of the common base classes to exist, but in fact the base classes of Tuple1[(Axis, Int)] | ((Axis, Int), (Axis, Int))
contains Product2
, even though Tuple1
does not extend Product2
, so I think there's a bug in how we compute base classes for unions, either here or in OrType#baseClasses.
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.
(btw, how is this different from tp.baseClasses ?)
Turns out it's different for Null
. Since Null
is also outside the inheritance hierarchy.
We inserted the :* class not in the correct place, so the linearizations of Tuple1..Tuple22 were messed up.
Fixes #13435