From 2ff968f369931b457b02956e0cd395d9803f2b9a Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 10 Jan 2019 14:25:37 +0100 Subject: [PATCH] Conserve a more lists to allow a few cpy.Apply to not create a new instance --- compiler/src/dotty/tools/dotc/transform/PostTyper.scala | 2 +- compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala index 0203d438cbcc..6cb00fad258f 100644 --- a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala @@ -210,7 +210,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase if (methType.isErasedMethod) tpd.cpy.Apply(tree)( tree.fun, - tree.args.map(arg => + tree.args.mapConserve(arg => if (methType.isImplicitMethod && arg.pos.isSynthetic) ref(defn.Predef_undefined) else dropInlines.transform(arg))) else diff --git a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala index 7b40b854edcc..b6d16782a0bd 100644 --- a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala +++ b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala @@ -85,7 +85,7 @@ abstract class Lifter { lifter.liftArg(defs, arg, if (name.firstPart contains '$') EmptyTermName else name) } case _ => - args.map(liftArg(defs, _)) + args.mapConserve(liftArg(defs, _)) } /** Lift out function prefix and all arguments from application