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
unicode escape sequence for backslash symbol (`\u005c') is treated differently since 2.13.2 #12293
Comments
@martijnhoekstra could this change #11966 somehow lead to this? |
This is scala/scala#8282, listed in the release notes of 2.13.2 at https://github.com/scala/scala/releases/tag/v2.13.2: Unicode escapes are now ordinary escape sequences (not processed early) (8282), and indeed as intended. Instead of |
Oh, sorry, that was so dum from me...
I also think this is an improvement. Less "WTF" cases. (though technically it was a regression)
No, I am fixing various edge cases with string literals in IntelliJ Scala Plugin (in different subsystems), and I noticed this difference. |
This will definitely cut down on your sting literal edgecases. |
@martijnhoekstra scala.util.Properties.versionString
"""\"""
"""\\"""
"""\\\"""
"""\u0025"""
"""\\u0025"""
"""\\\u0025"""
"""\\\\u0025""" I understand why it works so, but it looks like a bug to me.
WDYT? |
That would totally make sense, but isn't done to maintain backwards compatibility. The PR mentions it
There is also a comment in the source where it happens:
There is code out in the wild that breaks on the change. |
The odd rule is inherited from Java, JLS 3.3. Also multiple uu. That has to do with round-tripping to ASCII. |
Ok, guess we will just leave with it until everyone migrates to Scala 3 with removed Unicode escapes in raw literals. No questions regarding |
reproduction steps
Since 2.13.2 Unicode escape sequence for backslash (
\u005c
) is treated as an escaped backslash\\
at a source level.In 2.12.12 & 2.11.12 it's treated as single
\
at a source level (exceptraw
interpolated string literals and non-interpolated multiline string literals)I couldn't find any related ticket, PR or discussion.
Is it as designed or a regression?
The text was updated successfully, but these errors were encountered: