When writing the following code in scala
var m = Map((0,1) -> "a")
m += ((0,2), "b") // compilation error
I'm getting the error
type mismatch; found : Int(0) required: (Int, Int)
However the changing the syntax of the tuple from (X,Y)
to (X -> Y)
works
var m = Map((0,1) -> 'a)
m += ((0,2) -> 'b) // compiles file
Even though
((0,1).getClass == (0 -> 1).getClass) // is true
(0,1).isInstanceOf[Tuple2[_,_]] && (0 -> 1).isInstanceOf[Tuple2[_,_]] // both true
Why is that? What does scala think my nested tuple is?