[SI-6659] Spurious unclosed string literal warning in Repl Created: 13/Nov/12  Updated: 20/Nov/15  Resolved: 20/Nov/15

Status: CLOSED
Project: Scala Programming Language
Component/s: Repl / Interpreter
Affects Version/s: Scala 2.10.0-RC2
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Paul Butcher Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates SI-4438 Tab completion in the REPL doesn't wo... CLOSED
Relates
relates to SI-7762 Assertion error when attempting tab c... CLOSED

 Description   

Tab completion works fine on a string literal:

Welcome to Scala version 2.10.0-RC2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.
 
scala> "foo".s
split         startsWith    subSequence   substring     

But if the string contains a comma:

scala> "foo,bar".s<console>:1: error: unclosed string literal
bar"
   ^



 Comments   
Comment by A. P. Marki [ 01/Jul/13 ]

`scala.repl.debug=true` shows the completer receives `bar"` to complete, with the line split on the comma, so when converting that to something it can type, it errors out.

It looks like the parsing is done on the scala side of jline, and maybe this comment is relevant:

def isQuoted = false // TODO

Comment by Jason Zaugg [ 18/Aug/13 ]

Another example from SI-7762.

 ~/code/scala scala-hash v2.11.0-M4 -nc
[info] v2.11.0-M4 => /Users/jason/usr/scala-v2.11.0-M4-0-g8b41240
Welcome to Scala version 2.11.0-20130710-171554-8b41240f3d (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.
 
scala> "99.4".toD<console>:1: error: unclosed string literal
"99
^

Comment by Li Haoyi [ 19/Apr/15 ]

This has been fixed in the Ammonite REPL.

@ "foo".s
sameElements    scan            scanLeft        scanRight       segmentLength   self
seq             size            slice           sliding         sortBy          sortWith
sorted          span            split           splitAt         startsWith      stringPrefix
stripLineEnd    stripMargin     stripPrefix     stripSuffix     subSequence     substring
sum             synchronized
@ "foo,bar".s
sameElements    scan            scanLeft        scanRight       segmentLength   self
seq             size            slice           sliding         sortBy          sortWith
sorted          span            split           splitAt         startsWith      stringPrefix
stripLineEnd    stripMargin     stripPrefix     stripSuffix     subSequence     substring
sum             synchronized
@ "foo,bar".s

Comment by A. P. Marki [ 19/Apr/15 ]

Does Ammonite do column output, column-first instead of row-first? Funny how I can't go back. The other question is whether the JLine dependency is useful.

Generated at Wed Aug 15 14:53:03 CEST 2018 using JIRA 7.9.1#79001-sha1:60970b42586a2ec2760ed6cfe825b26961e62b9e.