@@ -48,26 +48,19 @@ object Recheck:
48
48
49
49
extension (sym : Symbol )
50
50
51
- /** Update symbol's info to newInfo from prevPhase.next to lastPhase .
51
+ /** Update symbol's info to newInfo after ` prevPhase` .
52
52
* 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.
54
55
*/
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 =
56
57
val newOwner = if newOwnerOrNull == null then sym.owner else newOwnerOrNull
57
58
if (sym.info ne newInfo) || (sym.owner ne newOwner) then
58
59
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
65
60
sym.copySymDenotation(
66
61
owner = newOwner,
67
62
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
71
64
).installAfter(prevPhase)
72
65
73
66
/** Does symbol have a new denotation valid from phase.next that is different
@@ -158,16 +151,20 @@ abstract class Recheck extends Phase, SymTransformer:
158
151
// One failing test is pos/i583a.scala
159
152
160
153
/** 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
165
158
166
159
def run (using Context ): Unit =
167
160
val rechecker = newRechecker()
168
161
rechecker.checkUnit(ctx.compilationUnit)
169
162
rechecker.reset()
170
163
164
+ override def runOn (units : List [CompilationUnit ])(using runCtx : Context ): List [CompilationUnit ] =
165
+ try super .runOn(units)
166
+ finally preRecheckPhase.pastRecheck = true
167
+
171
168
def newRechecker ()(using Context ): Rechecker
172
169
173
170
/** The typechecker pass */
@@ -197,6 +194,7 @@ abstract class Recheck extends Phase, SymTransformer:
197
194
def reset ()(using Context ): Unit =
198
195
for (ref, mbr) <- prevSelDenots.iterator do
199
196
ref.withDenot(mbr)
197
+ preRecheckPhase
200
198
201
199
/** Constant-folded rechecked type `tp` of tree `tree` */
202
200
protected def constFold (tree : Tree , tp : Type )(using Context ): Type =
0 commit comments