Scala online compiler6/9/2023 ![]() Track nullness / non-nullness of local variables and apply optimizations. opt:box-unboxĮliminate box-unbox pairs within the same method (also tuples, xRefs, value class instances). opt:redundant-castsĮliminate redundant casts using a type propagation analysis. opt:copy-propagationĮliminate redundant local variables and unused values (including closures). opt:compact-localsĮliminate empty slots in the sequence of local variables. Simplify branching instructions, eliminate unnecessary ones. opt:OPTIMIZATION1,OPTIMIZATION2Įnable optimizations -opt:unreachable-codeĮliminate unreachable code, exception handlers guarding no instructions, redundant metadata (debug information, line numbers). language:FEATURE1,FEATURE2Įnable or disable language features -language:dynamicsĪllow direct or indirect subclasses of scala.Dynamic -language:existentialsĮxistential types (besides wildcard types) can be written and inferred -language:higherKindsĪllow higher-kinded types -language:implicitConversionsĪllow definition of implicit functions called views -language:postfixOpsĪllow postfix operator notation, such as 1 to 10 toList (not recommended) -language:reflectiveCallsĪllow reflective access to members of structural types -language:experimental.macrosĪllow macro definition (besides implementation and application) -no-specializationĭo not use the boot classpath for the scala jars. Print a synopsis of standard options -javabootclasspath PATH g:none -g:source -g:line -g:vars -g:notailcalls -help featureĮmit warning and location for usages of features that should be imported explicitly. Override location of installed extensions. ![]() Specify character encoding used by source files.Įxplain type errors in more detail. classpath PATHĮmit warning and location for usages of deprecated APIs. Override location of bootstrap class files. Werrorįail the compilation if there are any warnings. Pass flag directly to the runtime system. Pass -Dproperty=value directly to the runtime system. Standard SettingsĪ set of standard options that are supported on the current development environment and will be supported in future releases. Normally the last option will have a trailing comma so that git diff is a bit cleaner when options are added. The convention is always to append to the setting with ++= and to supply one option per line. ScalacOptions ++= Seq ( // use ++= to add to existing options "-encoding", "utf8", // if an option takes an arg, supply it on the same line "-feature", // then put the next option on a new line for easy editing "-language:implicitConversions", "-language:existentials", "-unchecked", "-Werror", "-Xlint", // exploit "trailing comma" syntax so you can add an option without editing this line ) // for "trailing comma", the closing paren must be on the next line How to use compiler options Use compiler options with scalac If Scala is installed as a system command, that documentation may be available from man scalac. The Scala distribution includes a man page. Options may be specified on the command line to scalac or in the configuration of a build tool or IDE. The Scala command scala, which runs scripts or compiled code, accepts the same options as the scalac compiler, plus a few more that determine how to run a program. ![]() Some options just generate more compiler output in the form of diagnostics or warnings, while others change the result of compilation. The Scala compiler scalac offers various compiler options, or flags, that change the compiler’s default behavior. Info: JavaScript is currently disabled, code tabs will still work, In this page assume you are using Scala 2. ![]() Unless otherwise stated, all the code examples Which have either been removed in Scala 3 or replaced by anĪlternative. This doc page is specific to features shipped in Scala 2,
0 Comments
Leave a Reply. |