From 212c55d5bc3e87e3b1940502d55be9c2dcbf9326 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 28 Oct 2013 12:29:22 +0100 Subject: Microptimization in implicit search Avoid creating a throwaway list of parameter types. --- src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 3 ++- src/reflect/scala/reflect/internal/Types.scala | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index c19d861d23..987a3d2202 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -216,7 +216,8 @@ trait Implicits { case NullaryMethodType(restpe) => containsError(restpe) case mt @ MethodType(_, restpe) => - (mt.paramTypes exists typeIsError) || containsError(restpe) + // OPT avoiding calling `mt.paramTypes` which creates a new list. + (mt.params exists symTypeIsError) || containsError(restpe) case _ => tp.isError } diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 59d1e13142..088d6bfe8e 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -4540,7 +4540,7 @@ trait Types private[scala] val typeIsNonClassType = (tp: Type) => tp.typeSymbolDirect.isNonClassType private[scala] val typeIsExistentiallyBound = (tp: Type) => tp.typeSymbol.isExistentiallyBound private[scala] val typeIsErroneous = (tp: Type) => tp.isErroneous - private[scala] val typeIsError = (tp: Type) => tp.isError + private[scala] val symTypeIsError = (sym: Symbol) => sym.tpe.isError private[scala] val typeHasAnnotations = (tp: Type) => tp.annotations.nonEmpty private[scala] val boundsContainType = (bounds: TypeBounds, tp: Type) => bounds containsType tp private[scala] val typeListIsEmpty = (ts: List[Type]) => ts.isEmpty -- cgit v1.2.3