@@ -2,6 +2,7 @@ package dotty.tools.dotc
2
2
package transform
3
3
4
4
import MegaPhase ._
5
+ import core .Denotations .NonSymSingleDenotation
5
6
import core .DenotTransformers ._
6
7
import core .Symbols ._
7
8
import core .Contexts ._
@@ -530,7 +531,14 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisPhase =>
530
531
override def prepareForUnit (tree : Tree )(using Context ): Context =
531
532
ctx.fresh.updateStore(Lifter , new Lifter (thisPhase))
532
533
534
+ private def reloadDenotation (tp : Type )(using Context ): Unit = tp match
535
+ case tp : NamedType =>
536
+ if tp.denot.isInstanceOf [NonSymSingleDenotation ] && lifter.free.contains(tp.symbol) then
537
+ tp.recomputeDenot()
538
+ case _ =>
539
+
533
540
override def transformIdent (tree : Ident )(using Context ): Tree = {
541
+ reloadDenotation(tree.tpe)
534
542
val sym = tree.symbol
535
543
tree.tpe match {
536
544
case tpe @ TermRef (prefix, _) =>
@@ -549,6 +557,16 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisPhase =>
549
557
}
550
558
}
551
559
560
+ override def transformSelect (tree : Select )(using Context ): Tree =
561
+ val denot = tree.denot
562
+ val sym = tree.symbol
563
+ // The Lifter updates the type of symbols using `installAfter` to give them a
564
+ // new `SymDenotation`, but that doesn't affect non-sym denotations, so we
565
+ // reload them manually here.
566
+ if ! denot.isInstanceOf [core.SymDenotations .SymDenotation ] && lifter.free.contains(sym) then
567
+ tree.qualifier.select(sym).withSpan(tree.span)
568
+ else tree
569
+
552
570
override def transformApply (tree : Apply )(using Context ): Apply =
553
571
cpy.Apply (tree)(tree.fun, lifter.addFreeArgs(tree.symbol, tree.args)).withSpan(tree.span)
554
572
0 commit comments