aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-09-12 18:53:53 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-02 16:12:28 +0200
commit4de907a313e9b85058cd9611116a1cbcf2bd3a4f (patch)
tree6992c2247f9a7e0b3b623e36da8ccfb1e2de461c /src/dotty/tools/dotc/core
parent7537cfcfa5ccf47d400e2841b9bc4ff2cac1eada (diff)
downloaddotty-4de907a313e9b85058cd9611116a1cbcf2bd3a4f.tar.gz
dotty-4de907a313e9b85058cd9611116a1cbcf2bd3a4f.tar.bz2
dotty-4de907a313e9b85058cd9611116a1cbcf2bd3a4f.zip
Always use implicit context at the current period
An implicit method might be unpickled in one run and the implicit body might be selected first in a subsequent run. In that case the inlined code was read with the original context, but that context needs to run at the current period. This resulted in denotation out of date errors in bringForward. Another problem with this design was space leaks: An context might survive multiple runs as part of an ImplicitInfo of an unpickled method. The new design avoids both problems. Implicit contexts are always up to date and leaks are avoided.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index b148cced5..1b8434129 100644
--- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -489,8 +489,11 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle
forkAt(templateStart).indexTemplateParams()(localContext(sym))
}
else if (annots.exists(_.symbol == defn.InlineAnnot)) {
- val inlineCtx = localContext(sym).addMode(Mode.ReadPositions)
- Inliner.registerInlineInfo(sym, implicit ctx => forkAt(rhsStart).readTerm())(inlineCtx)
+ Inliner.registerInlineInfo(
+ sym,
+ implicit ctx => forkAt(rhsStart).readTerm(),
+ implicit ctx => localContext(sym).addMode(Mode.ReadPositions))
+ // Previous line avoids space leaks because it does not capture the current context.
}
goto(start)
sym