@@ -978,13 +978,20 @@ object Trees {
978978 /** Tree that replaces a level 1 splices in pickled (level 0) quotes.
979979 * It is only used when picking quotes (will never be in a TASTy file).
980980 *
981+ * Hole created by this compile separate the targs from the args. Holes
982+ * generated with 3.0-3.3 contain all type args and targs in any order in
983+ * a single list. For backwards compatibility we read holes from tasty as
984+ * if they had no targs and have only args. Therefore the args may contain
985+ * type trees.
986+ *
981987 * @param isTermHole If this hole is a term, otherwise it is a type hole.
982988 * @param idx The index of the hole in it's enclosing level 0 quote.
983- * @param args The arguments of the splice to compute its content
984- * @param content Lambda that computes the content of the hole. This tree is empty when in a quote pickle.
989+ * @param targs The type arguments of the splice to compute its content
990+ * @param args The term (or type) arguments of the splice to compute its content
985991 * @param tpt Type of the hole
992+ * @param content Lambda that computes the content of the hole. This tree is empty when in a quote pickle.
986993 */
987- case class Hole [+ T <: Untyped ](isTermHole : Boolean , idx : Int , args : List [Tree [T ]], content : Tree [T ], tpt : Tree [T ])(implicit @ constructorOnly src : SourceFile ) extends Tree [T ] {
994+ case class Hole [+ T <: Untyped ](isTermHole : Boolean , idx : Int , targs : List [ Tree [ T ]], args : List [Tree [T ]], content : Tree [T ], tpt : Tree [T ])(implicit @ constructorOnly src : SourceFile ) extends Tree [T ] {
988995 type ThisTree [+ T <: Untyped ] <: Hole [T ]
989996 override def isTerm : Boolean = isTermHole
990997 override def isType : Boolean = ! isTermHole
@@ -1337,9 +1344,9 @@ object Trees {
13371344 case tree : Thicket if (trees eq tree.trees) => tree
13381345 case _ => finalize(tree, untpd.Thicket (trees)(sourceFile(tree)))
13391346 }
1340- def Hole (tree : Tree )(isTerm : Boolean , idx : Int , args : List [Tree ], content : Tree , tpt : Tree )(using Context ): Hole = tree match {
1341- case tree : Hole if isTerm == tree.isTerm && idx == tree.idx && args.eq(tree.args) && content.eq(tree.content) && content.eq(tree.content) => tree
1342- case _ => finalize(tree, untpd.Hole (isTerm, idx, args, content, tpt)(sourceFile(tree)))
1347+ def Hole (tree : Tree )(isTerm : Boolean , idx : Int , targs : List [ Tree ], args : List [Tree ], content : Tree , tpt : Tree )(using Context ): Hole = tree match {
1348+ case tree : Hole if isTerm == tree.isTerm && idx == tree.idx && targs.eq(tree.targs) && args.eq(tree.args) && content.eq(tree.content) && content.eq(tree.content) => tree
1349+ case _ => finalize(tree, untpd.Hole (isTerm, idx, targs, args, content, tpt)(sourceFile(tree)))
13431350 }
13441351
13451352 // Copier methods with default arguments; these demand that the original tree
@@ -1362,8 +1369,8 @@ object Trees {
13621369 TypeDef (tree : Tree )(name, rhs)
13631370 def Template (tree : Template )(using Context )(constr : DefDef = tree.constr, parents : List [Tree ] = tree.parents, derived : List [untpd.Tree ] = tree.derived, self : ValDef = tree.self, body : LazyTreeList = tree.unforcedBody): Template =
13641371 Template (tree : Tree )(constr, parents, derived, self, body)
1365- def Hole (tree : Hole )(isTerm : Boolean = tree.isTerm, idx : Int = tree.idx, args : List [Tree ] = tree.args, content : Tree = tree.content, tpt : Tree = tree.tpt)(using Context ): Hole =
1366- Hole (tree : Tree )(isTerm, idx, args, content, tpt)
1372+ def Hole (tree : Hole )(isTerm : Boolean = tree.isTerm, idx : Int = tree.idx, targs : List [ Tree ] = tree.targs, args : List [Tree ] = tree.args, content : Tree = tree.content, tpt : Tree = tree.tpt)(using Context ): Hole =
1373+ Hole (tree : Tree )(isTerm, idx, targs, args, content, tpt)
13671374
13681375 }
13691376
@@ -1494,8 +1501,8 @@ object Trees {
14941501 case Thicket (trees) =>
14951502 val trees1 = transform(trees)
14961503 if (trees1 eq trees) tree else Thicket (trees1)
1497- case tree @ Hole (_, _, args, content, tpt) =>
1498- cpy.Hole (tree)(args = transform(args), content = transform(content), tpt = transform(tpt))
1504+ case tree @ Hole (_, _, targs, args, content, tpt) =>
1505+ cpy.Hole (tree)(targs = transform(targs), args = transform(args), content = transform(content), tpt = transform(tpt))
14991506 case _ =>
15001507 transformMoreCases(tree)
15011508 }
@@ -1635,8 +1642,8 @@ object Trees {
16351642 this (this (x, arg), annot)
16361643 case Thicket (ts) =>
16371644 this (x, ts)
1638- case Hole (_, _, args, content, tpt) =>
1639- this (this (this (x , args), content), tpt)
1645+ case Hole (_, _, targs, args, content, tpt) =>
1646+ this (this (this (this (x, targs) , args), content), tpt)
16401647 case _ =>
16411648 foldMoreCases(x, tree)
16421649 }
0 commit comments