Skip to content

Commit e86e314

Browse files
committed
Get rid of Frozen flag
No longer needed because we have proper cache invalidation now
1 parent ddbf8f7 commit e86e314

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,6 @@ object Denotations {
817817
next match {
818818
case next: ClassDenotation =>
819819
assert(!next.is(Package), s"illegal transformation of package denotation by transformer ${ctx.withPhase(transformer).phase}")
820-
next.resetFlag(Frozen)
821820
case _ =>
822821
}
823822
next.insertAfter(cur)

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,6 @@ object Flags {
375375
/** Denotation is in train of being loaded and completed, used to catch cyclic dependencies */
376376
final val Touched = commonFlag(48, "<touched>")
377377

378-
/** Class is not allowed to accept new members because fingerprint of subclass has been taken */
379-
final val Frozen = commonFlag(49, "<frozen>")
380-
381378
/** An error symbol */
382379
final val Erroneous = commonFlag(50, "<is-error>")
383380

@@ -450,7 +447,7 @@ object Flags {
450447
Module | Package | Deferred | MethodOrHKCommon | Param | ParamAccessor |
451448
Scala2ExistentialCommon | Mutable.toCommonFlags | Touched | JavaStatic |
452449
CovariantOrOuter | ContravariantOrLabel | CaseAccessorOrBaseTypeArg |
453-
Fresh | Frozen | Erroneous | ImplicitCommon | Permanent | Synthetic |
450+
Fresh | Erroneous | ImplicitCommon | Permanent | Synthetic |
454451
SuperAccessorOrScala2x | Inline
455452

456453
/** Flags guaranteed to be set upon symbol creation, or, if symbol is a top-level

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ object SymDenotations {
11681168
privateWithin: Symbol = null,
11691169
annotations: List[Annotation] = null)(implicit ctx: Context) =
11701170
{ // simulate default parameters, while also passing implicit context ctx to the default values
1171-
val initFlags1 = (if (initFlags != UndefinedFlags) initFlags else this.flags) &~ Frozen
1171+
val initFlags1 = (if (initFlags != UndefinedFlags) initFlags else this.flags)
11721172
val info1 = if (info != null) info else this.info
11731173
if (ctx.isAfterTyper && changedClassParents(info, info1, completersMatter = false))
11741174
assert(ctx.phase.changesParents, i"undeclared parent change at ${ctx.phase} for $this, was: $info, now: $info1")
@@ -1483,17 +1483,7 @@ object SymDenotations {
14831483

14841484
/** Enter a symbol in given `scope` without potentially replacing the old copy. */
14851485
def enterNoReplace(sym: Symbol, scope: MutableScope)(implicit ctx: Context): Unit = {
1486-
def isUsecase = ctx.docCtx.isDefined && sym.name.show.takeRight(4) == "$doc"
1487-
require(
1488-
(sym.denot.flagsUNSAFE is Private) ||
1489-
!(this is Frozen) ||
1490-
(scope ne this.unforcedDecls) ||
1491-
sym.hasAnnotation(defn.ScalaStaticAnnot) ||
1492-
sym.name.is(InlineAccessorName) ||
1493-
isUsecase, i"trying to enter $sym in $this, frozen = ${this is Frozen}")
1494-
14951486
scope.enter(sym)
1496-
14971487
if (myMemberCache != null) myMemberCache.invalidate(sym.name)
14981488
if (!sym.flagsUNSAFE.is(Private)) invalidateMemberNamesCache()
14991489
}
@@ -1503,7 +1493,6 @@ object SymDenotations {
15031493
* @pre `prev` and `replacement` have the same name.
15041494
*/
15051495
def replace(prev: Symbol, replacement: Symbol)(implicit ctx: Context): Unit = {
1506-
require(!(this is Frozen))
15071496
unforcedDecls.openForMutations.replace(prev, replacement)
15081497
if (myMemberCache != null) myMemberCache.invalidate(replacement.name)
15091498
}
@@ -1513,7 +1502,6 @@ object SymDenotations {
15131502
* someone does a findMember on a subclass.
15141503
*/
15151504
def delete(sym: Symbol)(implicit ctx: Context) = {
1516-
require(!(this is Frozen))
15171505
info.decls.openForMutations.unlink(sym)
15181506
if (myMemberCache != null) myMemberCache.invalidate(sym.name)
15191507
if (!sym.flagsUNSAFE.is(Private)) invalidateMemberNamesCache()

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

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

0 commit comments

Comments
 (0)