diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-01-19 00:43:15 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-03-25 08:59:18 +0100 |
commit | 844cef628c809de24d908b9a51760ff33d0db345 (patch) | |
tree | 9bbd9db91a7082c98bfacc058b70b0e8ae2c1aa1 /test/files/run/case-class-23.scala | |
parent | ad79d74deef6e624aa7048543207ec97810f07f5 (diff) | |
download | scala-844cef628c809de24d908b9a51760ff33d0db345.tar.gz scala-844cef628c809de24d908b9a51760ff33d0db345.tar.bz2 scala-844cef628c809de24d908b9a51760ff33d0db345.zip |
SI-7296 Remove arity limit for case classes
When venturing above the pre-ordained limit of twenty
two, `Companion extends FunctionN` and `Companion.unapply`
are sacrificed. But oh-so-many other case class features
work perfectly: equality/hashing/stringification, the apply
method, and even pattern matching (which already bypasses
unapply.)
There was some understandable fear of the piecemeal when
I tabled this idea on scala-internals [1]. But I'd like
to persist as this limit is a needless source of pain for
anyone using case classes to bind to database, XML or JSON
schemata.
[1] https://groups.google.com/forum/#!topic/scala-internals/RRu5bppi16Y
Diffstat (limited to 'test/files/run/case-class-23.scala')
-rw-r--r-- | test/files/run/case-class-23.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/case-class-23.scala b/test/files/run/case-class-23.scala new file mode 100644 index 0000000000..92b719574a --- /dev/null +++ b/test/files/run/case-class-23.scala @@ -0,0 +1,33 @@ +case class TwentyThree( + _1: Int, + _2: Int, + _3: Int, + _4: Int, + _5: Int, + _6: Int, + _7: Int, + _8: Int, + _9: Int, + _10: Int, + _11: Int, + _12: Int, + _13: Int, + _14: Int, + _15: Int, + _16: Int, + _17: Int, + _18: Int, + _19: Int, + _20: Int, + _21: Int, + _22: Int, + _23: Int +) + +object Test extends App { + val x = new TwentyThree(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23) + println(x._23) + assert(x.copy(_1 = 1) == x) + val TwentyThree(a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, b) = x + println((a, b)) +} |