From b4f21c6da6b6bc1797908f1400631573b6445e31 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 31 Mar 2017 18:32:02 +0200 Subject: Names are no longer Seqs Drop Seq implementation of name. This implementation was always problematic because it entailed potentially very costly conversions to toSimpleName. We now have better control over when we convert a name to a simple name. --- compiler/src/dotty/tools/dotc/typer/Applications.scala | 5 +++-- compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/typer') diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index db1e0bcfb..2f2af9868 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -403,7 +403,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic => def missingArg(n: Int): Unit = { val pname = methodType.paramNames(n) fail( - if (pname contains '$') s"not enough arguments for $methString" + if (pname.firstPart contains '$') s"not enough arguments for $methString" else s"missing argument for parameter $pname of $methString") } @@ -719,7 +719,8 @@ trait Applications extends Compatibility { self: Typer with Dynamic => val lhs1 = typedExpr(lhs) val liftedDefs = new mutable.ListBuffer[Tree] val lhs2 = untpd.TypedSplice(liftAssigned(liftedDefs, lhs1)) - val assign = untpd.Assign(lhs2, untpd.Apply(untpd.Select(lhs2, name.init), rhss)) + val assign = untpd.Assign(lhs2, + untpd.Apply(untpd.Select(lhs2, name.asSimpleName.dropRight(1)), rhss)) wrapDefs(liftedDefs, typed(assign)) } diff --git a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala index 22acd112b..e5480c98d 100644 --- a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala +++ b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala @@ -63,7 +63,7 @@ object EtaExpansion { case mt: MethodType => (args, mt.paramNames, mt.paramInfos).zipped map { (arg, name, tp) => if (tp.isInstanceOf[ExprType]) arg - else liftArg(defs, arg, if (name contains '$') EmptyTermName else name) + else liftArg(defs, arg, if (name.firstPart contains '$') EmptyTermName else name) } case _ => args map (liftArg(defs, _)) -- cgit v1.2.3