diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-07-30 17:32:08 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-07-30 17:32:08 -0700 |
commit | f429c64601ee1c9036eafe9e7ace9b941d24ed07 (patch) | |
tree | c6083f57c00b96b94dc110409ad5c67c6981d61e /src | |
parent | e0b3e9e755d42da7d26977a6c6908a4239e49f3a (diff) | |
parent | aad84ecba3eda180197bfbbb45a02393358c4c46 (diff) | |
download | scala-f429c64601ee1c9036eafe9e7ace9b941d24ed07.tar.gz scala-f429c64601ee1c9036eafe9e7ace9b941d24ed07.tar.bz2 scala-f429c64601ee1c9036eafe9e7ace9b941d24ed07.zip |
Merge pull request #1011 from odersky/ticket/5882
Closes SI-5882
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 5c25cd008b..e57cae00e0 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1401,6 +1401,15 @@ trait Typers extends Modes with Adaptations with Tags { unit.error(clazz.pos, "value class needs to have exactly one public val parameter") } } + 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: DefDef if md.symbol.isConstructor && !md.symbol.isPrimaryConstructor => + unit.error(md.pos, "value class may not have secondary constructors") + case _ => + } for (tparam <- clazz.typeParams) if (tparam hasAnnotation definitions.SpecializedClass) unit.error(tparam.pos, "type parameter of value class may not be specialized") |