@@ -168,6 +168,9 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
168
168
/** A mapping from method types to the parameters used in constructing them */
169
169
private val paramsOfMethodType = new java.util.IdentityHashMap [MethodType , List [Symbol ]]
170
170
171
+ /** Set of var param accessors that need to become case accessors */
172
+ private val paramAccessorNeedsCaseAccessor = mutable.Set .empty[Name ]
173
+
171
174
protected def errorBadSignature (msg : String , original : Option [RuntimeException ] = None )(using Context ): Nothing = {
172
175
val ex = new BadSignature (
173
176
i """ error reading Scala signature of $classRoot from $source:
@@ -462,6 +465,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
462
465
flags &~= Method | Accessor
463
466
if ! flags.is(StableRealizable ) then flags |= Mutable
464
467
468
+ // Skip case accessor `<xyz>$access$<idx>` and keep track of their name to make `<xyz>` the case accessor
469
+ if flags.is(CaseAccessor ) && name.toString().contains(" $access$" ) then
470
+ val accessorName = name.toString().split('$' ).head
471
+ paramAccessorNeedsCaseAccessor += accessorName.toTermName
472
+ return NoSymbol // skip this member
473
+
465
474
name = name.adjustIfModuleClass(flags)
466
475
if (flags.is(Method ))
467
476
name =
@@ -632,6 +641,11 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
632
641
// This is the `def` of an accessor that needs to be transformed into
633
642
// a `val`/`var`. Note that the `Method | Accessor` flags were already
634
643
// striped away in `readDisambiguatedSymbol`.
644
+ //
645
+ // If there was a `<xyz>$access$<idx>` case accessor, we also need to
646
+ // make this accessor a case accessor.
647
+ if paramAccessorNeedsCaseAccessor(denot.name) then
648
+ denot.setFlag(CaseAccessor )
635
649
resultType
636
650
case tp1 => tp1
637
651
denot.info =
0 commit comments