Skip to content

Commit 5fa55b1

Browse files
Merge pull request #11595 from dotty-staging/fix-#11594
Add missing flags from case bindings in TASTy
2 parents 601cc5b + 6b19365 commit 5fa55b1

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,14 @@ class TreePickler(pickler: TastyPickler) {
528528
}
529529
}
530530
case Bind(name, body) =>
531-
registerDef(tree.symbol)
531+
val sym = tree.symbol
532+
registerDef(sym)
532533
writeByte(BIND)
533534
withLength {
534-
pickleName(name); pickleType(tree.symbol.info); pickleTree(body)
535+
pickleName(name)
536+
pickleType(sym.info)
537+
pickleTree(body)
538+
pickleFlags(sym.flags &~ Case, sym.isTerm)
535539
}
536540
case Alternative(alts) =>
537541
writeByte(ALTERNATIVE)

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,10 @@ class TreeUnpickler(reader: TastyReader,
12001200
val sym = symAtAddr.getOrElse(start, forkAt(start).createSymbol())
12011201
readName()
12021202
readType()
1203-
Bind(sym, readTerm())
1203+
val body = readTerm()
1204+
val (givenFlags, _, _) = readModifiers(end)
1205+
sym.setFlag(givenFlags)
1206+
Bind(sym, body)
12041207
case ALTERNATIVE =>
12051208
Alternative(until(end)(readTerm()))
12061209
case UNAPPLY =>

tasty/src/dotty/tools/tasty/TastyFormat.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Standard-Section: "ASTs" TopLevelStat*
165165
ORtype Length left_Type right_Type -- lefgt | right
166166
MATCHtype Length bound_Type sel_Type case_Type* -- sel match {cases} with optional upper `bound`
167167
MATCHCASEtype Length pat_type rhs_Type -- match cases are MATCHCASEtypes or TYPELAMBDAtypes over MATCHCASEtypes
168-
BIND Length boundName_NameRef bounds_Type -- boundName @ bounds, for type-variables defined in a type pattern
168+
BIND Length boundName_NameRef bounds_Type Modifier* -- boundName @ bounds, for type-variables defined in a type pattern
169169
BYNAMEtype underlying_Type -- => underlying
170170
PARAMtype Length binder_ASTRef paramNum_Nat -- A reference to parameter # paramNum in lambda type `binder`
171171
POLYtype Length result_Type TypesNames -- A polymorphic method type `[TypesNames]result`, used in refinements

0 commit comments

Comments
 (0)