aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/ExplicitOuter.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-03 17:59:16 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-03 18:10:45 +0200
commit6c8a2425148753d040ab2dbde6ac57349893b736 (patch)
tree55c1df0e45cab59dd4c373091e09fb51d6d7c398 /src/dotty/tools/dotc/transform/ExplicitOuter.scala
parent5cb4ecb19cb551609ebee97aa1b199de8468a98a (diff)
downloaddotty-6c8a2425148753d040ab2dbde6ac57349893b736.tar.gz
dotty-6c8a2425148753d040ab2dbde6ac57349893b736.tar.bz2
dotty-6c8a2425148753d040ab2dbde6ac57349893b736.zip
Compute outer.path in lambdaLift at correct phase.
LambdaLift needs to compute outer.path at the phase in which the results are constructed, i.e. phase lambdaLift.next. Or else we get an error in outer.path for lost fo files, including pos/Fileish.scala as a minimized test case. Previously outer as computed at phase lambdaLift. The reason for this is that lambdaLift name mangles inner classes, which causes outer acessors to be not found. We now correct for the problem in outer.path itself, by calling outerAccessor only at a safe phase.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExplicitOuter.scala')
-rw-r--r--src/dotty/tools/dotc/transform/ExplicitOuter.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/src/dotty/tools/dotc/transform/ExplicitOuter.scala
index 70a4f299a..0fa429d6e 100644
--- a/src/dotty/tools/dotc/transform/ExplicitOuter.scala
+++ b/src/dotty/tools/dotc/transform/ExplicitOuter.scala
@@ -299,9 +299,10 @@ object ExplicitOuter {
def path(toCls: Symbol): Tree = try {
def loop(tree: Tree): Tree = {
val treeCls = tree.tpe.widen.classSymbol
- ctx.log(i"outer to $toCls of $tree: ${tree.tpe}, looking for ${outerAccName(treeCls.asClass)}")
+ val outerAccessorCtx = ctx.withPhaseNoLater(ctx.lambdaLiftPhase) // lambdalift mangles local class names, which means we cannot reliably find outer acessors anymore
+ ctx.log(i"outer to $toCls of $tree: ${tree.tpe}, looking for ${outerAccName(treeCls.asClass)(outerAccessorCtx)} in $treeCls")
if (treeCls == toCls) tree
- else loop(tree select outerAccessor(treeCls.asClass))
+ else loop(tree select outerAccessor(treeCls.asClass)(outerAccessorCtx))
}
ctx.log(i"computing outerpath to $toCls from ${ctx.outersIterator.map(_.owner).toList}")
loop(This(ctx.owner.enclosingClass.asClass))