Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find a description of scala compiler flags/options?

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?

like image 851
Jeriho Avatar asked Sep 03 '13 20:09

Jeriho


People also ask

What is the name of Scala compiler?

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.

How does Scala compiler work?

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.

How do I compile and run a Scala program?

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.


1 Answers

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

like image 193
som-snytt Avatar answered Sep 23 '22 09:09

som-snytt