diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-05 23:33:17 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-02 20:25:19 -0800 |
commit | 52e7fdc7efaa4ecfd68f71a51375e1870cc78dcc (patch) | |
tree | a26ba2f812c4a503a5b542bddf503fae33223ee0 | |
parent | 7b153ed4927c171d1e219a5c1d98096f104cc0fe (diff) | |
download | scala-52e7fdc7efaa4ecfd68f71a51375e1870cc78dcc.tar.gz scala-52e7fdc7efaa4ecfd68f71a51375e1870cc78dcc.tar.bz2 scala-52e7fdc7efaa4ecfd68f71a51375e1870cc78dcc.zip |
Misc optimizations with zip.
-rw-r--r-- | src/compiler/scala/reflect/internal/Types.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 4 |
3 files changed, 3 insertions, 6 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index 371fb8d585..4e842c05da 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -5687,7 +5687,7 @@ trait Types extends api.Types { self: SymbolTable => val padded = sorted map (_._2.padTo(maxSeqLength, NoType)) val transposed = padded.transpose - val columns: List[Column[List[Type]]] = sorted.zipWithIndex map { + val columns: List[Column[List[Type]]] = mapWithIndex(sorted) { case ((k, v), idx) => Column(str(k), (xs: List[Type]) => str(xs(idx)), true) } diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 4a104857db..4012d08e42 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1711,8 +1711,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { private def makeArguments(fun: Symbol, vparams: List[Symbol]): List[Tree] = ( //! TODO: make sure the param types are seen from the right prefix - for ((tp, arg) <- fun.info.paramTypes zip vparams) yield - gen.maybeMkAsInstanceOf(Ident(arg), tp, arg.tpe) + map2(fun.info.paramTypes, vparams)((tp, arg) => gen.maybeMkAsInstanceOf(Ident(arg), tp, arg.tpe)) ) private def findSpec(tp: Type): Type = tp match { case TypeRef(pre, sym, _ :: _) => specializedType(tp) diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index a6c2f75d5e..fa4664b34f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -924,9 +924,7 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R } def validateVarianceArgs(tps: List[Type], variance: Int, tparams: List[Symbol]) { - (tps zip tparams) foreach { - case (tp, tparam) => validateVariance(tp, variance * tparam.variance) - } + foreach2(tps, tparams)((tp, tparam) => validateVariance(tp, variance * tparam.variance)) } validateVariance(base.info, CoVariance) |