Skip to content

Commit 7dcf0ed

Browse files
committed
Tweaks to pickling and unpickling untyped trees
- need to maintain Type mode bit for correct desugaring - need to pickle PatDefs directly since desugaring requires too much context.
1 parent d30a8aa commit 7dcf0ed

File tree

3 files changed

+226
-202
lines changed

3 files changed

+226
-202
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,20 @@ Standard-Section: "ASTs" TopLevelStat*
5555
Stat
5656
5757
Stat = Term
58-
VALDEF Length NameRef type_Term rhs_Term? Mods
58+
VALDEF Length NameRef type_Term rhs_Term? Modifier*
5959
DEFDEF Length NameRef TypeParam* Params* returnType_Term rhs_Term?
60-
Mods
61-
TYPEDEF Length NameRef (type_Term | Template) Mods
62-
OBJECTDEF Length NameRef Template Mods
60+
Modifier*
61+
TYPEDEF Length NameRef (type_Term | Template) Modifier*
62+
OBJECTDEF Length NameRef Template Modifier*
6363
IMPORT Length qual_Term Selector*
6464
Selector = IMPORTED name_NameRef
6565
RENAMED to_NameRef
6666
6767
// Imports are for scala.meta, they are not used in the backend
6868
69-
TypeParam = TYPEPARAM Length NameRef type_Term Mods
69+
TypeParam = TYPEPARAM Length NameRef type_Term Modifier*
7070
Params = PARAMS Length Param*
71-
Param = PARAM Length NameRef type_Term rhs_Term? Mods // rhs_Term is present in the case of an aliased class parameter
71+
Param = PARAM Length NameRef type_Term rhs_Term? Modifier* // rhs_Term is present in the case of an aliased class parameter
7272
Template = TEMPLATE Length TypeParam* Param* parent_Term* Self? Stat* // Stat* always starts with the primary constructor.
7373
Self = SELFDEF selfName_NameRef selfType_Term
7474
@@ -168,8 +168,6 @@ Standard-Section: "ASTs" TopLevelStat*
168168
NamesTypes = NameType*
169169
NameType = paramName_NameRef typeOrBounds_ASTRef
170170
171-
Mods = Modifier* Annotation*
172-
173171
Modifier = PRIVATE
174172
INTERNAL // package private
175173
PROTECTED
@@ -209,9 +207,10 @@ Standard-Section: "ASTs" TopLevelStat*
209207
// --------------- untyped additions ------------------------------------------
210208
211209
TermUntyped = Term
210+
TYPEDSPLICE Length splice_Term
212211
FUNCTION Length body_Term arg_Term*
213212
INFIXOP Length op_NameRef left_Term right_Term
214-
TYPEDSPLICE Length splice_Term
213+
PATDEF Length type_Term rhs_Term pattern_Term* Modifier*
215214
216215
Note: Tree tags are grouped into 5 categories that determine what follows, and thus allow to compute the size of the tagged tree in a generic way.
217216
@@ -428,6 +427,7 @@ object TastyFormat {
428427
final val TYPEDSPLICE = 200
429428
final val FUNCTION = 201
430429
final val INFIXOP = 202
430+
final val PATDEF = 203
431431

432432
def methodType(isImplicit: Boolean = false, isErased: Boolean = false) = {
433433
val implicitOffset = if (isImplicit) 1 else 0
@@ -643,6 +643,7 @@ object TastyFormat {
643643
case TYPEDSPLICE => "TYPEDSPLICE"
644644
case FUNCTION => "FUNCTION"
645645
case INFIXOP => "INFIXOP"
646+
case PATDEF => "PATDEF"
646647
}
647648

648649
/** @return If non-negative, the number of leading references (represented as nats) of a length/trees entry.

0 commit comments

Comments
 (0)