Aladdin - Scala Bugtracking
[#599] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-05-18 11:34:46.0
subject cannot access member when outer bound of inner type is refined.
code
abstract class FooA {
    type A <: Ax;
    abstract class Ax;
    abstract class InnerA {
      type B <: A;
      def doB : B;
    }
  }
  trait FooB extends FooA {
    type A <: Ax;
    trait Ax extends super.Ax { def xxx : Int; }
    abstract class InnerB extends InnerA {
      // type B <: A;
      val a : A = doB;
      a.xxx;
      doB.xxx;
    }
  } 
what happened
Error    scala.test/src/test    Main.scala    value xxx is not a member of  InnerB.this.B    line 21

Error goes away if we uncomment the second "type B <: A" statement.   Note that doB is treated like a subtype of\
 FooB#A because the "val  a : A = doB" statement passes type checking. 
what expected Either doB is not a subtype of FooB#A and the assignment "val a : A = doB" fails, or A is a subtype of FooB#A and the statement "doB.xxx" passes.
[back to overview]
Changes of this bug report
Martin  edited on  2006-05-31 11:47:01.0
Martin  edited on  2006-10-31 10:49:37.0