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
Path dependent type is lost when aliases type parameter and is used in hof #9004
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9004?orig=1 |
@retronym said: def f[R](a: AA[R]): Option[a.R] = Some(1).map(_ => a.r) |
@retronym said: object Main {
trait AA[RR] { type R = RR; def r: R }
def test1(a: AA[B] forSome { type B }) = {
val f = () => a.r
// The tree a.r is given the type `a.R` which normalizes
// to B', where B' is a distinct symbol ("captured existential skolem")
// to substitute for the reference to an existential skolem of B.
//
// inference of the result type of the function computes the
// packed type of tree `a.r` to make sure that terms and types
// local to the body of the function don't leak into its result
// type. The captured existential skolem is considered to be local
// so it is abstracted to its upper bound, Any.
f: (() => a.R)
// The workaround is to annotate the function type, rather than
// relying in inference.
val g: (() => a.R) () => a.r
()
}
// typer debug trace: http://rawgit.com/retronym/d5aeaf8e0a4a2e6eef4b/raw/out.html
}
|
@retronym said: I'll see if that change is at odds with the test suite. Assuming it is sound, we'll have to hide it behind -Xsource:2.12. |
@retronym said: Two failing tests on that branch:
|
@retronym said (edited on Jan 27, 2015 2:52:42 AM UTC): object Test {
def foo1[A1] = new { private type A2 = A1 ; def bar: A2 = ??? }
// def foo2[A1] = new { type A2 = A1 ; def bar: A2 = ??? }
def f1: Int = foo1[Int].bar
// def f2: Int = foo2[Int].bar
} |
The text was updated successfully, but these errors were encountered: