summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala4
-rw-r--r--test/files/neg/t7296.check4
-rw-r--r--test/files/neg/t7296.scala6
3 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index e966cc9060..1f54671ad0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1373,7 +1373,9 @@ trait Namers extends MethodSynthesis {
if (!cdef.symbol.hasAbstractFlag)
namer.enterSyntheticSym(caseModuleApplyMeth(cdef))
- namer.enterSyntheticSym(caseModuleUnapplyMeth(cdef))
+ val primaryConstructorArity = treeInfo.firstConstructorArgs(cdef.impl.body).size
+ if (primaryConstructorArity <= MaxTupleArity)
+ namer.enterSyntheticSym(caseModuleUnapplyMeth(cdef))
}
def addCopyMethod(cdef: ClassDef, namer: Namer) {
diff --git a/test/files/neg/t7296.check b/test/files/neg/t7296.check
new file mode 100644
index 0000000000..66e8353ee3
--- /dev/null
+++ b/test/files/neg/t7296.check
@@ -0,0 +1,4 @@
+t7296.scala:5: error: Implementation restriction: case classes cannot have more than 22 parameters.
+ case class Foo(a: A, b: A, c: A, d: A, e: A, f: A, g: A, h: A, i: A, j: A, k: A, l: A, m: A, n: A, o: A, p: A, q: A, r: A, s: A, t: A, u: A, v: A, w: A, x: A, y: A, Z: A)
+ ^
+one error found
diff --git a/test/files/neg/t7296.scala b/test/files/neg/t7296.scala
new file mode 100644
index 0000000000..0c078d3657
--- /dev/null
+++ b/test/files/neg/t7296.scala
@@ -0,0 +1,6 @@
+object Test {
+ type A = Int
+ // Emits the implementation restriction but then proceeds to crash
+ // when creating the Foo.unapply.
+ case class Foo(a: A, b: A, c: A, d: A, e: A, f: A, g: A, h: A, i: A, j: A, k: A, l: A, m: A, n: A, o: A, p: A, q: A, r: A, s: A, t: A, u: A, v: A, w: A, x: A, y: A, Z: A)
+}