-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Poly functions are not beta reduced #15968
Comments
You mean, the reducer should do type inference on the argument? That would be a lot to ask! |
Not sure I understand. Are you saying it does work in some cases already, and I just did it wrong? |
No, not at all. Just that it would be a rather big jump from what we have to this, and something that would tear down some important modularity barriers we have in the implementation. |
Managed to work around this for now using value classes and dependent function types instead of poly times. Seems these beta reduce just fine. |
Beta-reduce directly applied PolymorphicFunction such as ```scala ([Z] => (arg: Z) => { def a: Z = arg; a }).apply[Int](2) ``` into ```scala 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
Compiler version
3.2.0
Minimized code
Decompiled code (with Fernflower)
Expectation
That both the normal and poly function both beta reduce
The text was updated successfully, but these errors were encountered: