@@ -68,7 +68,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
68
68
override def isType : Boolean = body.isType
69
69
}
70
70
71
- /** A function type with `implicit`, `erased`, or `contextual ` modifiers */
71
+ /** A function type with `implicit`, `erased`, or `given ` modifiers */
72
72
class FunctionWithMods (args : List [Tree ], body : Tree , val mods : Modifiers )(implicit @ constructorOnly src : SourceFile )
73
73
extends Function (args, body)
74
74
@@ -343,7 +343,13 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
343
343
* navigation into these arguments from the IDE, and to do the right thing in
344
344
* PrepareInlineable.
345
345
*/
346
- def New (tpt : Tree , argss : List [List [Tree ]])(implicit ctx : Context ): Tree = {
346
+ def New (tpt : Tree , argss : List [List [Tree ]])(implicit ctx : Context ): Tree =
347
+ ensureApplied((makeNew(tpt) /: argss)(Apply (_, _)))
348
+
349
+ /** A new expression with constrictor and possibly type arguments. See
350
+ * `New(tpt, argss)` for details.
351
+ */
352
+ def makeNew (tpt : Tree )(implicit ctx : Context ): Tree = {
347
353
val (tycon, targs) = tpt match {
348
354
case AppliedTypeTree (tycon, targs) =>
349
355
(tycon, targs)
@@ -354,9 +360,8 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
354
360
case _ =>
355
361
(tpt, Nil )
356
362
}
357
- var prefix : Tree = Select (New (tycon), nme.CONSTRUCTOR )
358
- if (targs.nonEmpty) prefix = TypeApply (prefix, targs)
359
- ensureApplied((prefix /: argss)(Apply (_, _)))
363
+ val nu : Tree = Select (New (tycon), nme.CONSTRUCTOR )
364
+ if (targs.nonEmpty) TypeApply (nu, targs) else nu
360
365
}
361
366
362
367
def Block (stat : Tree , expr : Tree )(implicit src : SourceFile ): Block =
0 commit comments