You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
valx:Int=5valy:Int=2
println(f"x % y = ${x % y}%d") // java.util.UnknownFormatConversionException
Output
Starting scala3 REPL...
Scala compiler version 3.0.0-M3--Copyright2002-2020, LAMP/EPFL
scala>valx:Int=5|valy:Int=2|| println(f"x % y = ${x % y}%d")
java.util.UnknownFormatConversionException:Conversion='y'
at java.util.Formatter$FormatSpecifier.conversion(UnknownSource)
at java.util.Formatter$FormatSpecifier.<init>(UnknownSource)
at java.util.Formatter.parse(UnknownSource)
at java.util.Formatter.format(UnknownSource)
at java.util.Formatter.format(UnknownSource)
at java.lang.String.format(UnknownSource)
at scala.collection.StringOps$.format$extension(StringOps.scala:968)
... 27 elided
java.lang.NoClassDefFoundError:Could not initialize classrs$line$1$
at rs$line$1.y(rs$line$1)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
at sun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)
at java.lang.reflect.Method.invoke(UnknownSource)
at dotty.tools.repl.Rendering.$anonfun$3(Rendering.scala:84)
at scala.Option.map(Option.scala:242)
at dotty.tools.repl.Rendering.valueOf(Rendering.scala:84)
at dotty.tools.repl.Rendering.renderVal(Rendering.scala:121)
at dotty.tools.repl.ReplDriver.$anonfun$13(ReplDriver.scala:308)
at scala.collection.immutable.List.flatMap(List.scala:293)
at scala.collection.immutable.List.flatMap(List.scala:79)
at dotty.tools.repl.ReplDriver.extractAndFormatMembers$2(ReplDriver.scala:308)
at dotty.tools.repl.ReplDriver.renderDefinitions$$anonfun$2(ReplDriver.scala:331)
at scala.Option.map(Option.scala:242)
at dotty.tools.repl.ReplDriver.renderDefinitions(ReplDriver.scala:334)
at dotty.tools.repl.ReplDriver.compile$$anonfun$2(ReplDriver.scala:253)
at scala.util.Either.fold(Either.scala:189)
at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:269)
at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:197)
at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:130)
at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:133)
at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:152)
at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:133)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
java.lang.NoClassDefFoundError:Could not initialize classrs$line$1$
at rs$line$1.res0(rs$line$1)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
at sun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)
at java.lang.reflect.Method.invoke(UnknownSource)
at dotty.tools.repl.Rendering.$anonfun$3(Rendering.scala:84)
at scala.Option.map(Option.scala:242)
at dotty.tools.repl.Rendering.valueOf(Rendering.scala:84)
at dotty.tools.repl.Rendering.renderVal(Rendering.scala:121)
at dotty.tools.repl.ReplDriver.$anonfun$13(ReplDriver.scala:308)
at scala.collection.immutable.List.flatMap(List.scala:293)
at scala.collection.immutable.List.flatMap(List.scala:79)
at dotty.tools.repl.ReplDriver.extractAndFormatMembers$2(ReplDriver.scala:308)
at dotty.tools.repl.ReplDriver.renderDefinitions$$anonfun$2(ReplDriver.scala:331)
at scala.Option.map(Option.scala:242)
at dotty.tools.repl.ReplDriver.renderDefinitions(ReplDriver.scala:334)
at dotty.tools.repl.ReplDriver.compile$$anonfun$2(ReplDriver.scala:253)
at scala.util.Either.fold(Either.scala:189)
at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:269)
at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:197)
at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:130)
at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:133)
at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:152)
at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:133)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
Expectation
On Scala 2.10.2 to the current stable version,
I get a compile error when specifying a single '%' character.
Welcome to Scala version 2.10.2 (JavaHotSpot(TM) 64-BitServerVM, Java1.6.0_45).
Type in expressions to have them evaluated.
Type:help for more information.
scala>valx:Int=5
x:Int=5
scala>valy:Int=2
y:Int=2
scala>
scala> println(f"x % y = ${x % y}%d")
<console>:10:error: percent signs not directly following splicees must be escaped
println(f"x % y = ${x % y}%d")
^
Welcome to Scala2.13.4 (JavaHotSpot(TM) 64-BitServerVM, Java1.8.0_202).
Type in expressions for evaluation. Ortry:help.
scala>valx:Int=5|valy:Int=2|| println(f"x % y = ${x % y}%d")
println(f"x % y = ${x % y}%d")
^On line 4:error: illegal conversion character 'y'
So I expected it to be the same in Scala 3.
The text was updated successfully, but these errors were encountered:
Compiler version
3.0.0-M3
Minimized code
Output
Expectation
On Scala 2.10.2 to the current stable version,
I get a compile error when specifying a single '%' character.
So I expected it to be the same in Scala 3.
The text was updated successfully, but these errors were encountered: