summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/internal/Types.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-09-19 20:46:22 +0000
committerPaul Phillips <paulp@improving.org>2011-09-19 20:46:22 +0000
commitc22bc18ab6a6b91c30a6e9dde6797d7db94e22e0 (patch)
treeb98c3f48f68fd575f6f41d1c986b990ce462dcee /src/compiler/scala/reflect/internal/Types.scala
parente21d9b0a3907ee59b4d05489ecaf0fbf6467e27f (diff)
downloadscala-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/reflect/internal/Types.scala')
-rw-r--r--src/compiler/scala/reflect/internal/Types.scala17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala
index ea576f0387..811dc36bdc 100644
--- a/src/compiler/scala/reflect/internal/Types.scala
+++ b/src/compiler/scala/reflect/internal/Types.scala
@@ -1606,12 +1606,15 @@ trait Types extends api.Types { self: SymbolTable =>
val enterRefs = new TypeMap {
def apply(tp: Type): Type = {
tp match {
- case TypeRef(_, sym, args) =>
- for ((tparam1, arg) <- sym.info.typeParams zip args)
- if (arg contains tparam) {
- addRef(NonExpansive, tparam, tparam1)
- if (arg.typeSymbol != tparam) addRef(Expansive, tparam, tparam1)
- }
+ case TypeRef(_, sym, args) if args.nonEmpty =>
+ if (settings.debug.value && !sameLength(sym.info.typeParams, args))
+ debugwarn("Mismatched zip in computeRefs(): " + sym.info.typeParams + ", " + args)
+
+ for ((tparam1, arg) <- sym.info.typeParams zip args; if arg contains tparam) {
+ addRef(NonExpansive, tparam, tparam1)
+ if (arg.typeSymbol != tparam)
+ addRef(Expansive, tparam, tparam1)
+ }
case _ =>
}
mapOver(tp)
@@ -1903,6 +1906,8 @@ A type's typeSymbol should never be inspected directly.
/** @pre: sym.info.typeParams.length == typeArgs.length */
@inline private def betaReduce: Type = {
+ if (settings.debug.value)
+ assert(sym.info.typeParams.length == typeArgs.length, sym.info.typeParams + " and " + typeArgs)
// isHKSubType0 introduces synthetic type params so that
// betaReduce can first apply sym.info to typeArgs before calling
// asSeenFrom. asSeenFrom then skips synthetic type params, which