summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index 77c2d13b78..7c7c6609c5 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -44,13 +44,12 @@ abstract class Constructors extends Transform with ast.TreeDSL {
)
// decompose primary constructor into the three entities above.
val constrInfo: ConstrInfo = {
- stats find (_.symbol.isPrimaryConstructor) match {
+ val ddef = (stats find (_.symbol.isPrimaryConstructor))
+ ddef match {
case Some(ddef @ DefDef(_, _, _, List(vparams), _, rhs @ Block(_, _))) =>
ConstrInfo(ddef, vparams map (_.symbol), rhs)
case x =>
- // AnyVal constructor is OK
- assert(clazz eq AnyValClass, "no constructor in template: impl = " + impl)
- return impl
+ abort("no constructor in template: impl = " + impl)
}
}
import constrInfo._
@@ -594,8 +593,13 @@ abstract class Constructors extends Transform with ast.TreeDSL {
override def transform(tree: Tree): Tree = {
tree match {
case cd : ClassDef if !cd.symbol.isInterface && !isPrimitiveValueClass(cd.symbol) =>
- checkUninitializedReads(cd)
- deriveClassDef(cd)(transformClassTemplate)
+ if(cd.symbol eq AnyValClass) {
+ cd
+ }
+ else {
+ checkUninitializedReads(cd)
+ deriveClassDef(cd)(transformClassTemplate)
+ }
case _ =>
super.transform(tree)
}