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

Lambdas with parametrized captured parameters may end with more than 22 parameters. #1385

Closed
nicolasstucki opened this issue Jul 13, 2016 · 1 comment
Assignees

Comments

@nicolasstucki
Copy link
Contributor

 def foo22[T](c1:T, c2:T, c3:T, c4:T, c5:T, c6:T, c7:T, c8:T, c9:T, c10:T, c11:T, c12:T, c13:T, c14:T, c15:T, c16:T, c17:T, c18:T, c19:T, c20:T, c21:T, c22:T): Int => T = {
    (a: Int) => { // This labda ends with 23 parameters (c1 to c22 and a)
      c22; c21; c20; c19; c18; c17; c16; c15; c14; c13; c12; c11; c10; c9; c8; c7; c6; c5; c4; c3; c2; c1
    }
  }

This case will fail because the inner lambda will have 23 parameter, which fails due to #1384.

@odersky
Copy link
Contributor

odersky commented Jul 14, 2016

The illegal closure gets created temporarily in phase lambda lift by the TreeTansform framework. Lambdalift takes the closure and subtracts the environment from it, thereby turning a closure with 23 parameters into a closure with 1 parameter. The most elegant fix is probably to simply accept functions with more than 22 parameters.

@odersky odersky self-assigned this Jul 25, 2016
odersky added a commit that referenced this issue Jul 25, 2016
Fix #1385: Temporarily lift 22 limit for functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants