Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit unicode instead of octal literals #13273

Merged
merged 1 commit into from
Aug 17, 2021
Merged

Conversation

ansvonwa
Copy link
Member

@ansvonwa ansvonwa commented Aug 9, 2021

Both in -Xprint and in macros, there were octal literals generated.
This PR replaces them by unicode.

fixes #13183

@@ -525,7 +524,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
case '"' => "\\\""
case '\'' => "\\\'"
case '\\' => "\\\\"
case _ => if (ch.isControl) "\\0" + toOctalString(ch) else String.valueOf(ch)
case _ => if (ch.isControl) "\\u%04x".format(ch.toInt) else String.valueOf(ch)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, changed that both in PlainPrinter and SourceCode.

fixes scala#13183
Both in -Xprint and in macros, there were octal literals generated. This commit replaces that by unicode.
Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bishabosha bishabosha merged commit 86c9a7e into scala:master Aug 17, 2021
@Kordyjan Kordyjan added this to the 3.1.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-Xprint prints octal escape literals in strings
4 participants