summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 063f615e17..a6d7424837 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1551,10 +1551,15 @@ trait Typers extends Modes with Adaptations with Tags {
*/
def validateParentClasses(parents: List[Tree], selfType: Type) {
val pending = ListBuffer[AbsTypeError]()
- def validateParentClass(parent: Tree, superclazz: Symbol) {
+ @inline def validateDynamicParent(parent: Symbol) =
+ if (parent == DynamicClass) checkFeature(parent.pos, DynamicsFeature)
+
+ def validateParentClass(parent: Tree, superclazz: Symbol) =
if (!parent.isErrorTyped) {
val psym = parent.tpe.typeSymbol.initialize
+
checkStablePrefixClassType(parent)
+
if (psym != superclazz) {
if (psym.isTrait) {
val ps = psym.info.parents
@@ -1564,6 +1569,7 @@ trait Typers extends Modes with Adaptations with Tags {
pending += ParentNotATraitMixinError(parent, psym)
}
}
+
if (psym.isFinal)
pending += ParentFinalInheritanceError(parent, psym)
@@ -1586,12 +1592,17 @@ trait Typers extends Modes with Adaptations with Tags {
pending += ParentSelfTypeConformanceError(parent, selfType)
if (settings.explaintypes.value) explainTypes(selfType, parent.tpe.typeOfThis)
}
+
if (parents exists (p => p != parent && p.tpe.typeSymbol == psym && !psym.isError))
pending += ParentInheritedTwiceError(parent, psym)
+
+ validateDynamicParent(psym)
}
+
+ if (!parents.isEmpty && parents.forall(!_.isErrorTyped)) {
+ val superclazz = parents.head.tpe.typeSymbol
+ for (p <- parents) validateParentClass(p, superclazz)
}
- if (!parents.isEmpty && parents.forall(!_.isErrorTyped))
- for (p <- parents) validateParentClass(p, parents.head.tpe.typeSymbol)
/*
if (settings.Xshowcls.value != "" &&