From e9fecd393a3c355a68207da4bb1fa9fcf47eafc9 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 18 Feb 2017 12:54:36 +0100 Subject: Fix #1990: Handle case where inlining changes class of outer The new situation in the test was that outer of the inlined method was `A` but it's as seen from type is a subtype `B`. We need two fixes: - Ignore outerSelects in TreeChecker. These are treated as having fixed symbols. - Adapt the outer-path logic to deal with code that's moved to another context. --- compiler/src/dotty/tools/dotc/transform/TreeChecker.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'compiler/src/dotty/tools/dotc/transform/TreeChecker.scala') diff --git a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala index b2b99160b..7a4af647f 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -12,6 +12,7 @@ import core.Types._ import core.Flags._ import core.Constants._ import core.StdNames._ +import core.NameOps._ import core.Decorators._ import core.TypeErasure.isErasedType import core.Phases.Phase @@ -336,7 +337,10 @@ class TreeChecker extends Phase with SymTransformer { assert(tree.isTerm || !ctx.isAfterTyper, tree.show + " at " + ctx.phase) val tpe = tree.typeOpt val sym = tree.symbol - if (!tpe.isInstanceOf[WithFixedSym] && sym.exists && !sym.is(Private)) { + if (!tpe.isInstanceOf[WithFixedSym] && + sym.exists && !sym.is(Private) && + !tree.name.isOuterSelect // outer selects have effectively fixed symbols + ) { val qualTpe = tree.qualifier.typeOpt val member = if (sym.is(Private)) qualTpe.member(tree.name) -- cgit v1.2.3