diff options
author | Paul Phillips <paulp@improving.org> | 2011-09-19 20:46:22 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-09-19 20:46:22 +0000 |
commit | c22bc18ab6a6b91c30a6e9dde6797d7db94e22e0 (patch) | |
tree | b98c3f48f68fd575f6f41d1c986b990ce462dcee /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | |
parent | e21d9b0a3907ee59b4d05489ecaf0fbf6467e27f (diff) | |
download | scala-c22bc18ab6a6b91c30a6e9dde6797d7db94e22e0.tar.gz scala-c22bc18ab6a6b91c30a6e9dde6797d7db94e22e0.tar.bz2 scala-c22bc18ab6a6b91c30a6e9dde6797d7db94e22e0.zip |
Rooting out mismatched zips.
I added local logging to zip and zipped and listened for who was
dropping things on the floor. Everything in this commit stems from that.
Sometimes the fix was uncertain and I sprinkled some logging. If you've
been hanging back with lots of internals knowledge waiting for the right
commit to review, this would be a good one. But since knowledgeable
people are hard to find, I'll go with review by moors.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 6bd1bf9ad4..14bfa65335 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -336,6 +336,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { Set(sym) else if (sym == ArrayClass) specializedTypeVars(args) + else if (args.isEmpty) + Set() else specializedTypeVars(sym.typeParams zip args collect { case (tp, arg) if isSpecialized(tp) => arg }) @@ -948,8 +950,9 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { env } - private def unify(tp1: List[Type], tp2: List[Type], env: TypeEnv, strict: Boolean): TypeEnv = - tp1.zip(tp2).foldLeft(env) { (env, args) => + private def unify(tp1: List[Type], tp2: List[Type], env: TypeEnv, strict: Boolean): TypeEnv = { + if (tp1.isEmpty || tp2.isEmpty) env + else (tp1 zip tp2).foldLeft(env) { (env, args) => if (!strict) unify(args._1, args._2, env, strict) else { val nenv = unify(args._1, args._2, emptyEnv, strict) @@ -960,11 +963,10 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } } } + } /** Map class symbols to the type environments where they were created. */ - val typeEnv: mutable.Map[Symbol, TypeEnv] = new mutable.HashMap[Symbol, TypeEnv] { - override def default(key: Symbol) = emptyEnv - } + private val typeEnv = mutable.HashMap[Symbol, TypeEnv]() withDefaultValue emptyEnv /** Apply type bindings in the given environment `env` to all declarations. */ private def subst(env: TypeEnv, decls: List[Symbol]): List[Symbol] = |