summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorFrançois Garillot <francois@garillot.net>2013-12-19 15:15:07 +0100
committerFrançois Garillot <francois@garillot.net>2014-01-16 11:42:42 +0100
commitd43618a92cef21f4d4bb921b61d319eb358eae29 (patch)
treed10d6d7db0fb35f7d13606beb5fdd86eb7fd8ae6 /src/compiler
parent681308a3aa737be1dae0f702fddadce88c70f90e (diff)
downloadscala-d43618a92cef21f4d4bb921b61d319eb358eae29.tar.gz
scala-d43618a92cef21f4d4bb921b61d319eb358eae29.tar.bz2
scala-d43618a92cef21f4d4bb921b61d319eb358eae29.zip
SI-8126 Add a '-Xsource' flag allowing compilation in e.g. 2.10 mode
This is aimed at letting the 2.11+ compiler operate, at least until phase:typer, on a 2.10 codebase.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala79
1 files changed, 43 insertions, 36 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 6ec364bcb6..307f42c0bc 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -73,48 +73,55 @@ trait ScalaSettings extends AbsScalaSettings
val nospecialization = BooleanSetting ("-no-specialization", "Ignore @specialize annotations.")
val language = MultiStringSetting("-language", "feature", "Enable one or more language features.")
+ /*
+ * The previous "-source" option is intended to be used mainly
+ * though this helper.
+ */
+ lazy val isScala211: Boolean = (source.value >= ScalaVersion("2.11.0"))
+
/**
* -X "Advanced" settings
*/
- val Xhelp = BooleanSetting ("-X", "Print a synopsis of advanced options.")
- val checkInit = BooleanSetting ("-Xcheckinit", "Wrap field accessors to throw an exception on uninitialized access.")
- val developer = BooleanSetting ("-Xdev", "Indicates user is a developer - issue warnings about anything which seems amiss")
- val noassertions = BooleanSetting ("-Xdisable-assertions", "Generate no assertions or assumptions.")
- val elidebelow = IntSetting ("-Xelide-below", "Calls to @elidable methods are omitted if method priority is lower than argument",
+ val Xhelp = BooleanSetting ("-X", "Print a synopsis of advanced options.")
+ val checkInit = BooleanSetting ("-Xcheckinit", "Wrap field accessors to throw an exception on uninitialized access.")
+ val developer = BooleanSetting ("-Xdev", "Indicates user is a developer - issue warnings about anything which seems amiss")
+ val noassertions = BooleanSetting ("-Xdisable-assertions", "Generate no assertions or assumptions.")
+ val elidebelow = IntSetting ("-Xelide-below", "Calls to @elidable methods are omitted if method priority is lower than argument",
elidable.MINIMUM, None, elidable.byName get _)
- val noForwarders = BooleanSetting ("-Xno-forwarders", "Do not generate static forwarders in mirror classes.")
- val genPhaseGraph = StringSetting ("-Xgenerate-phase-graph", "file", "Generate the phase graphs (outputs .dot files) to fileX.dot.", "")
- val XlogImplicits = BooleanSetting ("-Xlog-implicits", "Show more detail on why some implicits are not applicable.")
- val logImplicitConv = BooleanSetting ("-Xlog-implicit-conversions", "Print a message whenever an implicit conversion is inserted.")
- val logReflectiveCalls = BooleanSetting("-Xlog-reflective-calls", "Print a message when a reflective method call is generated")
- val logFreeTerms = BooleanSetting ("-Xlog-free-terms", "Print a message when reification creates a free term.")
- val logFreeTypes = BooleanSetting ("-Xlog-free-types", "Print a message when reification resorts to generating a free type.")
- val maxClassfileName = IntSetting ("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, Some((72, 255)), _ => None)
- val Xmigration = ScalaVersionSetting("-Xmigration", "version", "Warn about constructs whose behavior may have changed since version.", AnyScalaVersion)
- val nouescape = BooleanSetting ("-Xno-uescape", "Disable handling of \\u unicode escapes.")
- val Xnojline = BooleanSetting ("-Xnojline", "Do not use JLine for editing.")
- val Xverify = BooleanSetting ("-Xverify", "Verify generic signatures in generated bytecode (asm backend only.)")
- val plugin = MultiStringSetting("-Xplugin", "paths", "Load a plugin from each classpath.")
- val disable = MultiStringSetting("-Xplugin-disable", "plugin", "Disable plugins by name.")
- val showPlugins = BooleanSetting ("-Xplugin-list", "Print a synopsis of loaded plugins.")
- val require = MultiStringSetting("-Xplugin-require", "plugin", "Abort if a named plugin is not loaded.")
- val pluginsDir = StringSetting ("-Xpluginsdir", "path", "Path to search for plugin archives.", Defaults.scalaPluginPath)
- val Xprint = PhasesSetting ("-Xprint", "Print out program after")
- val writeICode = PhasesSetting ("-Xprint-icode", "Log internal icode to *.icode files after", "icode")
- val Xprintpos = BooleanSetting ("-Xprint-pos", "Print tree positions, as offsets.")
- val printtypes = BooleanSetting ("-Xprint-types", "Print tree types (debugging option).")
- val prompt = BooleanSetting ("-Xprompt", "Display a prompt after each error (debugging option).")
- val resident = BooleanSetting ("-Xresident", "Compiler stays resident: read source filenames from standard input.")
- val script = StringSetting ("-Xscript", "object", "Treat the source file as a script and wrap it in a main method.", "")
- val mainClass = StringSetting ("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d <jar>)", "")
- val Xshowcls = StringSetting ("-Xshow-class", "class", "Show internal representation of class.", "")
- val Xshowobj = StringSetting ("-Xshow-object", "object", "Show internal representation of object.", "")
- val showPhases = BooleanSetting ("-Xshow-phases", "Print a synopsis of compiler phases.")
- val sourceReader = StringSetting ("-Xsource-reader", "classname", "Specify a custom method for reading source files.", "")
- val strictInference = BooleanSetting ("-Xstrict-inference", "Don't infer known-unsound types")
+ val noForwarders = BooleanSetting ("-Xno-forwarders", "Do not generate static forwarders in mirror classes.")
+ val genPhaseGraph = StringSetting ("-Xgenerate-phase-graph", "file", "Generate the phase graphs (outputs .dot files) to fileX.dot.", "")
+ val XlogImplicits = BooleanSetting ("-Xlog-implicits", "Show more detail on why some implicits are not applicable.")
+ val logImplicitConv = BooleanSetting ("-Xlog-implicit-conversions", "Print a message whenever an implicit conversion is inserted.")
+ val logReflectiveCalls = BooleanSetting ("-Xlog-reflective-calls", "Print a message when a reflective method call is generated")
+ val logFreeTerms = BooleanSetting ("-Xlog-free-terms", "Print a message when reification creates a free term.")
+ val logFreeTypes = BooleanSetting ("-Xlog-free-types", "Print a message when reification resorts to generating a free type.")
+ val maxClassfileName = IntSetting ("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, Some((72, 255)), _ => None)
+ val Xmigration = ScalaVersionSetting ("-Xmigration", "version", "Warn about constructs whose behavior may have changed since version.", AnyScalaVersion)
+ val nouescape = BooleanSetting ("-Xno-uescape", "Disable handling of \\u unicode escapes.")
+ val Xnojline = BooleanSetting ("-Xnojline", "Do not use JLine for editing.")
+ val Xverify = BooleanSetting ("-Xverify", "Verify generic signatures in generated bytecode (asm backend only.)")
+ val plugin = MultiStringSetting ("-Xplugin", "paths", "Load a plugin from each classpath.")
+ val disable = MultiStringSetting ("-Xplugin-disable", "plugin", "Disable plugins by name.")
+ val showPlugins = BooleanSetting ("-Xplugin-list", "Print a synopsis of loaded plugins.")
+ val require = MultiStringSetting ("-Xplugin-require", "plugin", "Abort if a named plugin is not loaded.")
+ val pluginsDir = StringSetting ("-Xpluginsdir", "path", "Path to search for plugin archives.", Defaults.scalaPluginPath)
+ val Xprint = PhasesSetting ("-Xprint", "Print out program after")
+ val writeICode = PhasesSetting ("-Xprint-icode", "Log internal icode to *.icode files after", "icode")
+ val Xprintpos = BooleanSetting ("-Xprint-pos", "Print tree positions, as offsets.")
+ val printtypes = BooleanSetting ("-Xprint-types", "Print tree types (debugging option).")
+ val prompt = BooleanSetting ("-Xprompt", "Display a prompt after each error (debugging option).")
+ val resident = BooleanSetting ("-Xresident", "Compiler stays resident: read source filenames from standard input.")
+ val script = StringSetting ("-Xscript", "object", "Treat the source file as a script and wrap it in a main method.", "")
+ val mainClass = StringSetting ("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d <jar>)", "")
+ val Xshowcls = StringSetting ("-Xshow-class", "class", "Show internal representation of class.", "")
+ val Xshowobj = StringSetting ("-Xshow-object", "object", "Show internal representation of object.", "")
+ val showPhases = BooleanSetting ("-Xshow-phases", "Print a synopsis of compiler phases.")
+ val sourceReader = StringSetting ("-Xsource-reader", "classname", "Specify a custom method for reading source files.", "")
+ val strictInference = BooleanSetting ("-Xstrict-inference", "Don't infer known-unsound types")
+ val source = ScalaVersionSetting ("-Xsource", "version", "Treat compiler input as Scala source for the specified version, see SI-8126.", ScalaVersion("2.11")) withPostSetHook ( _ => isScala211)
val XnoPatmatAnalysis = BooleanSetting ("-Xno-patmat-analysis", "Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation.")
- val XfullLubs = BooleanSetting ("-Xfull-lubs", "Retains pre 2.10 behavior of less aggressive truncation of least upper bounds.")
+ val XfullLubs = BooleanSetting ("-Xfull-lubs", "Retains pre 2.10 behavior of less aggressive truncation of least upper bounds.")
/** Compatibility stubs for options whose value name did
* not previously match the option name.