diff options
author | odersky <odersky@gmail.com> | 2017-02-02 09:28:14 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-02 09:28:14 +1100 |
commit | cca5dd9bd0c8f0d2e5679c81f2c40247a45d7a02 (patch) | |
tree | 5fb6048ffe8f75d9d36271cc76f791ed00888935 /compiler | |
parent | b5185f1b4481ef61243741c7f7ed0ba8f696776b (diff) | |
parent | ab32f4c42d10e830a4d61e50099b03894db78bbe (diff) | |
download | dotty-cca5dd9bd0c8f0d2e5679c81f2c40247a45d7a02.tar.gz dotty-cca5dd9bd0c8f0d2e5679c81f2c40247a45d7a02.tar.bz2 dotty-cca5dd9bd0c8f0d2e5679c81f2c40247a45d7a02.zip |
Merge pull request #1925 from dotty-staging/fix/inner-vc
Fix #1644: Disallow inner classes in value classes
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Checking.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index 321c275d7..ca62ed0a9 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -415,6 +415,8 @@ object Checking { /** Verify classes extending AnyVal meet the requirements */ def checkDerivedValueClass(clazz: Symbol, stats: List[Tree])(implicit ctx: Context) = { def checkValueClassMember(stat: Tree) = stat match { + case _: TypeDef if stat.symbol.isClass => + ctx.error(s"value class may not define an inner class", stat.pos) case _: ValDef if !stat.symbol.is(ParamAccessor) => ctx.error(s"value class may not define non-parameter field", stat.pos) case d: DefDef if d.symbol.isConstructor => |