@@ -42,12 +42,12 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
4242 Super (qual, if (mixName.isEmpty) untpd.EmptyTypeIdent else untpd.Ident (mixName), mixinClass)
4343
4444 def Apply (fn : Tree , args : List [Tree ])(using Context ): Apply = {
45- assert(fn.isInstanceOf [RefTree ] || fn.isInstanceOf [GenericApply [_] ] || fn.isInstanceOf [Inlined ] || fn.isInstanceOf [tasty.TreePickler .Hole ])
45+ assert(fn.isInstanceOf [RefTree ] || fn.isInstanceOf [GenericApply ] || fn.isInstanceOf [Inlined ] || fn.isInstanceOf [tasty.TreePickler .Hole ])
4646 ta.assignType(untpd.Apply (fn, args), fn, args)
4747 }
4848
4949 def TypeApply (fn : Tree , args : List [Tree ])(using Context ): TypeApply = {
50- assert(fn.isInstanceOf [RefTree ] || fn.isInstanceOf [GenericApply [_] ])
50+ assert(fn.isInstanceOf [RefTree ] || fn.isInstanceOf [GenericApply ])
5151 ta.assignType(untpd.TypeApply (fn, args), fn, args)
5252 }
5353
@@ -196,7 +196,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
196196 ta.assignType(untpd.Alternative (trees), trees)
197197
198198 def UnApply (fun : Tree , implicits : List [Tree ], patterns : List [Tree ], proto : Type )(using Context ): UnApply = {
199- assert(fun.isInstanceOf [RefTree ] || fun.isInstanceOf [GenericApply [_] ])
199+ assert(fun.isInstanceOf [RefTree ] || fun.isInstanceOf [GenericApply ])
200200 ta.assignType(untpd.UnApply (fun, implicits, patterns), proto)
201201 }
202202
@@ -465,10 +465,10 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
465465
466466 if (! ctx.erasedTypes) {
467467 assert(! TypeErasure .isGeneric(elemTpe), elemTpe) // needs to be done during typer. See Applications.convertNewGenericArray
468- newArr.appliedToTypeTrees(TypeTree (returnTpe) :: Nil ).appliedToArgs (clsOf(elemTpe) :: clsOf(returnTpe) :: dims :: Nil ).withSpan(span)
468+ newArr.appliedToTypeTrees(TypeTree (returnTpe) :: Nil ).appliedToTermArgs (clsOf(elemTpe) :: clsOf(returnTpe) :: dims :: Nil ).withSpan(span)
469469 }
470470 else // after erasure
471- newArr.appliedToArgs (clsOf(elemTpe) :: clsOf(returnTpe) :: dims :: Nil ).withSpan(span)
471+ newArr.appliedToTermArgs (clsOf(elemTpe) :: clsOf(returnTpe) :: dims :: Nil ).withSpan(span)
472472 }
473473
474474 /** The wrapped array method name for an array of type elemtp */
@@ -502,7 +502,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
502502 New (tycon)
503503 .select(TermRef (tycon, constr))
504504 .appliedToTypes(targs)
505- .appliedToArgs (args)
505+ .appliedToTermArgs (args)
506506 }
507507
508508 /** An object def
@@ -900,14 +900,14 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
900900
901901 /** A unary apply node with given argument: `tree(arg)` */
902902 def appliedTo (arg : Tree )(using Context ): Apply =
903- appliedToArgs (arg :: Nil )
903+ appliedToTermArgs (arg :: Nil )
904904
905905 /** An apply node with given arguments: `tree(arg, args0, ..., argsN)` */
906906 def appliedTo (arg : Tree , args : Tree * )(using Context ): Apply =
907- appliedToArgs (arg :: args.toList)
907+ appliedToTermArgs (arg :: args.toList)
908908
909909 /** An apply node with given argument list `tree(args(0), ..., args(args.length - 1))` */
910- def appliedToArgs (args : List [Tree ])(using Context ): Apply =
910+ def appliedToTermArgs (args : List [Tree ])(using Context ): Apply =
911911 Apply (tree, args)
912912
913913 /** An applied node that accepts only varargs as arguments */
@@ -918,10 +918,13 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
918918 * `tree (argss(0)) ... (argss(argss.length -1))`
919919 */
920920 def appliedToArgss (argss : List [List [Tree ]])(using Context ): Tree =
921- argss.foldLeft(tree : Tree )(Apply (_, _))
921+ argss.foldLeft(tree : Tree ) { (t, args) => args match
922+ case arg :: args1 if arg.isType => TypeApply (tree, args)
923+ case _ => Apply (t, args)
924+ }
922925
923926 /** The current tree applied to (): `tree()` */
924- def appliedToNone (using Context ): Apply = appliedToArgs( Nil )
927+ def appliedToNone (using Context ): Apply = Apply (tree, Nil )
925928
926929 /** The current tree applied to given type argument: `tree[targ]` */
927930 def appliedToType (targ : Type )(using Context ): Tree =
@@ -1226,7 +1229,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
12261229 letBindUnless(TreeInfo .Idempotent , tree)(within)
12271230
12281231 def runtimeCall (name : TermName , args : List [Tree ])(using Context ): Tree =
1229- Ident (defn.ScalaRuntimeModule .requiredMethod(name).termRef).appliedToArgs (args)
1232+ Ident (defn.ScalaRuntimeModule .requiredMethod(name).termRef).appliedToTermArgs (args)
12301233
12311234 /** An extractor that pulls out type arguments */
12321235 object MaybePoly {
0 commit comments