summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-07-29 16:23:20 +0200
committerMartin Odersky <odersky@gmail.com>2012-07-29 16:23:28 +0200
commitaad84ecba3eda180197bfbbb45a02393358c4c46 (patch)
tree0c526989052124b270825cfa4e4fa61346948016 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent95d53235834ab650ded6768958697d2901fd4dd3 (diff)
downloadscala-aad84ecba3eda180197bfbbb45a02393358c4c46.tar.gz
scala-aad84ecba3eda180197bfbbb45a02393358c4c46.tar.bz2
scala-aad84ecba3eda180197bfbbb45a02393358c4c46.zip
SI-5799 Secondary constructors in value classes not allowed
I changed the SIP and added a test.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 393cbadc6a..130b03ebec 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1386,8 +1386,12 @@ trait Typers extends Modes with Adaptations with Tags {
}
}
body foreach {
- case md: ModuleDef => unit.error(md.pos, "value class may not have nested module definitions")
- case cd: ClassDef => unit.error(cd.pos, "value class may not have nested class definitions")
+ case md: ModuleDef =>
+ unit.error(md.pos, "value class may not have nested module definitions")
+ case cd: ClassDef =>
+ unit.error(cd.pos, "value class may not have nested class definitions")
+ case md: DefDef if md.symbol.isConstructor && !md.symbol.isPrimaryConstructor =>
+ unit.error(md.pos, "value class may not have secondary constructors")
case _ =>
}
for (tparam <- clazz.typeParams)