> In the translation to map/flatMap/etc the mid-stream assignments are
> smuggled forward by smashing them into a tuple which accompanies the actual
> result. The reason you get away with it once is that it goes from a 2-tuple
> to another 2-tuple - (String, String) to ((String, String), Int). But it
> doesn't continue nesting them, so next you get a 3-tuple ((String, String),
> Int, Int) and so the inferencer thinks you are lacking in evidence that you
> are producing 2-tuples.
I had a vague cloudy thing in my mind suggesting an issue along those lines ;)
> There is so much wrong with what I've just described I don't even know what
> to say, but if you want a workaround, don't let it stack up:
>
> scala> for ((k, v) <- Map("a" -> "b"); a = k.length; _ <- 1 to 1 ; b =
> v.length) yield v -> k
> res0: scala.collection.immutable.Map[String,String] = Map(b -> a)
Thanks. I entered an issue:
https://issues.scala-lang.org/browse/SI-7515
-Erik