Skip to content

Commit f7c1bb0

Browse files
Rename Touched flag to Completing
"Touched" does not carry any obvious semantic meaning. "Completing" reflects the intent of when the flag should be set.
1 parent aebd4c5 commit f7c1bb0

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ object Flags {
356356
/** Symbol is not a member of its owner */
357357
val (NonMember @ _, _, _) = newFlags(45, "<non-member>")
358358

359-
/** Denotation is in train of being loaded and completed, used to catch cyclic dependencies */
360-
val (Touched @ _, _, _) = newFlags(48, "<touched>")
359+
/** Denotation is in train of being completed, used to catch cyclic dependencies */
360+
val (Completing @ _, _, _) = newFlags(48, "<completing>")
361361

362362
/** Class has been lifted out to package level, local value has been lifted out to class level */
363363
val (Lifted @ _, _, _) = newFlags(51, "<lifted>")
@@ -443,7 +443,7 @@ object Flags {
443443
val FromStartFlags: FlagSet = commonFlags(
444444
Module, Package, Method, Case,
445445
HigherKinded, Param, ParamAccessor,
446-
Scala2ExistentialCommon, Mutable, Touched, JavaStatic,
446+
Scala2ExistentialCommon, Mutable, Completing, JavaStatic,
447447
OuterOrCovariant, LabelOrContravariant, CaseAccessor,
448448
Extension, NonMember, Implicit, Given, Permanent, Synthetic,
449449
SuperAccessorOrScala2x, Inline)

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ object SymDenotations {
163163
private def setMyFlags(flags: FlagSet) =
164164
lazy val immutableFlags = if myInfo.isInstanceOf[SymbolLoader] then AfterLoadFlags else FromStartFlags
165165
lazy val changedImmutableFlags = (myFlags ^ flags) & immutableFlags
166-
if myFlags.is(Touched, butNot = Loading) then assert(changedImmutableFlags.isEmpty,
166+
if myFlags.is(Completing, butNot = Loading) then assert(changedImmutableFlags.isEmpty,
167167
s"Illegal mutation of flags ${changedImmutableFlags.flagsString} on completion of $this")
168168
myFlags = flags
169169

@@ -259,8 +259,8 @@ object SymDenotations {
259259
println(i"${" " * indent}completing ${if (isType) "type" else "val"} $name")
260260
indent += 1
261261

262-
if (myFlags.is(Touched)) throw CyclicReference(this)
263-
myFlags |= Touched
262+
if (myFlags.is(Completing)) throw CyclicReference(this)
263+
myFlags |= Completing
264264

265265
// completions.println(s"completing ${this.debugString}")
266266
try completer.complete(this)(ctx.withPhase(validFor.firstPhaseId))
@@ -275,11 +275,11 @@ object SymDenotations {
275275
}
276276
}
277277
else {
278-
if (myFlags.is(Touched)) throw CyclicReference(this)
279-
myFlags |= Touched
278+
if (myFlags.is(Completing)) throw CyclicReference(this)
279+
myFlags |= Completing
280280
completer.complete(this)(ctx.withPhase(validFor.firstPhaseId))
281281
}
282-
myFlags &~= Touched
282+
myFlags &~= Completing
283283

284284
protected[dotc] def info_=(tp: Type): Unit = {
285285
/* // DEBUG
@@ -398,7 +398,7 @@ object SymDenotations {
398398
final def isCompleted: Boolean = !myInfo.isInstanceOf[LazyType]
399399

400400
/** The denotation is in train of being completed */
401-
final def isCompleting: Boolean = myFlags.is(Touched) && !isCompleted
401+
final def isCompleting: Boolean = myFlags.is(Completing) && !isCompleted
402402

403403
/** The completer of this denotation. @pre: Denotation is not yet completed */
404404
final def completer: LazyType = myInfo.asInstanceOf[LazyType]
@@ -2245,7 +2245,7 @@ object SymDenotations {
22452245

22462246
/** The type parameters computed by the completer before completion has finished */
22472247
def completerTypeParams(sym: Symbol)(implicit ctx: Context): List[TypeParamInfo] =
2248-
if (sym.is(Touched)) Nil // return `Nil` instead of throwing a cyclic reference
2248+
if (sym.is(Completing)) Nil // return `Nil` instead of throwing a cyclic reference
22492249
else sym.info.typeParams
22502250

22512251
def decls: Scope = myDecls

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ trait Symbols { this: Context =>
345345
copy.denot = odenot.copySymDenotation(
346346
symbol = copy,
347347
owner = ttmap1.mapOwner(odenot.owner),
348-
initFlags = odenot.flags &~ Touched,
348+
initFlags = odenot.flags &~ Completing,
349349
info = completer,
350350
privateWithin = ttmap1.mapOwner(odenot.privateWithin), // since this refers to outer symbols, need not include copies (from->to) in ownermap here.
351351
annotations = odenot.annotations)

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ class TreeUnpickler(reader: TastyReader,
546546
rootd.symbol.coord = coord
547547
rootd.info = adjustIfModule(
548548
new Completer(subReader(start, end)) with SymbolLoaders.SecondCompleter)
549-
rootd.flags = flags &~ Touched // allow one more completion
549+
rootd.flags = flags &~ Completing // allow one more completion
550550
rootd.setPrivateWithin(privateWithin)
551551
seenRoots += rootd.symbol
552552
rootd.finishedLoading()

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
486486

487487
def completeRoot(denot: ClassDenotation, completer: LazyType, privateWithin: Symbol): Symbol = {
488488
denot.setFlag(flags)
489-
denot.resetFlag(Touched) // allow one more completion
489+
denot.resetFlag(Completing) // allow one more completion
490490

491491
// Temporary measure, as long as we do not read these classes from Tasty.
492492
// Scala-2 classes don't have NoInits set even if they are pure. We override this

compiler/src/dotty/tools/dotc/transform/LazyVals.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer {
179179
// need to bring containers to start of method
180180
val (holders, stats) =
181181
trees.partition {
182-
_.symbol.flags.&~(Touched) == containerFlags
183-
// Filtering out Touched is not required currently, as there are no LazyTypes involved here
182+
_.symbol.flags.&~(Completing) == containerFlags
183+
// Filtering out Completing is not required currently, as there are no LazyTypes involved here
184184
// but just to be more safe
185185
}
186186
holders:::stats

0 commit comments

Comments
 (0)