Have Implicit Conversions via scala.Conversion
been disabled entirely in Scala 3.6?
I’m seeing code that uses conversions and previously worked just fail to compile. The Conversion
is in implicit scope, I can summon
it and manually apply, but seems the compiler just isn’t auto-inserting them. import language.implicitConversions
makes no difference.
I’m confused because such a change would surely break a lot of existing compiler regression tests…?
Once Scastie supports 3.6 I’ll try to post an example.
Any one else tried 3.6 and seen this?
➜ ~ scala-cli repl --server=false -S 3.nightly
Nov 09, 2024 2:10:20 AM org.jline.utils.Log logr
WARNING: The terminal provider jna has been deprecated, check your configuration. This warning can be disabled by setting the system property org.jline.terminal.disableDeprecatedProviderWarning to true.
Welcome to Scala 3.6.3-RC1-bin-20241108-8a3f375-NIGHTLY-git-8a3f375 (22.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> class C; class D
// defined class C
// defined class D
scala> implicit val cv: Conversion[C,D] = _ => D()
val cv: Conversion[C, D] = <function1>
scala> C(): D
there was 1 feature warning; re-run with -feature for details
1 warning found
val res0: D = D@62808e9e
1 Like
Thanks @som-snytt for the reminder that “the compiler is normally right” and to look closer to home for the source of the problem (in my situation, mixing up scala.math.BigDecimal and java.math.BigDecimal )
ha I wouldn’t have guessed that one, but BigDecimal
is definitely one of those unfortunate duplicative namings that keep me guessing. StringBuilder
is another. List
at least will tell me faster if I’ve got them mixed up.
I wonder if IntelliJ can show me Scala and Java defined symbols in different colors.