Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8830 from eed3si9n/wip/interpolator
- Loading branch information
Showing
14 changed files
with
131 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
t6476.scala:8: error: unclosed string literal; note that `\"` no longer closes single-quoted interpolated string literals since 2.13.6, you can use a triple-quoted string instead | ||
mimi"\" | ||
^ | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// only the last one doesn't parse | ||
class C { | ||
mimi"""\ """ | ||
mimi"""\\""" | ||
mimi"""\""" | ||
mimi"\ " | ||
mimi"\\" | ||
mimi"\" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
t6476b.scala:2: error: invalid escape at terminal index 0 in "\". Use \\ for literal \. | ||
val sa = s"""\""" | ||
^ | ||
t6476b.scala:4: error: invalid escape '\ ' not one of [\b, \t, \n, \f, \r, \\, \", \', \uxxxx] at index 0 in "\ ". Use \\ for literal \. | ||
val sc = s"""\ """ | ||
^ | ||
2 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class C { | ||
val sa = s"""\""" | ||
val sb = s"""\\""" | ||
val sc = s"""\ """ | ||
val ra = raw"""\""" | ||
val rb = raw"""\\""" | ||
val rc = raw"""\ """ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
scala> raw"\"" | ||
val res0: String = \" | ||
|
||
scala> raw"\" // this used to be a comment, but after scala/pull#8830 it's part of the string! " | ||
val res1: String = "\" // this used to be a comment, but after scala/pull#8830 it's part of the string! " | ||
|
||
scala> raw"\" // this used to compile, now it's unclosed | ||
^ | ||
error: unclosed string literal; note that `\"` no longer closes single-quoted interpolated string literals since 2.13.6, you can use a triple-quoted string instead | ||
|
||
scala> :quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import scala.tools.partest.ReplTest | ||
|
||
object Test extends ReplTest { | ||
def code = """ | ||
raw"\"" | ||
raw"\" // this used to be a comment, but after scala/pull#8830 it's part of the string! " | ||
raw"\" // this used to compile, now it's unclosed | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"Hello", Alice | ||
"Hello", Alice | ||
"Hello", Alice | ||
"Hello", Alice | ||
\"Hello\", Alice | ||
\"Hello\", Alice | ||
\TILT\ | ||
\TILT\ | ||
\\TILT\\ | ||
\TILT\ | ||
\TILT\ | ||
\\TILT\\ | ||
\TILT\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
val person = "Alice" | ||
println(s"\"Hello\", $person") | ||
println(s"""\"Hello\", $person""") | ||
|
||
println(f"\"Hello\", $person") | ||
println(f"""\"Hello\", $person""") | ||
|
||
println(raw"\"Hello\", $person") | ||
println(raw"""\"Hello\", $person""") | ||
|
||
println(s"\\TILT\\") | ||
println(f"\\TILT\\") | ||
println(raw"\\TILT\\") | ||
|
||
println(s"""\\TILT\\""") | ||
println(f"""\\TILT\\""") | ||
println(raw"""\\TILT\\""") | ||
|
||
println(raw"""\TILT\""") | ||
} | ||
} |