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/Unapplies.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/Unapplies.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Unapplies.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala index c3631f0d05..735cb4a3c4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala @@ -133,8 +133,11 @@ trait Unapplies extends ast.TreeDSL /** The module corresponding to a case class; overrides toString to show the module's name */ def caseModuleDef(cdef: ClassDef): ModuleDef = { - def inheritFromFun = !(cdef.mods hasFlag ABSTRACT) && cdef.tparams.isEmpty && constrParamss(cdef).length == 1 - def createFun = gen.scalaFunctionConstr(constrParamss(cdef).head map (_.tpt), toIdent(cdef), abstractFun = true) + // > MaxFunctionArity is caught in Namers, but for nice error reporting instead of + // an abrupt crash we trim the list here. + def primaries = constrParamss(cdef).head take MaxFunctionArity map (_.tpt) + def inheritFromFun = !cdef.mods.isAbstract && cdef.tparams.isEmpty && constrParamss(cdef).length == 1 + def createFun = gen.scalaFunctionConstr(primaries, toIdent(cdef), abstractFun = true) def parents = if (inheritFromFun) List(createFun) else Nil def toString = DefDef( Modifiers(OVERRIDE | FINAL), |