Skip to content

Commit 1d6ce2e

Browse files
committed
Make java.lang.Enum a Permanent symbol
This avoids extensive special casing in Denotations#updateValidity
1 parent 1d95f83 commit 1d6ce2e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ class Definitions {
628628
}
629629
constr.info = newInfo
630630
constr.termRef.recomputeDenot()
631-
cls.setFlag(NoInits)
631+
cls.setFlag(NoInits | Permanent)
632632
cls
633633
}
634634
def JavaEnumType = JavaEnumClass.typeRef

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,8 @@ object Denotations {
816816
private def updateValidity()(implicit ctx: Context): this.type = {
817817
assert(
818818
ctx.runId >= validFor.runId ||
819-
ctx.settings.YtestPickler.value || // mixing test pickler with debug printing can travel back in time
820-
symbol.isContainedIn(defn.JavaEnumClass) || // the java.lang.Enum constructor highjacking leads to backwards time travel...
821-
symbol.is(Package), // ... which also means packages can travel backwards in time.
822-
819+
ctx.settings.YtestPickler.value || // mixing test pickler with debug printing can travel back in time
820+
symbol.is(Permanent), // Permanent symbols are valid in all runIds
823821
s"denotation $this invalid in run ${ctx.runId}. ValidFor: $validFor")
824822
var d: SingleDenotation = this
825823
do {

0 commit comments

Comments
 (0)