Skip to content

Commit

Permalink
Add type argument encoding to SPLICEPATTERN
Browse files Browse the repository at this point in the history
Future proof for #18271.
  • Loading branch information
nicolasstucki committed Apr 22, 2024
1 parent 31fe897 commit 3d8aca6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,14 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
bindings.foreach(pickleTree)
}
case SplicePattern(pat, args) =>
val targs = Nil // SplicePattern `targs` will be added with #18271
writeByte(SPLICEPATTERN)
withLength {
pickleTree(pat)
pickleType(tree.tpe)
for targ <- targs do
writeByte(EXPLICITtpt)
pickleTree(targ)
args.foreach(pickleTree)
}
case Hole(_, idx, args, _) =>
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,8 @@ class TreeUnpickler(reader: TastyReader,
case SPLICEPATTERN =>
val pat = readTree()
val patType = readType()
val args = until(end)(readTree())
val (targs, args) = until(end)(readTree()).span(_.isType)
assert(targs.isEmpty, "unexpected type arguments in SPLICEPATTERN") // `targs` will be needed for #18271. Until this fearure is added they should be empty.
SplicePattern(pat, args, patType)
case HOLE =>
readHole(end, isTerm = true)
Expand Down

0 comments on commit 3d8aca6

Please sign in to comment.