From ab32f4c42d10e830a4d61e50099b03894db78bbe Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 1 Feb 2017 22:48:07 +0100 Subject: Fix #1644: Disallow inner classes in value classes --- compiler/src/dotty/tools/dotc/typer/Checking.scala | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler/src/dotty/tools/dotc/typer/Checking.scala') 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 => -- cgit v1.2.3