aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-12-10 14:47:25 +0100
committerGitHub <noreply@github.com>2016-12-10 14:47:25 +0100
commitb8e3126a3f19efe45e0eaa4cbfc651ce9fdce99a (patch)
treebc37cec7daf56d5c287dd9eb8548609815d668de /compiler
parent4daf543cf6857295807a8a9d37890891274255a9 (diff)
parent5175f1e145cd02185a02a8fae06bd1b52d2bff85 (diff)
downloaddotty-b8e3126a3f19efe45e0eaa4cbfc651ce9fdce99a.tar.gz
dotty-b8e3126a3f19efe45e0eaa4cbfc651ce9fdce99a.tar.bz2
dotty-b8e3126a3f19efe45e0eaa4cbfc651ce9fdce99a.zip
Merge pull request #1766 from dotty-staging/fix-#1756
Fix #1756: Use lexically enclosing class as start of outer path.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/Erasure.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala2
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/Erasure.scala b/compiler/src/dotty/tools/dotc/transform/Erasure.scala
index d1f5bd532..5c880c7bd 100644
--- a/compiler/src/dotty/tools/dotc/transform/Erasure.scala
+++ b/compiler/src/dotty/tools/dotc/transform/Erasure.scala
@@ -94,7 +94,7 @@ class Erasure extends Phase with DenotTransformer { thisTransformer =>
assertErased(tree)
tree match {
case res: tpd.This =>
- assert(!ExplicitOuter.referencesOuter(ctx.owner.enclosingClass, res),
+ assert(!ExplicitOuter.referencesOuter(ctx.owner.lexicallyEnclosingClass, res),
i"Reference to $res from ${ctx.owner.showLocated}")
case ret: tpd.Return =>
// checked only after erasure, as checking before erasure is complicated
@@ -412,7 +412,7 @@ object Erasure extends TypeTestsCasts{
}
override def typedThis(tree: untpd.This)(implicit ctx: Context): Tree =
- if (tree.symbol == ctx.owner.enclosingClass || tree.symbol.isStaticOwner) promote(tree)
+ if (tree.symbol == ctx.owner.lexicallyEnclosingClass || tree.symbol.isStaticOwner) promote(tree)
else {
ctx.log(i"computing outer path from ${ctx.owner.ownersIterator.toList}%, % to ${tree.symbol}, encl class = ${ctx.owner.enclosingClass}")
outer.path(tree.symbol)
diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
index 3fec47e9f..a32e1c921 100644
--- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
+++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
@@ -330,7 +330,7 @@ object ExplicitOuter {
/** The path of outer accessors that references `toCls.this` starting from
* the context owner's this node.
*/
- def path(toCls: Symbol, start: Tree = This(ctx.owner.enclosingClass.asClass)): Tree = try {
+ def path(toCls: Symbol, start: Tree = This(ctx.owner.lexicallyEnclosingClass.asClass)): Tree = try {
def loop(tree: Tree): Tree = {
val treeCls = tree.tpe.widen.classSymbol
val outerAccessorCtx = ctx.withPhaseNoLater(ctx.lambdaLiftPhase) // lambdalift mangles local class names, which means we cannot reliably find outer acessors anymore