Skip to content
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

2.12 Regression: covariant type alias can't be used as type ctor param #10168

Closed
scabug opened this issue Jan 31, 2017 · 4 comments
Closed

2.12 Regression: covariant type alias can't be used as type ctor param #10168

scabug opened this issue Jan 31, 2017 · 4 comments

Comments

@scabug
Copy link

scabug commented Jan 31, 2017

The attached file compiles fine with 2.11.8 but results in 4 errors using 2.12.0 and 2.12.1:

[error] /home/golly/crap/bug212/Blah.scala:8: covariant type Id occurs in invariant position in supertype Blah.X[Blah.WithIdTypeAlias.Id] of object Y1
[error]     object Y1 extends X[Id]   // FAILURE
[error]            ^
[error] /home/golly/crap/bug212/Blah.scala:9: covariant type Id occurs in invariant position in type => Blah.X[Blah.WithIdTypeAlias.Id] of value Y2
[error]     val Y2 = new X[Id]        // FAILURE
[error]         ^
[error] /home/golly/crap/bug212/Blah.scala:10: covariant type Id occurs in invariant position in type => Blah.X[Blah.WithIdTypeAlias.Id] of method Y3
[error]     def Y3 = new X[Id]        // FAILURE
[error]         ^
[error] /home/golly/crap/bug212/Blah.scala:13: covariant type Id occurs in invariant position in type => Blah.X[Blah.WithIdTypeAlias.Id] of method EX
[error]     def EX: X[Id] = new X[Id] // FAILURE
[error]         ^
[error] four errors found

WithIdClass is a copy-paste of WithIdTypeAlias with only the Id definition changed. When Id is a class and not a type alias, it compiles without error in 2.12.x.

@scabug
Copy link
Author

scabug commented Jan 31, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10168?orig=1
Reporter: David Barri (japgolly)
Affected Versions: 2.12.0, 2.12.1
See #10140
Attachments:

  • Blah.scala (created on Jan 31, 2017 7:33:20 AM UTC, 635 bytes)

@scabug
Copy link
Author

scabug commented Feb 14, 2017

David Barri (japgolly) said:
Hello. This regression prevents me from releasing the upcoming redesign of scalajs-react for Scala 2.12.
I'd really, really like to get it fixed in 2.12.2. Is there anything I can do to help that happen?

@scabug
Copy link
Author

scabug commented Feb 14, 2017

@SethTisue said:
this is a duplicate of #10140, isn't it?

@scabug
Copy link
Author

scabug commented Feb 14, 2017

David Barri (japgolly) said:
Oh well spotted, I missed that. Yes it is!

It also provides a simple workaround by moving the type alias out into its own class/trait. Fantastic!
Urgency *= 0.1.
Thank you.

I'll close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant