diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 10af44c76169..6623092c6585 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -528,10 +528,14 @@ class TreePickler(pickler: TastyPickler) { } } case Bind(name, body) => - registerDef(tree.symbol) + val sym = tree.symbol + registerDef(sym) writeByte(BIND) withLength { - pickleName(name); pickleType(tree.symbol.info); pickleTree(body) + pickleName(name) + pickleType(sym.info) + pickleTree(body) + pickleFlags(sym.flags &~ Case, sym.isTerm) } case Alternative(alts) => writeByte(ALTERNATIVE) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index d2b9b607a391..a14d08708230 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -1200,7 +1200,10 @@ class TreeUnpickler(reader: TastyReader, val sym = symAtAddr.getOrElse(start, forkAt(start).createSymbol()) readName() readType() - Bind(sym, readTerm()) + val body = readTerm() + val (givenFlags, _, _) = readModifiers(end) + sym.setFlag(givenFlags) + Bind(sym, body) case ALTERNATIVE => Alternative(until(end)(readTerm())) case UNAPPLY => diff --git a/tasty/src/dotty/tools/tasty/TastyFormat.scala b/tasty/src/dotty/tools/tasty/TastyFormat.scala index f5969169353a..12e17e3b5d3a 100644 --- a/tasty/src/dotty/tools/tasty/TastyFormat.scala +++ b/tasty/src/dotty/tools/tasty/TastyFormat.scala @@ -165,7 +165,7 @@ Standard-Section: "ASTs" TopLevelStat* ORtype Length left_Type right_Type -- lefgt | right MATCHtype Length bound_Type sel_Type case_Type* -- sel match {cases} with optional upper `bound` MATCHCASEtype Length pat_type rhs_Type -- match cases are MATCHCASEtypes or TYPELAMBDAtypes over MATCHCASEtypes - BIND Length boundName_NameRef bounds_Type -- boundName @ bounds, for type-variables defined in a type pattern + BIND Length boundName_NameRef bounds_Type Modifier* -- boundName @ bounds, for type-variables defined in a type pattern BYNAMEtype underlying_Type -- => underlying PARAMtype Length binder_ASTRef paramNum_Nat -- A reference to parameter # paramNum in lambda type `binder` POLYtype Length result_Type TypesNames -- A polymorphic method type `[TypesNames]result`, used in refinements