bug icon indicating copy to clipboard operation
bug copied to clipboard

Unification of type alias inconsistent between class and def

Open scabug opened this issue 12 years ago • 5 comments

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]
                 ^

scabug avatar Jan 29 '13 04:01 scabug

Imported From: https://issues.scala-lang.org/browse/SI-7038?orig=1 Reporter: Runar (runar) Affected Versions: 2.9.1, 2.10.0

scabug avatar Jan 29 '13 04:01 scabug

Runar (runar) said: I've opened this as a "blocker" since I don't seem to be able to choose another setting.

scabug avatar Jan 29 '13 04:01 scabug

@gkossakowski said: Downgraded to Major (the default).

scabug avatar Jan 29 '13 05:01 scabug

@retronym said: @Adriaan: here's a patch for discussion: https://github.com/retronym/scala/pull/3

scabug avatar Jan 29 '13 14:01 scabug

Scala 3.3.1 accepts it.

SethTisue avatar Feb 13 '24 21:02 SethTisue