diff options
author | Martin Odersky <odersky@gmail.com> | 2016-12-16 09:36:06 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-16 09:36:17 +0100 |
commit | e4fd920fdc8e65738111837273a53548bcbb24b9 (patch) | |
tree | 78c400112e413c51a394321fb30582e764169832 /compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala | |
parent | 5d782d316e1c13f92f628bb5a6f1f76d6ea9f8e7 (diff) | |
download | dotty-e4fd920fdc8e65738111837273a53548bcbb24b9.tar.gz dotty-e4fd920fdc8e65738111837273a53548bcbb24b9.tar.bz2 dotty-e4fd920fdc8e65738111837273a53548bcbb24b9.zip |
Fix #1806: Define outer accessors at the right phase
Some outer accessors were defined at phase explicitOuter,
but were entered into the scope of their enclosing class only
at phase explicitOuter + 1. This turned them to stale symbols
when trying to access them at a later run, because at their
initially valid phase they were not found as members of
their owner.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index a32e1c921..4c5186712 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -147,7 +147,8 @@ object ExplicitOuter { private def newOuterSym(owner: ClassSymbol, cls: ClassSymbol, name: TermName, flags: FlagSet)(implicit ctx: Context) = { val target = cls.owner.enclosingClass.typeRef val info = if (flags.is(Method)) ExprType(target) else target - ctx.newSymbol(owner, name, Synthetic | flags, info, coord = cls.coord) + ctx.withPhaseNoEarlier(ctx.explicitOuterPhase.next) // outer accessors are entered at explicitOuter + 1, should not be defined before. + .newSymbol(owner, name, Synthetic | flags, info, coord = cls.coord) } /** A new param accessor for the outer field in class `cls` */ |