Skip to content

Consider GADT upper bounds when upcasting the scrutinee type #15351

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 2 commits into from
Jun 7, 2022

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jun 1, 2022

(cherry picked from commit 172e957)

[test_non_bootstrapped]

@dwijnand dwijnand linked an issue Jun 1, 2022 that may be closed by this pull request
@Linyxus
Copy link
Contributor

Linyxus commented Jun 3, 2022

It seems that the CI tests are not executed for this PR. Is it possible to trigger it manually?

@griggt griggt closed this Jun 3, 2022
@griggt griggt reopened this Jun 3, 2022
@dwijnand dwijnand marked this pull request as ready for review June 3, 2022 12:50
@dwijnand dwijnand requested a review from abgruszecki June 6, 2022 07:38
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.

I think the logic should be closer to calling constrainPatternType with an intersection of the reconstructed/GADT upper bound with the super type. Something like:

tryConstrainSimplePatternType(pat, upcasted) && tryConstrainSimplePatternType(pat, upperGadtBound)
|| constrainUpcasted(upcasted)

@dwijnand dwijnand force-pushed the gadt/unapply-tuple-reasoning-upcast branch from b0fe457 to 5c5189e Compare June 7, 2022 10:04
@dwijnand dwijnand force-pushed the gadt/unapply-tuple-reasoning-upcast branch from 5c5189e to 1c3a286 Compare June 7, 2022 10:05
@dwijnand dwijnand merged commit 6508dfa into scala:main Jun 7, 2022
@dwijnand dwijnand deleted the gadt/unapply-tuple-reasoning-upcast branch June 7, 2022 14:03
@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.

Type equality failure on pattern match with tuple types
5 participants