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

Beta-reduce directly applied PolymorphicFunction #16623

Merged
merged 8 commits into from
Feb 12, 2023

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Jan 5, 2023

Beta-reduce directly applied PolymorphicFunction such as

([Z] => (arg: Z) => { def a: Z = arg; a }).apply[Int](2)

into

type Z = Int
val arg = 2
def a: Z = arg
a

Apply this beta reduction in the BetaReduce phase and Expr.betaReduce. Also, refactor the beta-reduce logic to avoid code duplication.

Fixes #15968

@nicolasstucki nicolasstucki self-assigned this Jan 5, 2023
@nicolasstucki nicolasstucki force-pushed the generalize-beta-reduction branch from 7e4fe17 to 223c8b7 Compare January 9, 2023 09:03
@nicolasstucki nicolasstucki force-pushed the generalize-beta-reduction branch from fd4a7f9 to d37902d Compare January 9, 2023 09:32
@nicolasstucki nicolasstucki requested a review from smarter January 9, 2023 13:48
@nicolasstucki nicolasstucki marked this pull request as ready for review January 9, 2023 15:48
@odersky odersky merged commit c5c5aa6 into scala:main Feb 12, 2023
@odersky odersky deleted the generalize-beta-reduction branch February 12, 2023 09:23
@Kordyjan Kordyjan added this to the 3.3.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.

Poly functions are not beta reduced
4 participants