aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-02 14:55:06 +1100
committerMartin Odersky <odersky@gmail.com>2017-02-08 22:20:26 +1100
commitba66bd47f08e1adf3d44f578452a5113948cb988 (patch)
treec1f4d9134ffd94f7d750ddbea1798a09bd89fda2 /compiler/src/dotty/tools/dotc/typer/Typer.scala
parentb77c24cde0caa59472108a068b4d802606ad5d1b (diff)
downloaddotty-ba66bd47f08e1adf3d44f578452a5113948cb988.tar.gz
dotty-ba66bd47f08e1adf3d44f578452a5113948cb988.tar.bz2
dotty-ba66bd47f08e1adf3d44f578452a5113948cb988.zip
Fix #1501 - Check trait inheritance condition
We need to check a coherence condition between the superclass of a trait and the superclass of an inheriting class or trait.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 18ae790b7..4f9d96c70 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1288,6 +1288,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
if (tree.isType) {
val result = typedType(tree)(superCtx)
val psym = result.tpe.typeSymbol
+ checkTraitInheritance(psym, cls, tree.pos)
if (psym.is(Trait) && !cls.is(Trait) && !cls.superClass.isSubClass(psym))
maybeCall(result, psym, psym.primaryConstructor.info)
else
@@ -1295,6 +1296,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
else {
val result = typedExpr(tree)(superCtx)
+ checkTraitInheritance(result.symbol, cls, tree.pos)
checkParentCall(result, cls)
result
}