forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
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 scala#13273 from ansvonwa/fix-13183
Emit unicode instead of octal literals
- Loading branch information
Showing
7 changed files
with
21 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"\u001b" | ||
"\u0000\u0001\u0003" | ||
"ABC" | ||
"\u0080\u0081翿" | ||
"\t\n\r👋👌🥳" |
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,5 @@ | ||
import scala.quoted.* | ||
|
||
object Macro_1: | ||
inline def stringLiteral(inline s: String): String = ${showExpr('s)} | ||
def showExpr(s: Expr[?])(using Quotes): Expr[String] = Expr(s.show.toString) |
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,6 @@ | ||
@main def Test = | ||
println(Macro_1.stringLiteral("\u001b")) // "\u001b" | ||
println(Macro_1.stringLiteral("\u0000\u0001\u0003")) // "\u0000\u0001\u0003" | ||
println(Macro_1.stringLiteral("A\u0042C")) // "ABC" | ||
println(Macro_1.stringLiteral("\u0080\u0081\u7fff")) // "\u0080\u0081翿" | ||
println(Macro_1.stringLiteral("\t\n\r👋👌🥳")) // "\t\n\r👋👌🥳" |
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 @@ | ||
"\u001b" |
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,2 @@ | ||
@main def Test(): Unit = | ||
println(scala.compiletime.codeOf("\u001b")) |