@@ -746,6 +746,19 @@ object Trees {
746746 s " TypeTree ${if (hasType) s " [ $typeOpt] " else " " }"
747747 }
748748
749+ /** Tree that replaces a level 1 splices in pickled (level 0) quotes.
750+ * It is only used when picking quotes (will never be in a TASTy file).
751+ *
752+ * @param isTerm If this hole is a term, otherwise it is a type hole.
753+ * @param idx The index of the hole in it's enclosing level 0 quote.
754+ * @param args The arguments of the splice to compute its content
755+ * @param content Lambda that computes the content of the hole. This tree is empty when in a quote pickle.
756+ */
757+ case class Hole [+ T <: Untyped ](override val isTerm : Boolean , idx : Int , args : List [Tree [T ]], content : Tree [T ])(implicit @ constructorOnly src : SourceFile ) extends Tree [T ] {
758+ type ThisTree [+ T <: Untyped ] <: Hole [T ]
759+ override def isType : Boolean = ! isTerm
760+ }
761+
749762 /** A type tree whose type is inferred. These trees appear in two contexts
750763 * - as an argument of a TypeApply. In that case its type is always a TypeVar
751764 * - as a (result-)type of an inferred ValDef or DefDef.
@@ -1035,20 +1048,6 @@ object Trees {
10351048 def genericEmptyValDef [T <: Untyped ]: ValDef [T ] = theEmptyValDef.asInstanceOf [ValDef [T ]]
10361049 def genericEmptyTree [T <: Untyped ]: Thicket [T ] = theEmptyTree.asInstanceOf [Thicket [T ]]
10371050
1038- /** Tree that replaces a level 1 splices in pickled (level 0) quotes.
1039- * It is only used when picking quotes (will never be in a TASTy file).
1040- *
1041- * @param isTerm If this hole is a term, otherwise it is a type hole.
1042- * @param idx The index of the hole in it's enclosing level 0 quote.
1043- * @param args The arguments of the splice to compute its content
1044- * @param content Lambda that computes the content of the hole. This tree is empty when in a quote pickle.
1045- * @param tpt Type of the hole
1046- */
1047- case class Hole [+ T <: Untyped ](override val isTerm : Boolean , idx : Int , args : List [Tree [T ]], content : Tree [T ], tpt : Tree [T ])(implicit @ constructorOnly src : SourceFile ) extends Tree [T ] {
1048- type ThisTree [+ T <: Untyped ] <: Hole [T ]
1049- override def isType : Boolean = ! isTerm
1050- }
1051-
10521051 def flatten [T <: Untyped ](trees : List [Tree [T ]]): List [Tree [T ]] = {
10531052 def recur (buf : ListBuffer [Tree [T ]] | Null , remaining : List [Tree [T ]]): ListBuffer [Tree [T ]] | Null =
10541053 remaining match {
@@ -1406,9 +1405,9 @@ object Trees {
14061405 case tree : Thicket if (trees eq tree.trees) => tree
14071406 case _ => finalize(tree, untpd.Thicket (trees)(sourceFile(tree)))
14081407 }
1409- def Hole (tree : Tree )(isTerm : Boolean , idx : Int , args : List [Tree ], content : Tree , tpt : Tree )(using Context ): Hole = tree match {
1408+ def Hole (tree : Tree )(isTerm : Boolean , idx : Int , args : List [Tree ], content : Tree )(using Context ): Hole = tree match {
14101409 case tree : Hole if isTerm == tree.isTerm && idx == tree.idx && args.eq(tree.args) && content.eq(tree.content) && content.eq(tree.content) => tree
1411- case _ => finalize(tree, untpd.Hole (isTerm, idx, args, content, tpt )(sourceFile(tree)))
1410+ case _ => finalize(tree, untpd.Hole (isTerm, idx, args, content)(sourceFile(tree)))
14121411 }
14131412
14141413 // Copier methods with default arguments; these demand that the original tree
@@ -1431,8 +1430,8 @@ object Trees {
14311430 TypeDef (tree : Tree )(name, rhs)
14321431 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 =
14331432 Template (tree : Tree )(constr, parents, derived, self, body)
1434- 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 =
1435- Hole (tree : Tree )(isTerm, idx, args, content, tpt )
1433+ def Hole (tree : Hole )(isTerm : Boolean = tree.isTerm, idx : Int = tree.idx, args : List [Tree ] = tree.args, content : Tree = tree.content)(using Context ): Hole =
1434+ Hole (tree : Tree )(isTerm, idx, args, content)
14361435
14371436 }
14381437
@@ -1567,8 +1566,8 @@ object Trees {
15671566 cpy.Quote (tree)(transform(body)(using quoteContext), transform(tags))
15681567 case tree @ Splice (expr) =>
15691568 cpy.Splice (tree)(transform(expr)(using spliceContext))
1570- case tree @ Hole (isTerm, idx, args, content, tpt ) =>
1571- cpy.Hole (tree)(isTerm, idx, transform(args), transform(content), transform(tpt) )
1569+ case tree @ Hole (isTerm, idx, args, content) =>
1570+ cpy.Hole (tree)(isTerm, idx, transform(args), transform(content))
15721571 case _ =>
15731572 transformMoreCases(tree)
15741573 }
@@ -1712,8 +1711,8 @@ object Trees {
17121711 this (this (x, body)(using quoteContext), tags)
17131712 case Splice (expr) =>
17141713 this (x, expr)(using spliceContext)
1715- case Hole (_, _, args, content, tpt ) =>
1716- this (this (this ( x, args), content), tpt )
1714+ case Hole (_, _, args, content) =>
1715+ this (this (x, args), content)
17171716 case _ =>
17181717 foldMoreCases(x, tree)
17191718 }
0 commit comments