scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Regression with imports of (values of) dependent types #5213

Closed scabug closed 12 years ago

scabug commented 12 years ago

The following code compiles successfully with 2.9.1.final, but fails with current trunk (2.10.0.r26037-b20111121020211) ... I think the regression occurred some time in the last week or so,

object DepBug {
  class A {
    class B
    def mkB = new B
    def m(b : B) = b
  }

  trait Dep {
    val a : A
    val b : a.B
  }

  val dep = new Dep {
    val a = new A
    val b = a.mkB
  }

  def useDep(d : Dep) {
    import d._
    a.m(b)         // OK
  }

  import dep._
  a.m(b)           // OK with 2.9.1.final, error on trunk  
}

src/depbug.scala:24: error: type mismatch;
 found   : DepBug.dep.a.B
 required: DepBug.dep.a.B
  a.m(b)           // OK with 2.9.1.final, error on trunk  
      ^
one error found
scabug commented 12 years ago

Imported From: https://issues.scala-lang.org/browse/SI-5213?orig=1 Reporter: @milessabin Affected Versions: 2.10.0

scabug commented 12 years ago

@paulp said: r26032, caused by me.

scabug commented 12 years ago

@retronym said: https://github.com/scala/scala/pull/665