summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-01 09:33:26 -0700
committerPaul Phillips <paulp@improving.org>2012-09-01 22:40:43 -0700
commitce048745e1520c03cd1467933a87f4d5f8b77652 (patch)
treece9f2554f2131e7a4dac9e9d6064a7a6a8f05e7f /src
parent6b87cdcd7bd6d1932e87e6bf8dc6029d6461a488 (diff)
downloadscala-ce048745e1520c03cd1467933a87f4d5f8b77652.tar.gz
scala-ce048745e1520c03cd1467933a87f4d5f8b77652.tar.bz2
scala-ce048745e1520c03cd1467933a87f4d5f8b77652.zip
Fix for SI-6273, repl string interpolation.
As usual the hard part is tracing through all the needless abstraction. Begone, 25 layers of parsing error issuing methods!
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala8
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala2
2 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index e6bf43fe93..dd0f8fdbe0 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -754,8 +754,12 @@ trait Scanners extends ScannersCommon {
} else {
val isUnclosedLiteral = !isUnicodeEscape && (ch == SU || (!multiLine && (ch == CR || ch == LF)))
if (isUnclosedLiteral) {
- syntaxError(if (!multiLine) "unclosed string literal" else "unclosed multi-line string literal")
- } else {
+ if (multiLine)
+ incompleteInputError("unclosed multi-line string literal")
+ else
+ syntaxError("unclosed string literal")
+ }
+ else {
putChar(ch)
nextRawChar()
getStringPart(multiLine)
diff --git a/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala b/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala
index f49e8d6b59..0f5777d260 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala
@@ -37,7 +37,7 @@ trait ExprTyper {
}
/** Parse a line into a sequence of trees. Returns None if the input is incomplete. */
- def parse(line: String): Option[List[Tree]] = {
+ def parse(line: String): Option[List[Tree]] = debugging(s"""parse("$line")""") {
var isIncomplete = false
reporter.withIncompleteHandler((_, _) => isIncomplete = true) {
val trees = codeParser.stmts(line)