Skip to content

Commit bcbd456

Browse files
committed
Be more careful reading applied types from Tasty
Same principle as reading from Scala2 pickles applied = in the face of F-bounded polymorphism we cannot assume that the type parameters are known when we unpickle a type application.
1 parent 725ccdd commit bcbd456

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,12 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
996996
val refinements = readStats(refineCls, end)(localContext(refineCls))
997997
RefinedTypeTree(parent, refinements, refineCls)
998998
case APPLIEDtpt =>
999-
AppliedTypeTree(readTpt(), until(end)(readTpt()))
999+
// If we do directly a tpd.AppliedType tree we might get a
1000+
// wrong number of arguments in some scenarios reading F-bounded
1001+
// types. This came up in #137 of collection strawman.
1002+
val tycon = readTpt()
1003+
val args = until(end)(readTpt())
1004+
untpd.AppliedTypeTree(tycon, args).withType(tycon.tpe.safeAppliedTo(args.tpes))
10001005
case ANDtpt =>
10011006
val tpt1 = readTpt()
10021007
val tpt2 = readTpt()

0 commit comments

Comments
 (0)