Why Scala REPL shows tuple type for Map expression?
问题 Scala REPL gives the same type for both expressions - (tuple? -- strange!). Yet ("a" ->1) which is a Map I can add to map and ("a", 1) can not. Why Scala REPL shows tuple type type for Map expression? scala> :t ("a" -> 1) (String, Int) scala> :t ("a",1) (String, Int) scala> val m = Map.empty[String, Int] m: scala.collection.immutable.Map[String,Int] = Map() scala> m + ("a",1) <console>:9: error: type mismatch; found : String("a") required: (String, ?) m + ("a",1) ^ scala> m + ("a" ->1) res19: