Skip to content
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 variance checking in refinements #18053

Merged
merged 1 commit into from
Jul 3, 2023
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 24, 2023

Do variance checks for parameters in method types and poly types of refinements.

Fixes #18035

Do variance checks for parameters in method types and poly types of refinements.

Fixes scala#18035
Copy link
Member

@mbovel mbovel left a comment

Choose a reason for hiding this comment

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

If I understood well: as the source comment states, we do not check parameters of methods because these are checked later. However, this only applies to the first level. Parameters within methods in refinement types, for example, still require checking. Therefore, this PR removes the MethodOrPoly case from the VarianceChecker, allowing the transformer to recurse on parameters. The special case for first-level definitions is moved to a new function, checkInfo. This new function still needs to be recursive in order to appropriately handle polymorphic and curried functions.

@odersky odersky merged commit 0a21ecf into scala:main Jul 3, 2023
@odersky odersky deleted the fix-18035 branch July 3, 2023 21:59
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 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 checking ignores structural types
3 participants