[#294] | project: compiler | priority: low | category: missing feature | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Burak | Matthias | won't fix | 2004-02-06 10:38:57.0 | |
subject | typeinference in comprehensions | |||
code |
import scala.collection.immutable.ListMap ; object test { for( val y <- ListMap.Empty[int,int] ) { Console.println( y ); } } |
|||
what happened | testMap.scala:6: missing parameter type for( val y <- ListMap.Empty[int,int] ) { ^ testMap.scala:6: type mismatch; found : ( |
|||
what expected | silent run, type inference finding out the right type of y. | |||
[back to overview] |
Burak edited on 2004-02-06 11:01:56.0 |
[change to 'missing feature'] Matthias just told me that this way you get the wrong foreach method, and it will be fixed once the Iterable trait is updated with the right foreach method is checked in. |
Burak edited on 2004-04-07 15:13:04.0 |
I see that Map.foreach expects (A,B) => Unit, which is the source of confusion. There is simply no way to make an iteration through key-value pairs using the for-comprehension syntax.
My assumption was that Map.foreach takes Pair[A,B] => Unit, and type inference was not clever enough. I change this one to "won't fix" though. |