Skip to content

Unification of type alias inconsistent between class and def #7038

Open
@scabug

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)typer

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions