scala> util.Properties.versionString
res11: String = version 2.11.2
scala> val a = ""
a: String = ""
scala> val a = "\""
a: String = "
So far so good. Now with string interpolation, it fails:
scala> val a = s"\""
<console>:1: error: unclosed string literal
val a = s"\""
^
Even after we provide closing escaped quote.
scala> val a = s"\"\""
<console>:7: error: value \ is not a member of String
val a = s"\"\""
^
Why does this happen?
This appears to be a known bug.
Note that you can get around it, at least for your case above, using triple quotes:
scala> val a = s"""""""" // seven quote characters all up!
a: String = "
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With