diff options
author | Martin Odersky <odersky@gmail.com> | 2015-01-27 11:38:50 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-01-27 11:38:50 +0100 |
commit | 57b616c1a7adc78dd46cb3ae5545e312c11e69be (patch) | |
tree | 105089136359d4114b2b16f33c45dfac70b695fe /tests/pos/t9004.scala | |
parent | f59d1d33d6e9dbb2988f165dc9b5b03792218a4c (diff) | |
download | dotty-57b616c1a7adc78dd46cb3ae5545e312c11e69be.tar.gz dotty-57b616c1a7adc78dd46cb3ae5545e312c11e69be.tar.bz2 dotty-57b616c1a7adc78dd46cb3ae5545e312c11e69be.zip |
New tests
Diffstat (limited to 'tests/pos/t9004.scala')
-rw-r--r-- | tests/pos/t9004.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/pos/t9004.scala b/tests/pos/t9004.scala new file mode 100644 index 000000000..d591bc852 --- /dev/null +++ b/tests/pos/t9004.scala @@ -0,0 +1,29 @@ +object Main { + trait AA[RR] { type R = RR; def r: R } + + def test1(a: AA[_]) = { + 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. + // + // However, the packedType transformation need not have even considered + // B', as it is clear that the type `a.R` is not local to the function + // body! + f: (() => a.R) + + // The workaround is to annotate the function type, rather than + // relying in inference. + val g: (() => a.R) = () => a.r + val g2 = () => a.r + + () + } + // typer debug trace: http://rawgit.com/retronym/d5aeaf8e0a4a2e6eef4b/raw/out.html +} |