-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix #9260 - Enums copy variance of parent #9709
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 #9260 - Enums copy variance of parent #9709
Conversation
a26cebe
to
8e7a59c
Compare
8e7a59c
to
a126ebf
Compare
27919fb
to
99a6e2b
Compare
99a6e2b
to
b1c490a
Compare
TypeDef(sym.name, DerivedFromParamTree().watching(sym)).withFlags(TypeParam) | ||
def derivedTypeParamWithVariance(sym: TypeSymbol)(using Context): TypeDef = | ||
val variance = VarianceFlags & sym.flags | ||
TypeDef(sym.name, DerivedFromParamTree().watching(sym)).withFlags(TypeParam | Synthetic | variance) |
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.
For consistency, we should probably set Synthetic on the other derivedTypeParam and on derivedTermParam assuming that doesn't break things.
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.
If I add synthetic flag in derivedTermParam it changes the positions in this test: https://github.com/lampepfl/dotty/blob/ce48f5a2c79373f8a33ced1d251de0206ed5cba9/language-server/test/dotty/tools/languageserver/DefinitionTest.scala#L182
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.
yeah so maybe it's not worth it, what does it change the position to?
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.
from line 0-15:16 to line 0-11:14
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.
is this worth investigating in this PR?
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.
Probably not
previously, the interpolated type parameters for a class enum case would forget the flags of the copied type parameter, now we copy the intersection of its flags with the variance flags
fixes #9260