From a6f19f5d97b0a4708d769dd3baa9aeb346d3a918 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 7 Oct 2009 03:00:43 +0000 Subject: "Fix" and test case for #1333. --- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 9 +++++++-- test/files/neg/bug1333.check | 4 ++++ test/files/neg/bug1333.scala | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 test/files/neg/bug1333.check create mode 100644 test/files/neg/bug1333.scala diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 7a94f95d52..9128b4ed29 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1085,8 +1085,13 @@ trait Namers { self: Analyzer => * @param namer is the namer of the module class (the comp. obj) */ def addApplyUnapply(cdef: ClassDef, namer: Namer) { - if (!(cdef.symbol hasFlag ABSTRACT)) - namer.enterSyntheticSym(caseModuleApplyMeth(cdef)) + if (!(cdef.symbol hasFlag ABSTRACT)) { + val applyMethod = caseModuleApplyMeth(cdef) + if (applyMethod.vparamss.size > 2) + context.error(cdef.symbol.pos, "case classes limited by implementation: maximum of 2 constructor parameter lists.") + + namer.enterSyntheticSym(applyMethod) + } namer.enterSyntheticSym(caseModuleUnapplyMeth(cdef)) } diff --git a/test/files/neg/bug1333.check b/test/files/neg/bug1333.check new file mode 100644 index 0000000000..11ba633194 --- /dev/null +++ b/test/files/neg/bug1333.check @@ -0,0 +1,4 @@ +bug1333.scala:1: error: case classes limited by implementation: maximum of 2 constructor parameter lists. +case class A(a: Int)(b: Int)(c: Int) + ^ +one error found diff --git a/test/files/neg/bug1333.scala b/test/files/neg/bug1333.scala new file mode 100644 index 0000000000..e16b38cefc --- /dev/null +++ b/test/files/neg/bug1333.scala @@ -0,0 +1 @@ +case class A(a: Int)(b: Int)(c: Int) -- cgit v1.2.3