Aladdin - Scala Bugtracking
[#660] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin noise 2006-07-15 16:50:39.0
subject compatible types are listed as incompatible
code
package test;

abstract class Test {
  abstract class A {
    type X <: XImpl;
    type Y <: X with YImpl;
    abstract class XImpl;
    abstract class YImpl extends XImpl;
  }
  type Z <: b.X with ZImpl;
  trait ZImpl extends b.YImpl;
  abstract class B extends A {
    type X <: XImpl;
    type Y = Z;
    trait XImpl extends super.XImpl;
    trait YImpl extends super.YImpl with XImpl;
  }
  val b : B;
}
what happened
error overriding type Y in class A with bounds >: scala.All <: B.this.X with B.this.YImpl; type Y has incompatib\
le type	test3/src/test	test.scala	line 14	1152966648865	11280
what expected Since b is an instance of B, I would expect that b.X : B.X and b.YImpl : B.YImpl; Or am I missing something here?
[back to overview]
Changes of this bug report
Sean  edited on  2006-07-15 16:50:54.0
Sean  edited on  2006-07-21 07:39:09.0
Martin  edited on  2006-07-24 17:46:32.0
No, this is a type error. The problem is that

Z <: b.X

but in class B we require

Z <: B.this.X

So it would be OK in the `b' instance but not in class `B' in general. If val b and class B are merged in a single object definition, this should work, I think.