aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-02-20 11:28:01 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-02-20 11:54:20 +0100
commit7c4a9ec39ad3c6302767442de34f53c28cc3bebb (patch)
treef3fde1b1c2d8f9805d0ab27521c54414c51b65f7 /compiler/src
parent360406dab1e680ace143a14ee1ea38ebbdacda3c (diff)
downloaddotty-7c4a9ec39ad3c6302767442de34f53c28cc3bebb.tar.gz
dotty-7c4a9ec39ad3c6302767442de34f53c28cc3bebb.tar.bz2
dotty-7c4a9ec39ad3c6302767442de34f53c28cc3bebb.zip
TempClassInfo#addSuspension: do not capture Context
This capture did not cause any problem since we always called TempClassInfo#finalize with the same Context than we captured in `addSuspension`, but it's better to be explicit about these things.
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeOps.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala6
2 files changed, 5 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
index c2a7d7ea6..308e6e306 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala
@@ -401,12 +401,12 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
def forwardRefs(from: Symbol, to: Type, prefs: List[TypeRef]) = to match {
case to @ TypeBounds(lo1, hi1) if lo1 eq hi1 =>
for (pref <- prefs) {
- def forward(): Unit =
+ def forward()(implicit ctx: Context): Unit =
for (argSym <- pref.decls)
if (argSym is BaseTypeArg)
forwardRef(argSym, from, to, cls, decls)
pref.info match {
- case info: TempClassInfo => info.addSuspension(forward)
+ case info: TempClassInfo => info.addSuspension(implicit ctx => forward())
case _ => forward()
}
}
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala
index ae9122853..dafa3b3a8 100644
--- a/compiler/src/dotty/tools/dotc/core/Types.scala
+++ b/compiler/src/dotty/tools/dotc/core/Types.scala
@@ -3089,14 +3089,14 @@ object Types {
* be no longer temporary. These actions will be performed once `cls` gets a real
* ClassInfo.
*/
- private var suspensions: List[() => Unit] = Nil
+ private var suspensions: List[Context => Unit] = Nil
- def addSuspension(suspension: () => Unit): Unit = suspensions ::= suspension
+ def addSuspension(suspension: Context => Unit): Unit = suspensions ::= suspension
/** Install classinfo with known parents in `denot` and resume all suspensions */
def finalize(denot: SymDenotation, parents: List[TypeRef])(implicit ctx: Context) = {
denot.info = derivedClassInfo(classParents = parents)
- suspensions.foreach(_())
+ suspensions.foreach(_(ctx))
}
}