Skip to content

Commit 5cadcbe

Browse files
committed
Drop unnecessary generalization in readModifiers
This was used only when we also handled untyped trees during pickling.
1 parent aa1017f commit 5cadcbe

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ class TreeUnpickler(reader: TastyReader,
558558
val rhsStart = currentAddr
559559
val rhsIsEmpty = nothingButMods(end)
560560
if (!rhsIsEmpty) skipTree()
561-
val (givenFlags, annotFns, privateWithin) = readModifiers(end, readTypedAnnot, readTypedWithin, NoSymbol)
561+
val (givenFlags, annotFns, privateWithin) = readModifiers(end)
562562
pickling.println(i"creating symbol $name at $start with flags $givenFlags")
563563
val flags = normalizeFlags(tag, givenFlags, name, isAbsType, rhsIsEmpty)
564564
def adjustIfModule(completer: LazyType) =
@@ -609,12 +609,10 @@ class TreeUnpickler(reader: TastyReader,
609609
/** Read modifier list into triplet of flags, annotations and a privateWithin
610610
* boundary symbol.
611611
*/
612-
def readModifiers[WithinType, AnnotType]
613-
(end: Addr, readAnnot: Context ?=> Symbol => AnnotType, readWithin: Context ?=> WithinType, defaultWithin: WithinType)
614-
(using Context): (FlagSet, List[Symbol => AnnotType], WithinType) = {
612+
def readModifiers(end: Addr)(using Context): (FlagSet, List[Symbol => Annotation], Symbol) = {
615613
var flags: FlagSet = EmptyFlags
616-
var annotFns: List[Symbol => AnnotType] = Nil
617-
var privateWithin = defaultWithin
614+
var annotFns: List[Symbol => Annotation] = Nil
615+
var privateWithin: Symbol = NoSymbol
618616
while (currentAddr.index != end.index) {
619617
def addFlag(flag: FlagSet) = {
620618
flags |= flag
@@ -677,9 +675,9 @@ class TreeUnpickler(reader: TastyReader,
677675
(flags, annotFns.reverse, privateWithin)
678676
}
679677

680-
private val readTypedWithin: Context ?=> Symbol = readType().typeSymbol
678+
private def readWithin(using Context): Symbol = readType().typeSymbol
681679

682-
private val readTypedAnnot: Context ?=> Symbol => Annotation =
680+
private def readAnnot(using Context): Symbol => Annotation =
683681
readByte()
684682
val end = readEnd()
685683
val tp = readType()

0 commit comments

Comments
 (0)