diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/AddInterfaces.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Erasure.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Mixin.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t3417.scala | 11 |
4 files changed, 15 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index e08b76443c..f1ed9f43a0 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -161,7 +161,8 @@ abstract class AddInterfaces extends InfoTransform { case ClassInfoType(parents, decls, _) => assert(phase == implClassPhase) ClassInfoType( - ObjectClass.tpe :: (parents.tail map mixinToImplClass) ::: List(iface.tpe), + ObjectClass.tpe :: (parents.tail map mixinToImplClass filter (_.typeSymbol != ObjectClass)) + ::: List(iface.tpe), implDecls(sym, decls), sym) case PolyType(tparams, restpe) => diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 9f36fe342c..4c000ce3f7 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -335,9 +335,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast. def erasedTypeRef(sym: Symbol): Type = typeRef(erasure(sym.owner.tpe), sym, List()) - /** Remove duplicate references to class Object in a list of parent classes - * todo: needed? - */ + /** Remove duplicate references to class Object in a list of parent classes */ private def removeDoubleObject(tps: List[Type]): List[Type] = tps match { case List() => List() case tp :: tps1 => diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index d39176e8a9..bc04796e1f 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -567,7 +567,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { val newSyms = newDefs map (_.symbol) def isNotDuplicate(tree: Tree) = tree match { case DefDef(_, _, _, _, _, _) => - val sym = tree.symbol; + val sym = tree.symbol !(sym.isDeferred && (newSyms exists (nsym => nsym.name == sym.name && (nsym.tpe matches sym.tpe)))) case _ => diff --git a/test/files/pos/t3417.scala b/test/files/pos/t3417.scala new file mode 100644 index 0000000000..d2de1608aa --- /dev/null +++ b/test/files/pos/t3417.scala @@ -0,0 +1,11 @@ +trait X extends NotNull { + def foo = 1 +} + +trait Y extends Object with NotNull { + def bar = 1 +} + +class Z extends NotNull + +class W extends Object with NotNull |