I have a simple code that matches elements against a Seq whose length is 26.
test("Seq Pattern matching") {
val x = 1 to 26
x match {
case Seq(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) => println(a)
}
}
It will call Seq.unapplySeq method to de-structure the Seq object x,but I am surprised to see that the code causes compiling error:
Error:(82, 12) too many arguments for unapply pattern, maximum = 22
case Seq(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) => println(a)
In the unapplySeq method, it does NOT have any relationship with case class or tuple which have 22 fields limit.
So, I would ask why the error occurs(why case class/tuple fields limit causes this problem)
I am using Scala 2.11.8