summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-09-20 14:27:12 +0000
committerMartin Odersky <odersky@gmail.com>2006-09-20 14:27:12 +0000
commit5508808ef7a5461730f71660785ca45056614d14 (patch)
treeec26929ca4a547b7ce76dec01df89875f1b9f1a3
parenta3b6a1de0796afa338980c81f3ec261b1fbefeae (diff)
downloadscala-5508808ef7a5461730f71660785ca45056614d14.tar.gz
scala-5508808ef7a5461730f71660785ca45056614d14.tar.bz2
scala-5508808ef7a5461730f71660785ca45056614d14.zip
fix^3: bug744
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala13
-rw-r--r--test/files/run/bug744.check3
-rw-r--r--test/files/run/bug744.scala20
3 files changed, 28 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 6274069e2d..e33f639045 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -251,15 +251,12 @@ abstract class AddInterfaces extends InfoTransform {
def mixinConstructorCall(mixinClass: Symbol): Tree = atPos(tree.pos) {
Apply(Select(This(clazz), mixinClass.primaryConstructor), List())
}
- def toImplClass(mc: Symbol) =
- if (mc.isImplClass) mc else implClass(mc)
- def hasMixinConstructor(mc: Symbol) = {
- mc.info;
- (mc.isImplClass || mc.needsImplClass) && mc.toInterface != ScalaObjectClass
- }
+ def toImplClass(sym: Symbol) =
+ if (sym.needsImplClass) implClass(sym) else sym
val mixinConstructorCalls: List[Tree] = {
- for (val mc <- clazz.mixinClasses.reverse; hasMixinConstructor(mc))
- yield mixinConstructorCall(toImplClass(mc))
+ for (val mc <- clazz.mixinClasses.reverse.map(toImplClass).removeDuplicates;
+ mc.isImplClass && mc.toInterface != ScalaObjectClass)
+ yield mixinConstructorCall(mc)
}
tree match { //todo: remove checking code
case Block(supercall :: stats, expr) =>
diff --git a/test/files/run/bug744.check b/test/files/run/bug744.check
new file mode 100644
index 0000000000..757bf01370
--- /dev/null
+++ b/test/files/run/bug744.check
@@ -0,0 +1,3 @@
+BEGIN
+Hello from linked
+END
diff --git a/test/files/run/bug744.scala b/test/files/run/bug744.scala
new file mode 100644
index 0000000000..4895e9baa0
--- /dev/null
+++ b/test/files/run/bug744.scala
@@ -0,0 +1,20 @@
+trait Linked {
+ type File <: FileImpl;
+ trait FileImpl {
+ Console.println("Hello from linked");
+ }
+}
+object Test {
+ class Test extends Linked {
+ trait FileImpl extends super.FileImpl {
+// val x: int = 1
+ }
+ class File extends FileImpl;
+ }
+ def main(args : Array[String]) : Unit = {
+ Console.println("BEGIN");
+ val test = new Test;
+ val file = new test.File;
+ Console.println("END");
+ }
+}