calling setter method on result of Map.apply causes an error #6549
If one tries to update a value in a Map by calling its corresponding setter, the REPL throws an error:
scala> case class X(var x: Int) defined class X scala> val m = Map('x -> X(1)) m: scala.collection.immutable.Map[Symbol,X] = Map('x -> X(1)) scala> m('x).x = 7 <console>:10: error: ')' expected but string literal found. + "m(scala.Symbol("x")).x: Int = " + `$ires0` + "\n" ^
This error occurs both in a nightly version of 2.10 and in 2.9.2, but in the latter no error message is thrown. Using an explicitly typed setter, no error occurs:
scala> m('x).x_=(7) scala> m res1: scala.collection.immutable.Map[Symbol,X] = Map('x -> X(7))
Furthermore, this error occurs only inside of the REPL, not by compiling/interpreting of a Scala source file.
The text was updated successfully, but these errors were encountered: