Skip to content

Commit 40cee6a

Browse files
committed
Pickle hole targs as trees to keep positions
1 parent b99bd59 commit 40cee6a

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,7 @@ class TreePickler(pickler: TastyPickler) {
672672
pickleType(tpt.tpe, richTypes = true)
673673
if targs.nonEmpty then
674674
writeByte(HOLETYPES)
675-
withLength {
676-
targs.foreach(targ => pickleType(targ.tpe))
677-
}
675+
withLength { targs.foreach(pickleTree) }
678676
args.foreach(pickleTree)
679677
}
680678
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,10 +1506,9 @@ class TreeUnpickler(reader: TastyReader,
15061506
val targs =
15071507
if nextByte == HOLETYPES then
15081508
readByte()
1509-
val typesEnd = readEnd()
1510-
until(typesEnd)(readType()).map(TypeTree(_))
1509+
until(readEnd()) { readTpt() }
15111510
else Nil
1512-
val args = until(end)(readTerm())
1511+
val args = until(end) { readTerm() }
15131512
TastyQuoteHole(true, idx, targs ::: args, TypeTree(tpe)).withType(tpe)
15141513

15151514
def readLater[T <: AnyRef](end: Addr, op: TreeReader => Context ?=> T)(using Context): Trees.Lazy[T] =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Standard-Section: "ASTs" TopLevelStat*
124124
SHAREDterm term_ASTRef -- Link to previously serialized term
125125
HOLE Length idx_Nat tpe_Type HoleTypes? arg_Tree* -- Splice hole with index `idx`, the type of the hole `tpe`, type arguments of the hole `targ`s and term arguments of the hole `arg`s
126126
-- Note: From 3.0 to 3.3 `args` could contain type arguments as well. This is no longer the case.
127-
HoleTypes = HOLETYPES Length targ_Type*
127+
HoleTypes = HOLETYPES Length targ_Tree*
128128
129129
130130

0 commit comments

Comments
 (0)