Skip to content

Commit 725ccdd

Browse files
committed
Pickle LazyRefs
Need to keep cycle breakers
1 parent 4ecb1f7 commit 725ccdd

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Standard-Section: "ASTs" TopLevelStat*
164164
BIND Length boundName_NameRef bounds_Type
165165
// for type-variables defined in a type pattern
166166
BYNAMEtype underlying_Type
167+
LAZYref underlying_Type
167168
POLYtype Length result_Type NamesTypes
168169
METHODtype Length result_Type NamesTypes // needed for refinements
169170
TYPELAMBDAtype Length result_Type NamesTypes // variance encoded in front of name: +/-/(nothing)
@@ -256,7 +257,7 @@ object TastyFormat {
256257
final val OBJECTCLASS = 40
257258

258259
final val SIGNED = 63
259-
260+
260261
final val firstInternalTag = 64
261262
final val IMPLMETH = 64
262263

@@ -322,6 +323,7 @@ object TastyFormat {
322323
final val PROTECTEDqualified = 105
323324
final val RECtype = 106
324325
final val SINGLETONtpt = 107
326+
final val LAZYref = 108
325327

326328
final val IDENT = 112
327329
final val IDENTtpt = 113
@@ -512,6 +514,7 @@ object TastyFormat {
512514
case DOUBLEconst => "DOUBLEconst"
513515
case STRINGconst => "STRINGconst"
514516
case RECtype => "RECtype"
517+
case LAZYref => "LAZYref"
515518

516519
case IDENT => "IDENT"
517520
case IDENTtpt => "IDENTtpt"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ class TreePickler(pickler: TastyPickler) {
246246
case tpe: ParamRef =>
247247
assert(pickleParamRef(tpe), s"orphan parameter reference: $tpe")
248248
case tpe: LazyRef =>
249+
writeByte(LAZYref)
249250
pickleType(tpe.ref)
250251
}
251252

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
293293
RecType(rt => registeringType(rt, readType()))
294294
case RECthis =>
295295
RecThis(readTypeRef().asInstanceOf[RecType])
296+
case LAZYref =>
297+
val rdr = fork
298+
def readUnderlying() = rdr.readType()
299+
skipTree()
300+
LazyRef(readUnderlying)
296301
case SHARED =>
297302
val ref = readAddr()
298303
typeAtAddr.getOrElseUpdate(ref, forkAt(ref).readType())

0 commit comments

Comments
 (0)