diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-19 15:35:38 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-19 15:35:38 +0200 |
commit | bbc584f0ac3586ce4e4a92e58f74ad69a15f0ed5 (patch) | |
tree | b02ec85a4290b94a1d92fd728af83f2e71357950 /src/dotty/tools/dotc/transform/ExplicitOuter.scala | |
parent | 1b31f068a1a01619ba2ee2635d5f3c90162bf1d1 (diff) | |
download | dotty-bbc584f0ac3586ce4e4a92e58f74ad69a15f0ed5.tar.gz dotty-bbc584f0ac3586ce4e4a92e58f74ad69a15f0ed5.tar.bz2 dotty-bbc584f0ac3586ce4e4a92e58f74ad69a15f0ed5.zip |
Fix problem with explicit outer accessors
Even if an explicit outer accessor was a method, it got a TermRef as type.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExplicitOuter.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/ExplicitOuter.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 912bc9b7f..eb231bfe7 100644 --- a/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -136,7 +136,9 @@ object ExplicitOuter { /** A new outer accessor or param accessor */ private def newOuterSym(owner: ClassSymbol, cls: ClassSymbol, name: TermName, flags: FlagSet)(implicit ctx: Context) = { - ctx.newSymbol(owner, name, Synthetic | flags, cls.owner.enclosingClass.typeRef, coord = cls.coord) + 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) } /** A new param accessor for the outer field in class `cls` */ @@ -302,7 +304,7 @@ object ExplicitOuter { 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)(outerAccessorCtx)) + else loop(tree.select(outerAccessor(treeCls.asClass)(outerAccessorCtx)).ensureApplied) } ctx.log(i"computing outerpath to $toCls from ${ctx.outersIterator.map(_.owner).toList}") loop(This(ctx.owner.enclosingClass.asClass)) |