aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-06-20 15:04:03 +0200
committerMartin Odersky <odersky@gmail.com>2014-06-20 15:04:19 +0200
commitb3364db33ff2ee2d57b4d0eaed03632099244f63 (patch)
treecfc94722c01bf6a7ddb3eff5411149e8a40235e1 /tests/pos
parent7cf6202ea94c016ffc2d2528ad8add186e9f3827 (diff)
downloaddotty-b3364db33ff2ee2d57b4d0eaed03632099244f63.tar.gz
dotty-b3364db33ff2ee2d57b4d0eaed03632099244f63.tar.bz2
dotty-b3364db33ff2ee2d57b4d0eaed03632099244f63.zip
Avoid caching values that depend on typevar state.
TypeVars flip from the initial state, where underlying == origin to the final state where underlying == inst. This flip can invalidate information that depends on the underlying type of a TypeVar. Since we do not know when the flip occurs, we need to avoid keeping any such information in a cache. The commit makes three caches depend on a new value: typerState.ephemeral. The value is set to `true` each time we follow the underlying type of a TypeVar, and this disables cached information to be retained. A test case for this commit is t2693.scala. This test passes typechecking with the previous commit, but fails in -Ycheck:front because of stale cache info in an "#Apply" typeref. The present commit fixes that.
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/t2693.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/pos/t2693.scala b/tests/pos/t2693.scala
new file mode 100644
index 000000000..5d4d0380c
--- /dev/null
+++ b/tests/pos/t2693.scala
@@ -0,0 +1,6 @@
+class A {
+ trait T[A]
+ def usetHk[T[_], A](ta: T[A]) = 0
+ usetHk(new T[Int]{}: T[Int])
+ usetHk(new T[Int]{}) // fails with: found: java.lang.Object with T[Int], required: ?T[ ?A ]
+}