Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling setter method on result of Map.apply causes an error #6549

Closed
scabug opened this issue Oct 21, 2012 · 2 comments
Closed

calling setter method on result of Map.apply causes an error #6549

scabug opened this issue Oct 21, 2012 · 2 comments

Comments

@scabug
Copy link

@scabug scabug commented Oct 21, 2012

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.

@scabug
Copy link
Author

@scabug scabug commented Oct 21, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6549?orig=1
Reporter: @sschaef
Affected Versions: 2.9.2, 2.10.0

@scabug
Copy link
Author

@scabug scabug commented Dec 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants