@@ -357,7 +357,13 @@ class TreeUnpickler(reader: TastyReader,
357
357
// Note that the lambda "rt => ..." is not equivalent to a wildcard closure!
358
358
// Eta expansion of the latter puts readType() out of the expression.
359
359
case APPLIEDtype =>
360
- readType().appliedTo(until(end)(readType()))
360
+ val tycon = readType()
361
+ val args = until(end)(readType())
362
+ tycon match
363
+ case tycon : TypeRef if tycon.symbol == defn.Predef_retainsType =>
364
+ CapturingType .checked(args(0 ), args(1 ))
365
+ case _ =>
366
+ tycon.appliedTo(args)
361
367
case TYPEBOUNDS =>
362
368
val lo = readType()
363
369
if nothingButMods(end) then
@@ -821,7 +827,7 @@ class TreeUnpickler(reader: TastyReader,
821
827
def TypeDef (rhs : Tree ) =
822
828
ta.assignType(untpd.TypeDef (sym.name.asTypeName, rhs), sym)
823
829
824
- def ta = ctx.typeAssigner
830
+ def ta = ctx.typeAssigner
825
831
826
832
val name = readName()
827
833
pickling.println(s " reading def of $name at $start" )
@@ -1255,11 +1261,9 @@ class TreeUnpickler(reader: TastyReader,
1255
1261
// types. This came up in #137 of collection strawman.
1256
1262
val tycon = readTpt()
1257
1263
val args = until(end)(readTpt())
1258
- val ownType =
1259
- if (tycon.symbol == defn.andType) AndType (args(0 ).tpe, args(1 ).tpe)
1260
- else if (tycon.symbol == defn.orType) OrType (args(0 ).tpe, args(1 ).tpe, soft = false )
1261
- else tycon.tpe.safeAppliedTo(args.tpes)
1262
- untpd.AppliedTypeTree (tycon, args).withType(ownType)
1264
+ val tree = untpd.AppliedTypeTree (tycon, args)
1265
+ val ownType = ctx.typeAssigner.processAppliedType(tree, tycon.tpe.safeAppliedTo(args.tpes))
1266
+ tree.withType(ownType)
1263
1267
case ANNOTATEDtpt =>
1264
1268
Annotated (readTpt(), readTerm())
1265
1269
case LAMBDAtpt =>
0 commit comments