summaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala b/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala
index 3bcb793926..2c2ed351c9 100644
--- a/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala
+++ b/src/reflect/scala/reflect/internal/ExistentialsAndSkolems.scala
@@ -19,6 +19,9 @@ trait ExistentialsAndSkolems {
* can be deskolemized to the original type parameter. (A skolem is a
* representation of a bound variable when viewed inside its scope.)
* !!!Adriaan: this does not work for hk types.
+ *
+ * Skolems will be created at level 0, rather than the current value
+ * of `skolemizationLevel`. (See SI-7782)
*/
def deriveFreshSkolems(tparams: List[Symbol]): List[Symbol] = {
class Deskolemizer extends LazyType {
@@ -30,7 +33,11 @@ trait ExistentialsAndSkolems {
sym setInfo sym.deSkolemize.info.substSym(typeParams, typeSkolems)
}
}
- (new Deskolemizer).typeSkolems
+
+ val saved = skolemizationLevel
+ skolemizationLevel = 0
+ try new Deskolemizer().typeSkolems
+ finally skolemizationLevel = saved
}
def isRawParameter(sym: Symbol) = // is it a type parameter leaked by a raw type?