Skip to content

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

Merged
merged 6 commits into from
Sep 18, 2020

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented Sep 2, 2020

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

@bishabosha bishabosha changed the title Enums copy variance of parent fix #9260 - Enums copy variance of parent Sep 2, 2020
@bishabosha bishabosha force-pushed the topic/enum-unification branch from a26cebe to 8e7a59c Compare September 7, 2020 12:51
@bishabosha bishabosha force-pushed the topic/enum-unification branch from 8e7a59c to a126ebf Compare September 7, 2020 12:57
@bishabosha bishabosha requested a review from smarter September 7, 2020 15:28
@bishabosha bishabosha force-pushed the topic/enum-unification branch from 27919fb to 99a6e2b Compare September 7, 2020 15:29
@bishabosha bishabosha force-pushed the topic/enum-unification branch from 99a6e2b to b1c490a Compare September 7, 2020 17:56
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)
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

@bishabosha bishabosha Sep 9, 2020

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not

@bishabosha bishabosha requested a review from smarter September 9, 2020 08:57
@smarter smarter assigned bishabosha and unassigned smarter Sep 18, 2020
@bishabosha bishabosha merged commit 6daa7b5 into scala:master Sep 18, 2020
@bishabosha bishabosha deleted the topic/enum-unification branch September 18, 2020 13:42
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variance not copied into enum case class type parameters
3 participants