-quickfix compiler option to rewrite source files

Work is in progress on both Scala 2 and 3 for the compilers to provide “quick fixes” with warnings and errors (Roadmap for actionable diagnostics).

While mainly intended for IDEs, it can also be practical to make the compiler directly apply quick fixes to source files. For example, when enabling -Xsource:3 in Scala 2 for migrating a codebase, the compiler can perform some rewrites automatically.

I implemented a corresponding -quickfix compiler option for Scala 2, please provide feedback on the PR: scala/scala#10482.

5 Likes

I am a fan of the scala 3 -rewrite.

I also like -quickfix as an option name, but I might prefer -rerytz as a pun on “rewrites”.

I picked a different name to avoid the confusion of having the same compiler option mean different things on 2 and 3.

             -rewrite  When used in conjunction with a `...-migration` source
                       version, rewrites sources to migrate to new version.
2 Likes