@@ -48,26 +48,19 @@ object Recheck:
4848
4949 extension (sym : Symbol )
5050
51- /** Update symbol's info to newInfo from prevPhase.next to lastPhase .
51+ /** Update symbol's info to newInfo after ` prevPhase` .
5252 * Also update owner to newOwnerOrNull if it is not null.
53- * Reset to previous info and owner for phases after lastPhase.
53+ * The update is valid until after Recheck. After that the symbol's denotation
54+ * is reset to what it was before PreRecheck.
5455 */
55- def updateInfoBetween (prevPhase : DenotTransformer , lastPhase : DenotTransformer , newInfo : Type , newOwnerOrNull : Symbol | Null = null )(using Context ): Unit =
56+ def updateInfo (prevPhase : DenotTransformer , newInfo : Type , newOwnerOrNull : Symbol | Null = null )(using Context ): Unit =
5657 val newOwner = if newOwnerOrNull == null then sym.owner else newOwnerOrNull
5758 if (sym.info ne newInfo) || (sym.owner ne newOwner) then
5859 val flags = sym.flags
59- sym.copySymDenotation(
60- initFlags =
61- if flags.isAllOf(ResetPrivateParamAccessor )
62- then flags &~ ResetPrivate | Private
63- else flags
64- ).installAfter(lastPhase) // reset
6560 sym.copySymDenotation(
6661 owner = newOwner,
6762 info = newInfo,
68- initFlags =
69- if newInfo.isInstanceOf [LazyType ] then flags &~ Touched
70- else flags
63+ initFlags = if newInfo.isInstanceOf [LazyType ] then flags &~ Touched else flags
7164 ).installAfter(prevPhase)
7265
7366 /** Does symbol have a new denotation valid from phase.next that is different
@@ -158,16 +151,20 @@ abstract class Recheck extends Phase, SymTransformer:
158151 // One failing test is pos/i583a.scala
159152
160153 /** Change any `ResetPrivate` flags back to `Private` */
161- def transformSym (sym : SymDenotation )(using Context ): SymDenotation =
162- if sym.isAllOf( Recheck . ResetPrivateParamAccessor ) then
163- sym.copySymDenotation(initFlags = sym.flags &~ Recheck . ResetPrivate | Private )
164- else sym
154+ def transformSym (symd : SymDenotation )(using Context ): SymDenotation =
155+ val sym = symd.symbol
156+ if sym.isUpdatedAfter(preRecheckPhase) then atPhase(preRecheckPhase)( sym.denot )
157+ else symd
165158
166159 def run (using Context ): Unit =
167160 val rechecker = newRechecker()
168161 rechecker.checkUnit(ctx.compilationUnit)
169162 rechecker.reset()
170163
164+ override def runOn (units : List [CompilationUnit ])(using runCtx : Context ): List [CompilationUnit ] =
165+ try super .runOn(units)
166+ finally preRecheckPhase.pastRecheck = true
167+
171168 def newRechecker ()(using Context ): Rechecker
172169
173170 /** The typechecker pass */
@@ -197,6 +194,7 @@ abstract class Recheck extends Phase, SymTransformer:
197194 def reset ()(using Context ): Unit =
198195 for (ref, mbr) <- prevSelDenots.iterator do
199196 ref.withDenot(mbr)
197+ preRecheckPhase
200198
201199 /** Constant-folded rechecked type `tp` of tree `tree` */
202200 protected def constFold (tree : Tree , tp : Type )(using Context ): Type =
0 commit comments