summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-10-28 12:29:22 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-10-28 12:35:45 +0100
commit212c55d5bc3e87e3b1940502d55be9c2dcbf9326 (patch)
treef4e9ce40193a9a55427021f9ad4fdf592f50fd38
parent1819af77fd4ecc66c89a84ea321aa7d6f92285ec (diff)
downloadscala-212c55d5bc3e87e3b1940502d55be9c2dcbf9326.tar.gz
scala-212c55d5bc3e87e3b1940502d55be9c2dcbf9326.tar.bz2
scala-212c55d5bc3e87e3b1940502d55be9c2dcbf9326.zip
Microptimization in implicit search
Avoid creating a throwaway list of parameter types.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala3
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala2
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