From 8c28293fd52213616ed8ca3a2f600eb1e19debe0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 11 Jun 2015 19:09:06 +0200 Subject: Implement checking for illegal parent trait constructor calls. A parent trait may not be parameterized (as in T()) if the calling class does not directly implement that trait. --- src/dotty/tools/dotc/typer/Typer.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 5f03d19e7..2bdd0d197 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -911,8 +911,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (tree.isType) typedType(tree)(superCtx) else { val result = typedExpr(tree)(superCtx) - if ((cls is Trait) && result.tpe.classSymbol.isRealClass && !ctx.isAfterTyper) - ctx.error(s"trait may not call constructor of ${result.tpe.classSymbol}", tree.pos) + checkParentCall(result, cls) result } -- cgit v1.2.3