Aladdin - Scala Bugtracking
[#381] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Philippe _ fixed 2004-12-01 12:51:50.0
subject Expansion of mixins inheriting a same method from two direct superclasses is erroneous
code
&otclass A {
  override def toString() : String = "a";
}

class B extends A {
  override def toString() : String = super.toString() + ;, b";
}

class C extends A {
  override def toString() : String = super.toString() + ", c";
}

class D extends A {
  override def toString() : String = super.toString() + ", d";
}


class BC extends B with C;
class BD extends B with D;
class CB extends C with B;
class CD extends C with D;
class DB extends D with B;
class DC extends D with C;

object Test {
  def main( args:Array[String] ): Unit = {
    System.out.println("BC " + (new BC));
    System.out.println("BD " + (new BD));
    System.out.println("CB " + (new CB));
    System.out.println("CD " + (new CD));
    System.out.println("DB " + (new DB));
    System.out.println("DC " + (new DC));
  }
}
what happened
The program prints this:

BC a, b
BD a, b
CB a, c, b
CD a, c
DB a, d, b
DC a, d, c
what expected It should print this:
BC a, b, c
BD a, b, d
CB a, c, b
CD a, c, d
DB a, d, b
DC a, d, c
[back to overview]
Changes of this bug report
Lex  edited on  2006-03-28 14:19:34.0
This does not currently compile because now only traits are allowed to be mixed in. Philippe, could you look again and see if the problem you found is still there??
Gilles  edited on  2007-08-29 10:51:11.0