diff options
author | Martin Odersky <odersky@gmail.com> | 2006-02-01 16:24:46 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-02-01 16:24:46 +0000 |
commit | dd7e035a5d04fe720871c9c3c30efab4e9bbfe11 (patch) | |
tree | fa3c7031f43e4295e6b1df0345c0391af43ba2dd | |
parent | 0ec22a89f29607d02c0a5419beaed73d07abc488 (diff) | |
download | scala-dd7e035a5d04fe720871c9c3c30efab4e9bbfe11.tar.gz scala-dd7e035a5d04fe720871c9c3c30efab4e9bbfe11.tar.bz2 scala-dd7e035a5d04fe720871c9c3c30efab4e9bbfe11.zip |
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index add033d6d4..01a0e070f3 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -122,7 +122,7 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable new SourceReader(charset.newDecoder()); } - val classPath0 = new ClassPath(onlyPresentation); + val classPath0 = new ClassPath(onlyPresentation); val classPath = new classPath0.Build( settings.classpath.value, diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index b419df7de5..1546494ed4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -535,13 +535,19 @@ mixin class Typers requires Analyzer { */ def validateParentClasses(parents: List[Tree], selfType: Type): unit = { - def validateParentClass(parent: Tree, isFirst: boolean): unit = + def validateParentClass(parent: Tree, superclazz: Symbol): unit = if (!parent.tpe.isError) { val psym = parent.tpe.symbol.initialize if (!psym.isClass) error(parent.pos, "class type expected") - else if (!isFirst && !psym.isMixin) - if (settings.migrate.value) + else if (psym != superclazz) + if (psym.isMixin) { + val ps = psym.info.parents + if (!ps.isEmpty && !superclazz.isSubClass(ps.head.symbol)) + error(parent.pos, "illegal inheritance; super"+superclazz+ + "\n is not a subclass of the super"+ps.head.symbol+ + "\n of the mixin " + psym); + } else if (settings.migrate.value) error(parent.pos, migrateMsg+psym+" needs to be a declared as a mixin class") else error(parent.pos, ""+psym+" is not declared to be a mixin class") @@ -563,10 +569,7 @@ mixin class Typers requires Analyzer { error(parent.pos, ""+psym+" is inherited twice") } - if (!parents.isEmpty) { - validateParentClass(parents.head, true) - for (val p <- parents.tail) validateParentClass(p, false) - } + for (val p <- parents) validateParentClass(p, parents.head.tpe.symbol) } def typedClassDef(cdef: ClassDef): Tree = { |