I’m working on a library that cross-compiles to Scala 2.11 and 2.12 (as well as 2.13 in the not too distant future). This can be a frustrating experience at times. Recently I had a problem where I wanted to use Scala 2.12 functionality (specifically, overriding an
apply method of a case class, which works fine in 2.12 but gives ambiguity errors in 2.11). After some fiddling I found out I could add a flag to the compiler:
Xsource:2.12. What does this flag really do?
The documentation says:
Treat compiler input as Scala source for the specified version, see SI-8126
This doesn’t mean much to me. Does it mean that the compiler treats all my source as Scala 2.12 but compiles it to 2.11 JVM bytecode? Are there any downsides to adding this compiler flag?