Skip to content

Unification of type alias inconsistent between class and def #7038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
scabug opened this issue Jan 29, 2013 · 5 comments
Open

Unification of type alias inconsistent between class and def #7038

scabug opened this issue Jan 29, 2013 · 5 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) typer
Milestone

Comments

@scabug
Copy link

scabug commented Jan 29, 2013

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
Copy link
Author

scabug commented Jan 29, 2013

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

@scabug

This comment was marked as outdated.

@scabug

This comment was marked as outdated.

@scabug
Copy link
Author

scabug commented Jan 29, 2013

@retronym said:
@adriaan: here's a patch for discussion: retronym/scala#3

@scabug scabug added the typer label Apr 7, 2017
@scala scala deleted a comment from scabug Mar 2, 2018
@SethTisue SethTisue added this to the Backlog milestone Mar 2, 2018
@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Feb 13, 2024
@SethTisue
Copy link
Member

Scala 3.3.1 accepts it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) typer
Projects
None yet
Development

No branches or pull requests

2 participants