From c22bc18ab6a6b91c30a6e9dde6797d7db94e22e0 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 19 Sep 2011 20:46:22 +0000 Subject: 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. --- src/library/scala/runtime/ScalaRunTime.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/library') diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index 3c7aff5b60..a56055e210 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -346,4 +346,18 @@ object ScalaRunTime { nl + s + "\n" } + private[scala] def checkZip(what: String, coll1: TraversableOnce[_], coll2: TraversableOnce[_]) { + if (sys.props contains "scala.debug.zip") { + val xs = coll1.toIndexedSeq + val ys = coll2.toIndexedSeq + if (xs.length != ys.length) { + Console.err.println( + "Mismatched zip in " + what + ":\n" + + " this: " + xs.mkString(", ") + "\n" + + " that: " + ys.mkString(", ") + ) + (new Exception).getStackTrace.drop(2).take(10).foreach(println) + } + } + } } -- cgit v1.2.3