diff options
author | odersky <odersky@gmail.com> | 2017-01-05 17:59:06 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-05 17:59:06 +0700 |
commit | 42eb864dc752254fc3b8b0428570fe94aa1dafc7 (patch) | |
tree | f625d3950b1804a0ce10b0f00627e97e58070ffa | |
parent | 2498cf9c18b5778df24ee944008ea72ff0fcab2c (diff) | |
parent | a7e88df553be9dd2593dbb8581630ae815eedfb1 (diff) | |
download | dotty-42eb864dc752254fc3b8b0428570fe94aa1dafc7.tar.gz dotty-42eb864dc752254fc3b8b0428570fe94aa1dafc7.tar.bz2 dotty-42eb864dc752254fc3b8b0428570fe94aa1dafc7.zip |
Merge pull request #1873 from dotty-staging/fix-#1865
Fix #1865: Compute outer path at right phase
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala | 3 | ||||
-rw-r--r-- | tests/pos/i1865.scala | 24 |
2 files changed, 26 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 1eb12e9de..c2aacf826 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -276,7 +276,8 @@ object ExplicitOuter { if (tpe.prefix eq NoPrefix) cls.owner.enclosingClass.thisType else tpe.prefix case _ => - outerPrefix(tpe.underlying) + // Need to be careful to dealias before erasure, otherwise we lose prefixes. + outerPrefix(tpe.underlying(ctx.withPhaseNoLater(ctx.erasurePhase))) } case tpe: TypeProxy => outerPrefix(tpe.underlying) diff --git a/tests/pos/i1865.scala b/tests/pos/i1865.scala new file mode 100644 index 000000000..1b77558ff --- /dev/null +++ b/tests/pos/i1865.scala @@ -0,0 +1,24 @@ +class AbsCell { + type T = Node + class Node +} + +object Test { + def test: Unit = { + val cell = new AbsCell + new cell.T + } +} + +class AbsCell2 { + type T = Node + val value: T = value + def set(x: T): Unit = {} + class Node +} +object init { + def main = { + val cell = new AbsCell2 { val init = new Node } + cell set (new cell.T) + } +} |