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

Heal pattern-bound type by gathering constraints #15095

Merged
merged 2 commits into from
May 23, 2022

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented May 3, 2022

No description provided.

@dwijnand dwijnand marked this pull request as ready for review May 4, 2022 07:47
@dwijnand dwijnand requested a review from abgruszecki May 4, 2022 07:48
Copy link
Contributor

@abgruszecki abgruszecki left a comment

Choose a reason for hiding this comment

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

If we want to improve this special case, then actually we don't need to care about variance, we can infer that the pattern-bound abstract type and the type argument in scrutinee type are equal. This is what would happen if we were inferring a type argument to an unapply method.

@dwijnand dwijnand merged commit 67e692d into scala:main May 23, 2022
@dwijnand dwijnand deleted the infer-patmat-type-var branch May 23, 2022 13:16
@Kordyjan Kordyjan added this to the 3.2.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.

Regression from Scala 2: Type variable in pattern match works with invariant type, fails with covariant
3 participants