Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1aefbb9

Browse files
committedFeb 10, 2025··
chore: explicitely open scala 2 classes when unpickling
1 parent 78c7473 commit 1aefbb9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
 

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ object Flags {
556556
val AbstractOverride: FlagSet = Abstract | Override
557557
val AbstractSealed: FlagSet = Abstract | Sealed
558558
val AbstractOrTrait: FlagSet = Abstract | Trait
559-
val EffectivelyOpenFlags = Abstract | JavaDefined | Open | Scala2x | Trait
559+
val EffectivelyOpenFlags = Abstract | JavaDefined | Open | Trait
560560
val AccessorOrDeferred: FlagSet = Accessor | Deferred
561561
val PrivateAccessor: FlagSet = Accessor | Private
562562
val AccessorOrSynthetic: FlagSet = Accessor | Synthetic

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,15 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
510510
}
511511

512512
def finishSym(sym: Symbol): Symbol = {
513-
if (sym.isClass)
513+
if sym.isClass then
514514
sym.setFlag(Scala2x)
515+
if !sym.isEffectivelySealed then
516+
// We used to assume that `Scala2x` was part of the
517+
// Flags.EffectivelyOpenFlags. We dropped this flag from that
518+
// FlagSet and now explicitely open all Scala 2 classes which
519+
// are not effectively sealed
520+
sym.setFlag(Open)
521+
515522
if (!(isRefinementClass(sym) || isUnpickleRoot(sym) || sym.is(Scala2Existential))) {
516523
val owner = sym.owner
517524
val canEnter =

0 commit comments

Comments
 (0)
Please sign in to comment.