summaryrefslogtreecommitdiff
path: root/test/files/pos/t7782.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-08-26 12:30:21 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-08-27 14:14:49 +0200
commitbce786f070afe383d203c4d809ef69803330b340 (patch)
treedca39efd16812119183ccd5d0f5b7fe5f4ebc722 /test/files/pos/t7782.scala
parent9600d2b7432ddde7c19ecf672ad3247615bd6475 (diff)
downloadscala-bce786f070afe383d203c4d809ef69803330b340.tar.gz
scala-bce786f070afe383d203c4d809ef69803330b340.tar.bz2
scala-bce786f070afe383d203c4d809ef69803330b340.zip
SI-7782 Derive type skolems at the ground level
Rather than at the current value of `skolemizationLevel`, which could be influenced by an in-flight existential subtype computation. This method is called in `PolyTypeCompleter`, which could be constructed by the lazy type completer of the enclosing class. So currently it is closing over a mutable variable; hence the Heisenbug. This issue was exposed by the changes in b74c33eb860, which was introduced in Scala 2.10.1.
Diffstat (limited to 'test/files/pos/t7782.scala')
-rw-r--r--test/files/pos/t7782.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/pos/t7782.scala b/test/files/pos/t7782.scala
new file mode 100644
index 0000000000..037bdad673
--- /dev/null
+++ b/test/files/pos/t7782.scala
@@ -0,0 +1,25 @@
+package pack
+
+object Test {
+ import O.empty
+ empty // this will trigger completion of `test`
+ // with skolemizationLevel = 1
+}
+
+object O {
+ // order matters (!!!)
+
+ // this order breaks under 2.10.x
+ def empty[E]: C[E] = ???
+ def empty(implicit a: Any): Any = ???
+}
+
+abstract class C[E] {
+ def foo[BB](f: BB)
+ def test[B](f: B): Any = foo(f)
+ // error: no type parameters for method foo: (<param> f: BB)scala.this.Unit exist so that it can be applied to arguments (B&1)
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : B&1
+ // required: ?BB
+}