diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-10-28 12:29:22 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-10-28 12:35:45 +0100 |
commit | 212c55d5bc3e87e3b1940502d55be9c2dcbf9326 (patch) | |
tree | f4e9ce40193a9a55427021f9ad4fdf592f50fd38 /src | |
parent | 1819af77fd4ecc66c89a84ea321aa7d6f92285ec (diff) | |
download | scala-212c55d5bc3e87e3b1940502d55be9c2dcbf9326.tar.gz scala-212c55d5bc3e87e3b1940502d55be9c2dcbf9326.tar.bz2 scala-212c55d5bc3e87e3b1940502d55be9c2dcbf9326.zip |
Microptimization in implicit search
Avoid creating a throwaway list of parameter types.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 3 | ||||
-rw-r--r-- | 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 |