How can I find all of the flags for the latest scalac version? After googling for hours I have found only outdated docs. (for example, they don't even mention "-feature" flag).
Is there any way to obtain the list of compiler flags with descriptions from scalac, or anything else?
Scala compiler scalac offers various compiler options, also referred to as compiler flags, to change how to compile your program. Nowadays, most people are not running scalac from the command line. Instead, they use sbt, an IDE, and other tools as their interface to the compiler.
Scala has both a compiler and an interpreter which can execute Scala code. The Scala compiler compiles your Scala code into Java Byte Code which can then be executed by the scala command. The scala command is similar to the java command, in that it executes your compiled Scala code.
Delegate a Scala project build to sbtIn the sbt projects section, select a project for which you want to configure build actions. In the sbt shell section, select the builds option. Click OK to save the changes. Now when you build your project ( Ctrl+F9 ), the build is run in the sbt shell.
Edit: Documentation for Scala Compiler Options has been posted.
Most of us get by with scalac -help
, scalac -X
and scalac -Y
.
Don't forget to scala -help
, too.
Edit: sbt
user can do the usual:
> set scalacOptions in Compile += "-X" > compile [snip] [info] -Xcheck-null Warn upon selection of nullable reference. [info] -Xcheckinit Wrap field accessors to throw an exception on uninitialized access. [info] -Xdisable-assertions Generate no assertions or assumptions. [info] -Xdivergence211 Turn on the 2.11 behavior of implicit divergence not terminating recursive implicit searches (SI-7291). [info] -Xelide-below <n> Calls to @elidable methods are omitted if method priority is lower than argument [info] -Xexperimental Enable experimental extensions. [info] -Xfatal-warnings Fail the compilation if there are any warnings. [snip]
At least the man page was updated recently:
https://issues.scala-lang.org/browse/SI-7824
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With