diff options
author | Paul Phillips <paulp@improving.org> | 2010-07-02 01:01:44 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-07-02 01:01:44 +0000 |
commit | 57b7e442af26e07dc2411f46b0a8103dfe054101 (patch) | |
tree | fa27f49579d3e2a62781af86f148eb1d4f33fcce /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | 9421f2ecaf85cb2e409e73dad7554e466303c284 (diff) | |
download | scala-57b7e442af26e07dc2411f46b0a8103dfe054101.tar.gz scala-57b7e442af26e07dc2411f46b0a8103dfe054101.tar.bz2 scala-57b7e442af26e07dc2411f46b0a8103dfe054101.zip |
Fail more gracefully on > 22 case class paramet...
Fail more gracefully on > 22 case class parameters. Closes #3631, no
review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index d56b8ed944..2123a00550 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -287,13 +287,11 @@ trait Namers { self: Analyzer => * class definition tree. * @return the companion object symbol. */ - def ensureCompanionObject(tree: ClassDef, creator: => Tree): Symbol = { - val m: Symbol = context.scope.lookup(tree.name.toTermName).filter(! _.isSourceMethod) - if (m.isModule && inCurrentScope(m) && currentRun.compiles(m)) m - else - /*util.trace("enter synthetic companion object for "+currentRun.compiles(m)+":")*/( - enterSyntheticSym(creator)) - } + def ensureCompanionObject(tree: ClassDef, creator: => Tree): Symbol = { + val m: Symbol = context.scope.lookup(tree.name.toTermName).filter(! _.isSourceMethod) + if (m.isModule && inCurrentScope(m) && currentRun.compiles(m)) m + else enterSyntheticSym(creator) + } private def enterSymFinishWith(tree: Tree, tparams: List[TypeDef]) { val sym = tree.symbol @@ -350,6 +348,9 @@ trait Namers { self: Analyzer => tree.symbol = enterClassSymbol(tree) finishWith(tparams) if (mods.isCase) { + if (treeInfo.firstConstructorArgs(impl.body).size > MaxFunctionArity) + context.error(tree.pos, "Implementation restriction: case classes cannot have more than " + MaxFunctionArity + " parameters.") + val m = ensureCompanionObject(tree, caseModuleDef(tree)) caseClassOfModuleClass(m.moduleClass) = tree } |