I have a Play framework application that I'm upgrading to Scala3. While migrating my compile flags I've encountered an issue that I've been unable to resolve by reading the docs.
With the flag combination -Wunused:imports -Werror
I get fatal warnings on unused imports. The problem is that in Play framework this gives false positives for the routes file and twirl-templates. In Scala2 i added -Wconf:src=target/.*:s
which resolved this issue for me.
When running the same configuration I was alerted to the fact that src
is not a valid -Wconf
filter in Scala3. The other available filters do not seem to help me in the case.
How can I accomplish the same result in Scala3?
Indeed, as stated in the migration guide:
The configuration string for
-Wconf
will likely require adjustment when migrating to Scala 3, since the configuration syntax and the error messages it matches are different.
Unfortunately from a quick look I cannot find what the configuration syntax is, so I guess the only thing possible right now is to look at the code.
After some digging, it appears that the src
filter in -Wconf
has not been ported yet, although there is an open PR that adds support for it. With some luck, it could be re-introduced in Scala 3 soon.
Sources:
While you are waiting for this feature to land, one possibility might be for you to create a separate sbt subproject for those files, using a slightly different compiler configuration.