So, there have been some discussions and angry tweets recently about irritating Scala "features" (like value discarding and auto-tupling) that can actually be turned off by selecting the right compiler flag in conjunction with -Xfatal-warnings
. I highly recommend a set of options something like those below.
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8", // yes, this is 2 args
"-feature",
"-language:existentials",
"-language:experimental.macros",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-all",
"-Ywarn-dead-code", // N.B. doesn't work well with the ??? hole
"-Ywarn-numeric-widen",
"-Ywarn-value-discard"
)
I also recommend keeping an eye on warteremover which casts a wider net and disables many other unsafe features such as null
and return
. If you try it out and find it's hitting false positives (generally with synthetic code) please file a bug report. We're working on it!
UPDATE - Sukant Hajra has more energy than I do and finally got to the bottom of the -Xlint
and -Ywarn-all
flags and found that although they are not the same from version to version, they are identical, which is probably a copy/paste bug. Here's the relevant code from 2.9.3 and 2.10.3 if you want to see for yourself.