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
Possible Regression: Defining type covariant type alias fails when using in invariant position same compilation unit #10140
Comments
Imported From: https://issues.scala-lang.org/browse/SI-10140?orig=1 |
David Koeplinger (dkoeplin) said (edited on Feb 14, 2017 10:26:03 AM UTC): trait X {
type Id[+A] = A
def foo[A](x: Id[A]) = x
}
However, if the type alias is defined in a separate trait, there's no error. trait X {
type Id[+A] = A
}
trait Y extends X {
def foo[A](x: Id[A]) = x
} |
@SethTisue said: |
@SethTisue said: |
We have com about this recently as well, here is what we did: // Does compile using Scala 2.11 (REPL)
// Does not compile using Scala 2.12 (REPL)
// Compiles using dotty (REPL)
trait TC[F[_]]; type F[+T] = T; new TC[F] {}
// Workaround for Scala 2.12 (REPL)
trait TC[F[_]]; object Foo {type F[+T] = T}; new TC[Foo.F] {} |
No longer the case
|
This code used to work in Scala-2.11
Now this fails with
However, If I change where I define type
Id[+A] = A
then it works.I also get this behaviour with real source files, not just in the repl.
The text was updated successfully, but these errors were encountered: