scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

`raw"\u"` wrongly rejected by `-Xsource:3-cross` #12976

Closed som-snytt closed 5 months ago

som-snytt commented 6 months ago

Reproduction steps

Welcome to Scala 3.4.2-RC1-bin-SNAPSHOT-git-a36849f (21.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> def f(c: Char) = raw"\u%04X".format(c.toInt)
def f(c: Char): String

scala> f('a')
val res0: String = \u0061

Welcome to Scala 2.13.13 (OpenJDK 64-Bit Server VM, Java 21.0.2).
Type in expressions for evaluation. Or try :help.

scala> def f(c: Char) = raw"\u%04X".format(c.toInt)
                              ^
       error: invalid unicode escape at index 2 of \u%04X

scala>
:quit

Welcome to Scala 2.13.13 -Xsource:3-cross (OpenJDK 64-Bit Server VM, Java 21.0.2).
Type in expressions for evaluation. Or try :help.

scala> def f(c: Char) = raw"\u%04X".format(c.toInt)
                              ^
       error: invalid unicode escape at index 2 of \u%04X

Problem

under -Xsource:3-cross, do not check whether my ignored escape would have been valid if not ignored.

som-snytt commented 6 months ago

@SethTisue handy having the source setting in the banner