@@ -478,7 +478,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
478
478
val tree1 = untpd.cpy.Apply (tree)(fun, args)
479
479
tree match {
480
480
case tree : Apply
481
- if (fun.tpe eq tree.fun.tpe) && (args corresponds tree.args)(_ eq _ ) =>
481
+ if (fun.tpe eq tree.fun.tpe) && sameTypes (args, tree.args) =>
482
482
tree1.withTypeUnchecked(tree.tpe)
483
483
case _ => ta.assignType(tree1, fun, args)
484
484
}
@@ -488,7 +488,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
488
488
val tree1 = untpd.cpy.TypeApply (tree)(fun, args)
489
489
tree match {
490
490
case tree : TypeApply
491
- if (fun.tpe eq tree.fun.tpe) && (args corresponds tree.args)(_ eq _ ) =>
491
+ if (fun.tpe eq tree.fun.tpe) && sameTypes (args, tree.args) =>
492
492
tree1.withTypeUnchecked(tree.tpe)
493
493
case _ => ta.assignType(tree1, fun, args)
494
494
}
@@ -525,10 +525,15 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
525
525
}
526
526
}
527
527
528
- override def Closure (tree : Tree )(env : List [Tree ], meth : Tree , tpt : Tree )(implicit ctx : Context ): Closure =
529
- ta.assignType(untpd.cpy.Closure (tree)(env, meth, tpt), meth, tpt)
530
- // Same remark as for Apply
531
528
529
+ override def Closure (tree : Tree )(env : List [Tree ], meth : Tree , tpt : Tree )(implicit ctx : Context ): Closure = {
530
+ val tree1 = untpd.cpy.Closure (tree)(env, meth, tpt)
531
+ tree match {
532
+ case tree : Closure if sameTypes(env, tree.env) && (meth.tpe eq tree.meth.tpe) && (tpt.tpe eq tree.tpt.tpe) =>
533
+ tree1.withTypeUnchecked(tree.tpe)
534
+ case _ => ta.assignType(tree1, meth, tpt)
535
+ }
536
+ }
532
537
override def Match (tree : Tree )(selector : Tree , cases : List [CaseDef ])(implicit ctx : Context ): Match = {
533
538
val tree1 = untpd.cpy.Match (tree)(selector, cases)
534
539
tree match {
@@ -596,6 +601,12 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
596
601
override def TypeApply (tree : Tree )(fun : Tree , args : List [Tree ])(implicit ctx : Context ): TypeApply =
597
602
ta.assignType(untpd.cpy.TypeApply (tree)(fun, args), fun, args)
598
603
// Same remark as for Apply
604
+
605
+ override def Closure (tree : Tree )(env : List [Tree ], meth : Tree , tpt : Tree )(implicit ctx : Context ): Closure =
606
+ ta.assignType(untpd.cpy.Closure (tree)(env, meth, tpt), meth, tpt)
607
+
608
+ override def Closure (tree : Closure )(env : List [Tree ] = tree.env, meth : Tree = tree.meth, tpt : Tree = tree.tpt)(implicit ctx : Context ): Closure =
609
+ Closure (tree : Tree )(env, meth, tpt)
599
610
}
600
611
601
612
override def skipTransform (tree : Tree )(implicit ctx : Context ) = tree.tpe.isError
0 commit comments