Skip to content

Commit 55715f1

Browse files
committed
Replace some idents by selects in LambdaLift
If a symbol becomes a class field, references to it need to be selections, or else we get a "bad type" assertion violation in TreeChecker.
1 parent 02afa11 commit 55715f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/dotty/tools/dotc/transform/LambdaLift.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,11 @@ class LambdaLift extends MiniPhaseTransform with IdentityDenotTransformer { this
366366
override def transformIdent(tree: Ident)(implicit ctx: Context, info: TransformerInfo) = {
367367
val sym = tree.symbol
368368
tree.tpe match {
369-
case TermRef(NoPrefix, _) if sym.enclosure != currentEnclosure && !sym.isStatic =>
370-
(if (sym is Method) memberRef(sym) else proxyRef(sym)).withPos(tree.pos)
369+
case tpe @ TermRef(prefix, _) =>
370+
if ((prefix eq NoPrefix) && sym.enclosure != currentEnclosure && !sym.isStatic)
371+
(if (sym is Method) memberRef(sym) else proxyRef(sym)).withPos(tree.pos)
372+
else if (!prefixIsElidable(tpe)) ref(tpe)
373+
else tree
371374
case _ =>
372375
tree
373376
}

0 commit comments

Comments
 (0)