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

Triple quoted strings and raw interpolated strings swallow trailing backslash and emit spurious warning #11966

Closed
japgolly opened this issue Apr 29, 2020 · 4 comments · Fixed by scala/scala#8942

Comments

@japgolly
Copy link

reproduction steps

"""\/ \/ /\"""

problem

scala> """\/ \/ /\"""
                ^
       warning: Unicode escapes in triple quoted strings are deprecated, use the literal character instead

expectation

Silence from scalac. I'm not using a unicode escape.

@SethTisue SethTisue added this to the 2.13.3 milestone Apr 29, 2020
@SethTisue
Copy link
Member

2.13.2 regression. @martijnhoekstra want to take a look...?

@martijnhoekstra
Copy link

darn.

@martijnhoekstra
Copy link

martijnhoekstra commented Apr 29, 2020

The spurious warning is the least problematic part of the bug.

scala> """\/ \/ /\"""
                ^
       warning: Unicode escapes in triple quoted strings are deprecated, use the literal character instead
val res0: String = \/ \/ /

scala> raw"\/ \/ /\"
                 ^
       warning: Unicode escapes in raw interpolations are deprecated. Use literal characters instead.
val res4: String = \/ \/ /

@martijnhoekstra martijnhoekstra changed the title Spurious error about unicode escapes Triple quoted strings and raw interpolated strings swallow trailing backslash and emit spurious warning Apr 30, 2020
@martijnhoekstra
Copy link

When a string or raw interpolator ends with a backslash, that backslash is swallowed if there are additional backslashes in the string, at least 5 positions before the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants