diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-02-29 12:51:18 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-02-29 23:38:52 +0100 |
commit | 8cc36cdfa17c26a55ab1d164105363f3492f72af (patch) | |
tree | efc14d6c0b1eb5f6b3638c4762ed0615bb530ec0 | |
parent | 105dc63121c84a45711b02f77f8e4a04074f7425 (diff) | |
download | scala-8cc36cdfa17c26a55ab1d164105363f3492f72af.tar.gz scala-8cc36cdfa17c26a55ab1d164105363f3492f72af.tar.bz2 scala-8cc36cdfa17c26a55ab1d164105363f3492f72af.zip |
Fixes SI-5530
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Scanners.scala | 13 | ||||
-rw-r--r-- | test/files/run/t5530.check | 2 | ||||
-rw-r--r-- | test/files/run/t5530.flags | 1 | ||||
-rw-r--r-- | test/files/run/t5530.scala | 4 |
4 files changed, 15 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala index 2626ca26a6..20360b547e 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -698,12 +698,15 @@ trait Scanners extends ScannersCommon { } else { syntaxError("invalid string interpolation") } - } else if ((ch == CR || ch == LF || ch == SU) && !isUnicodeEscape) { - syntaxError("unclosed string literal") } else { - putChar(ch) - nextRawChar() - getStringPart(multiLine) + 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 { + putChar(ch) + nextRawChar() + getStringPart(multiLine) + } } } diff --git a/test/files/run/t5530.check b/test/files/run/t5530.check new file mode 100644 index 0000000000..1013e3356f --- /dev/null +++ b/test/files/run/t5530.check @@ -0,0 +1,2 @@ +something like this + 7 now works!. diff --git a/test/files/run/t5530.flags b/test/files/run/t5530.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/files/run/t5530.flags @@ -0,0 +1 @@ +-Xexperimental
\ No newline at end of file diff --git a/test/files/run/t5530.scala b/test/files/run/t5530.scala new file mode 100644 index 0000000000..c8109a4004 --- /dev/null +++ b/test/files/run/t5530.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(s"""something like this + ${3+4} now works!.""") +}
\ No newline at end of file |