diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2017-02-01 22:48:07 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2017-02-01 22:48:34 +0100 |
commit | ab32f4c42d10e830a4d61e50099b03894db78bbe (patch) | |
tree | 9330dcab49065f763b632e94b3045bf4deea860f /compiler/src/dotty/tools/dotc/typer | |
parent | 6e8933ccc40bbfe1a92c32c2d8314fd6facef12a (diff) | |
download | dotty-ab32f4c42d10e830a4d61e50099b03894db78bbe.tar.gz dotty-ab32f4c42d10e830a4d61e50099b03894db78bbe.tar.bz2 dotty-ab32f4c42d10e830a4d61e50099b03894db78bbe.zip |
Fix #1644: Disallow inner classes in value classes
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer')
-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 41d9f9572..5d3096e24 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -410,6 +410,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 => |