@@ -473,33 +473,27 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
473
473
}
474
474
475
475
override def Apply (tree : Tree )(fun : Tree , args : List [Tree ])(implicit ctx : Context ): Apply = {
476
- if (ctx.settings.optimise.value) {
477
- val untyped = untpd.cpy.Apply (tree)(fun, args)
478
- val typed = ta.assignType(untyped, fun, args)
479
- if (untyped.ne(tree))
480
- typed
481
- else
482
- tree.asInstanceOf [Apply ]
483
- } else {
484
- ta.assignType(untpd.cpy.Apply (tree)(fun, args), fun, args)
485
- }
476
+ val untyped = untpd.cpy.Apply (tree)(fun, args)
477
+ val typed = ta.assignType(untyped, fun, args)
478
+ if (untyped.ne(tree))
479
+ typed
480
+ else
481
+ tree.asInstanceOf [Apply ]
486
482
}
487
- // Note: Reassigning the original type if `fun` and `args` have the same types as before
483
+
484
+ // Note: Reassigning the original type if `fun` and `args` have the same types as before
488
485
// does not work here: The computed type depends on the widened function type, not
489
486
// the function type itself. A treetransform may keep the function type the
490
487
// same but its widened type might change.
491
488
492
489
override def TypeApply (tree : Tree )(fun : Tree , args : List [Tree ])(implicit ctx : Context ): TypeApply = {
493
- if (ctx.settings.optimise.value) {
494
- val untyped = untpd.cpy.TypeApply (tree)(fun, args)
495
- val typed = ta.assignType(untyped, fun, args)
496
- if (untyped.ne(tree))
497
- typed
498
- else
499
- tree.asInstanceOf [TypeApply ]
500
- } else {
501
- ta.assignType(untpd.cpy.TypeApply (tree)(fun, args), fun, args)
502
- }
490
+ val untyped = untpd.cpy.TypeApply (tree)(fun, args)
491
+ val typed = ta.assignType(untyped, fun, args)
492
+ if (untyped.ne(tree))
493
+ typed
494
+ else
495
+ tree.asInstanceOf [TypeApply ]
496
+
503
497
}
504
498
// Same remark as for Apply
505
499
@@ -535,16 +529,12 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
535
529
}
536
530
537
531
override def Closure (tree : Tree )(env : List [Tree ], meth : Tree , tpt : Tree )(implicit ctx : Context ): Closure = {
538
- if (ctx.settings.optimise.value) {
539
- val untyped = untpd.cpy.Closure (tree)(env, meth, tpt)
540
- val typed = ta.assignType(untyped, meth, tpt)
541
- if (untyped.ne(tree))
542
- typed
543
- else
544
- tree.asInstanceOf [Closure ]
545
- } else {
546
- ta.assignType(untpd.cpy.Closure (tree)(env, meth, tpt), meth, tpt)
547
- }
532
+ val untyped = untpd.cpy.Closure (tree)(env, meth, tpt)
533
+ val typed = ta.assignType(untyped, meth, tpt)
534
+ if (untyped.ne(tree))
535
+ typed
536
+ else
537
+ tree.asInstanceOf [Closure ]
548
538
}
549
539
// Same remark as for Apply
550
540
0 commit comments