String literal error in Scala Worksheet when setting map

In a fresh Scala project, if I put the following into a worksheet I get an error:

var d = scala.collection.mutable.Map[String, Int]()
d("a") = 1

Seems like it's trying to print out a result for the map set and failing. Calling `update` works fine.

The same code works in the scala repl w/o a problem.

IntelliJ IDEA 2016.3.4
Build #IU-163.12024.16, built on January 31, 2017
Licensed to Mat Schaffer
You have a perpetual fallback license for this version
Subscription is active until January 14, 2018
JRE: 1.8.0_112-release-408-b6 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Scala plugin is 2016.3.8, project is using scala 2.12.1

Comment actions Permalink

Same here. I stumbled upon this while working with maps.

Comment actions Permalink

It still hasn't been fixed :-(. 

Comment actions Permalink

The issue is still present using version 2018.2.11:

val mutScores = scala.collection.mutable.Map("Alice"-> 10, "Bob" -> 3, "Cindy" -> 8)
mutScores("Bob") = 7


Error:(42, 68) ')' expected but string literal found.
inst$A$A.`get$$instance_0$$mutScores("Bob")`; println("mutScores("Bob"): " + {val $$temp$$ = inst$A$A.mutScores("Bob") ; MacroPrinter.printDefInfo($$temp$$).replace("inst$A$A.", "") + " = " + ( print$$$Worksheet$$$Array$$$($$temp$$) ).stripPrefix("A$A27$A$A27$")})


Please sign in to leave a comment.