Lorenz Bateman schrieb:
> The problem I have is understanding why map += (1 -> "Some String")
> works fine, but:
> scala> map += (1, "Some String")
> gives me an error.
Sometimes scala is a bit too clever in its handling of parens and you just have
to add another pair, in this case to disambiguate between these two methods:
def += (kv1 : (A, B), kv2 : (A, B), kvs : (A, B)*) : Unit
Add two or more key/value pairs to this map.
(The one you called)
def += (kv : (A, B)) : Unit
Add a key/value pair to this map.
(The one you thought you called)
Related:
http://www.nabble.com/-scala--Parenthesis-inference-td19535942.htmlhttps://lampsvn.epfl.ch/trac/scala/ticket/1337- Florian