Skip to content

Commit 9803bba

Browse files
committed
Fix tpd.ref(sum) to work after erasure.
Erasure finishes work done by Explicit outer, and registers a post condition that This(outer) is not allowed.
1 parent e512210 commit 9803bba

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dotty.tools
22
package dotc
33
package ast
44

5+
import dotty.tools.dotc.transform.ExplicitOuter
56
import dotty.tools.dotc.typer.ProtoTypes.FunProtoTyped
67
import transform.SymUtils._
78
import core._
@@ -299,7 +300,16 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
299300
if (tp.isType) TypeTree(tp)
300301
else if (prefixIsElidable(tp)) Ident(tp)
301302
else tp.prefix match {
302-
case pre: SingletonType => singleton(pre).select(tp)
303+
case pre: SingletonType =>
304+
val prefix =
305+
singleton(pre) match {
306+
case t: This if ctx.erasedTypes && !(t.symbol == ctx.owner.enclosingClass || t.symbol.isStaticOwner) =>
307+
// after erasure outer paths should be respected
308+
new ExplicitOuter.OuterOps(ctx).path(t.tpe.widen.classSymbol)
309+
case t =>
310+
t
311+
}
312+
prefix.select(tp)
303313
case pre => SelectFromTypeTree(TypeTree(pre), tp)
304314
} // no checks necessary
305315

0 commit comments

Comments
 (0)