bug
bug copied to clipboard
Unification of type alias inconsistent between class and def
scala> class Foo[S] { type X = List[S]; val x: X = List() }
defined class Foo
scala> new Foo[Int].x : List[Int]
res0: List[Int] = List()
scala> def foo[S] = { type X = List[S]; List():X }
foo: [S]=> X
scala> foo[Int] : List[Int]
<console>:9: error: type mismatch;
found : X
(which expands to) List[S]
required: List[Int]
foo[Int] : List[Int]
^
Imported From: https://issues.scala-lang.org/browse/SI-7038?orig=1 Reporter: Runar (runar) Affected Versions: 2.9.1, 2.10.0
Runar (runar) said: I've opened this as a "blocker" since I don't seem to be able to choose another setting.
@gkossakowski said: Downgraded to Major (the default).
@retronym said: @Adriaan: here's a patch for discussion: https://github.com/retronym/scala/pull/3
Scala 3.3.1 accepts it.