diff options
author | Martin Odersky <odersky@gmail.com> | 2016-11-30 14:34:17 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-11-30 14:34:17 +0100 |
commit | b94e6ea5a54d38470e5793c0084785e2d2f9a819 (patch) | |
tree | 6a3f4e83dbf66ad9a2353d4165f6321fede1dceb /tests/pos/functionXXL.scala | |
parent | 3116142d3e0e2d560b2fa79f73e699e1ac000204 (diff) | |
download | dotty-b94e6ea5a54d38470e5793c0084785e2d2f9a819.tar.gz dotty-b94e6ea5a54d38470e5793c0084785e2d2f9a819.tar.bz2 dotty-b94e6ea5a54d38470e5793c0084785e2d2f9a819.zip |
Drop function 22 limit.
Functions with more than 22 parameters are now
automatically converted to functions taking
a single object array parameter.
This has been achieved by tweaking erasure.
Other things I have tried that did ot work out well:
- Use a single function type in typer. The problem with this
one which could not be circumvented was that existing higher-kinded
code with e.g. Funcor assumes that Functon1 is a binary type constructor.
- Have a late phase that converts to FunctonXXL instead of
doing it in erasure. The problem with that one was that
potentially every type could be affected, which was ill-suited
to the architecture of a miniphase.
Diffstat (limited to 'tests/pos/functionXXL.scala')
-rw-r--r-- | tests/pos/functionXXL.scala | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/pos/functionXXL.scala b/tests/pos/functionXXL.scala new file mode 100644 index 000000000..1063e4170 --- /dev/null +++ b/tests/pos/functionXXL.scala @@ -0,0 +1,72 @@ +object Test { + + val f = (x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + x10: Int, + x11: Int, + x12: Int, + x13: Int, + x14: Int, + x15: Int, + x16: Int, + x17: Int, + x18: Int, + x19: Int, + x20: Int, + x21: Int, + x22: Int, + x23: Int, + x24: Int, + x25: Int, + x26: Int) => 42 + + def main(args: Array[String]) = { + val g = (x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + x10: Int, + x11: Int, + x12: Int, + x13: Int, + x14: Int, + x15: Int, + x16: Int, + x17: Int, + x18: Int, + x19: Int, + x20: Int, + x21: Int, + x22: Int, + x23: Int, + x24: Int, + x25: Int, + x26: Int) => f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, + x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, + x21, x22, x23, x24, x25, x26) + + + + println(f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26)) + + + println(g(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26)) + } + +} |