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

Add the expected type to Poly's desugaring #15570

Merged
merged 1 commit into from
Jul 7, 2022
Merged

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jul 1, 2022

By doing so, the expected type can drive the correct GADT casting in the
match cases, which means the overall poly function tree will have a type
that conforms to its expected type.

By doing so, the expected type can drive the correct GADT casting in the
match cases, which means the overall poly function tree will have a type
that conforms to its expected type.
@dwijnand dwijnand linked an issue Jul 1, 2022 that may be closed by this pull request
@dwijnand dwijnand marked this pull request as ready for review July 4, 2022 12:51
@dwijnand dwijnand requested a review from sjrd July 4, 2022 12:51
Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

Is there any precedent for using types to drive desugaring? Is that a good idea?

@dwijnand
Copy link
Member Author

dwijnand commented Jul 4, 2022

Is there any precedent for using types to drive desugaring? Is that a good idea?

Closure desugaring is driven by the expected type, and was my inspiration. makeClosure uses resultTpt, which is the result of inspecting the expected type in decomposeProtoFunction.

Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

LGTM.

@dwijnand dwijnand merged commit 1724d84 into scala:main Jul 7, 2022
@dwijnand dwijnand deleted the gadt/poly branch July 7, 2022 09:27
@SethTisue
Copy link
Member

👏 , very satisfying to see this landing. It's so nice when it turns out that the Right Thing just needed to be done (and that it wasn't being done already was merely an apparent oversight and not some hairy dilemma).

@Kordyjan Kordyjan added this to the 3.2.1 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.

Nonunified types in GADT pattern match
4 participants