diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/PatternMatchers.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala index c2c315d0f6..85075d19ff 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala @@ -1185,12 +1185,14 @@ trait PatternMatchers requires (transform.ExplicitOuter with PatternNodes) { } theRef = handleOuter(theRef) - val outername = casted.tpe.symbol.expandedName(nme.OUTER) + val outerAcc = outerAccessor(casted.tpe.symbol) - if(node.getTpe().decls.lookup(outername) != NoSymbol) { // some guys don't have outers + //val outername = casted.tpe.symbol.expandedName(nme.OUTER) + + if(outerAcc != NoSymbol) { // some guys don't have outers cond = And(cond, Eq(Apply(Select( - gen.mkAsInstanceOf(selector.duplicate, node.getTpe(), true), outername),List()), theRef)) + gen.mkAsInstanceOf(selector.duplicate, node.getTpe(), true), outerAcc),List()), theRef)) } case _ => //ignore ; diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 3412d04b2c..0caa0f6522 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -44,7 +44,7 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter result } - private def outerAccessor(clazz: Symbol): Symbol = { + def outerAccessor(clazz: Symbol): Symbol = { val firstTry = clazz.info.decl(clazz.expandedName(nme.OUTER)) if (firstTry != NoSymbol && firstTry.outerSource == clazz) firstTry else { |