@@ -4,25 +4,35 @@ package core
44package tasty
55
66import Comments .CommentsContext
7- import Contexts ._ , Symbols ._ , Types ._ , Scopes ._ , SymDenotations ._ , Names ._ , NameOps ._
8- import StdNames ._ , Flags ._ , Constants ._ , Annotations ._
7+ import Contexts ._
8+ import Symbols ._
9+ import Types ._
10+ import Scopes ._
11+ import SymDenotations ._
12+ import Names ._
13+ import NameOps ._
14+ import StdNames ._
15+ import Flags ._
16+ import Constants ._
17+ import Annotations ._
918import NameKinds ._
1019import typer .Checking .checkNonCyclic
1120import util .Positions ._
12- import ast .{tpd , untpd , Trees }
21+ import ast .{TreeTypeMap , Trees , tpd , untpd }
1322import Trees ._
1423import Decorators ._
1524import transform .SymUtils ._
1625import TastyBuffer ._
17- import scala .annotation .{tailrec , switch }
26+
27+ import scala .annotation .{switch , tailrec }
1828import scala .collection .mutable .ListBuffer
1929import scala .collection .mutable
2030import config .Printers .pickling
2131import core .quoted .PickledQuotes
32+
2233import scala .quoted
2334import scala .quoted .Types .TreeType
2435import scala .quoted .Exprs .TastyTreeExpr
25-
2636import scala .annotation .internal .sharable
2737
2838/** Unpickler for typed trees
@@ -353,8 +363,6 @@ class TreeUnpickler(reader: TastyReader,
353363 readTypeRef() match {
354364 case binder : LambdaType => binder.paramRefs(readNat())
355365 }
356- case HOLE =>
357- readHole(end, isType = true ).tpe
358366 }
359367 assert(currentAddr == end, s " $start $currentAddr $end ${astTagToString(tag)}" )
360368 result
@@ -1166,17 +1174,32 @@ class TreeUnpickler(reader: TastyReader,
11661174 setPos(start, tree)
11671175 }
11681176
1169- def readTpt ()(implicit ctx : Context ): Tree =
1170- if (nextByte == SHAREDterm ) {
1171- readByte()
1172- forkAt(readAddr()).readTpt()
1173- }
1174- else if (isTypeTreeTag(nextByte)) readTerm()
1175- else {
1176- val start = currentAddr
1177- val tp = readType()
1178- if (tp.exists) setPos(start, TypeTree (tp)) else EmptyTree
1177+ def readTpt ()(implicit ctx : Context ): Tree = {
1178+ nextByte match {
1179+ case SHAREDterm =>
1180+ readByte()
1181+ forkAt(readAddr()).readTpt()
1182+ case BLOCK =>
1183+ readByte()
1184+ val end = readEnd()
1185+ val typeReader = fork
1186+ skipTree()
1187+ val aliases = readStats(ctx.owner, end)
1188+ val tpt = typeReader.readTpt()
1189+ Block (aliases, tpt)
1190+ case HOLE =>
1191+ readByte()
1192+ val end = readEnd()
1193+ readHole(end, isType = true )
1194+ case _ =>
1195+ if (isTypeTreeTag(nextByte)) readTerm()
1196+ else {
1197+ val start = currentAddr
1198+ val tp = readType()
1199+ if (tp.exists) setPos(start, TypeTree (tp)) else EmptyTree
1200+ }
11791201 }
1202+ }
11801203
11811204 def readCases (end : Addr )(implicit ctx : Context ): List [CaseDef ] =
11821205 collectWhile((nextUnsharedTag == CASEDEF ) && currentAddr != end) {
0 commit comments