summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-02-15 16:56:48 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2016-02-16 16:43:34 +0100
commitb7626d998ee415271105450f125c507629b8eae2 (patch)
treefd201d898e7d67dbdabdd116f1f27710718b98d6 /src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
parentce3a8030fa59e5a9082528bf6f1ffc12a9277bc9 (diff)
downloadscala-b7626d998ee415271105450f125c507629b8eae2.tar.gz
scala-b7626d998ee415271105450f125c507629b8eae2.tar.bz2
scala-b7626d998ee415271105450f125c507629b8eae2.zip
Remove -Y settings that are no longer used in 2.12
Added a deprecation warning for `-optimize`. Later we'll also graduate `-Yopt` to `-opt`, probably for 2.12.0-M5.
Diffstat (limited to 'src/compiler/scala/tools/nsc/settings/ScalaSettings.scala')
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala58
1 files changed, 15 insertions, 43 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 1446d22217..c524121646 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -34,9 +34,6 @@ trait ScalaSettings extends AbsScalaSettings
/** Enabled under -Xfuture. */
protected def futureSettings = List[BooleanSetting]()
- /** Enabled under -optimise. */
- def optimiseSettings = List[BooleanSetting](inline, inlineHandlers, Xcloselim, Xdce, YconstOptimization)
-
/** If any of these settings is enabled, the compiler should print a message and exit. */
def infoSettings = List[Setting](version, help, Xhelp, Yhelp, showPlugins, showPhases, genPhaseGraph)
@@ -167,18 +164,10 @@ trait ScalaSettings extends AbsScalaSettings
val browse = PhasesSetting ("-Ybrowse", "Browse the abstract syntax tree after")
val check = PhasesSetting ("-Ycheck", "Check the tree at the end of")
val Yshow = PhasesSetting ("-Yshow", "(Requires -Xshow-class or -Xshow-object) Show after")
- val Xcloselim = BooleanSetting ("-Yclosure-elim", "Perform closure elimination.")
- val YconstOptimization = BooleanSetting ("-Yconst-opt", "Perform optimization with constant values.")
val Ycompacttrees = BooleanSetting ("-Ycompact-trees", "Use compact tree printer when displaying trees.")
val noCompletion = BooleanSetting ("-Yno-completion", "Disable tab-completion in the REPL.")
- val Xdce = BooleanSetting ("-Ydead-code", "Perform dead code elimination.")
val debug = BooleanSetting ("-Ydebug", "Increase the quantity of debugging output.")
- //val doc = BooleanSetting ("-Ydoc", "Generate documentation")
val termConflict = ChoiceSetting ("-Yresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error")
- val inline = BooleanSetting ("-Yinline", "Perform inlining when possible.")
- val inlineHandlers = BooleanSetting ("-Yinline-handlers", "Perform exception handler inlining when possible.")
- val YinlinerWarnings= BooleanSetting ("-Yinline-warnings", "Emit inlining warnings. (Normally suppressed due to high volume)")
- val Xlinearizer = ChoiceSetting ("-Ylinearizer", "which", "Linearizer to use", List("normal", "dfs", "rpo", "dump"), "rpo")
val log = PhasesSetting ("-Ylog", "Log operations during")
val Ylogcp = BooleanSetting ("-Ylog-classpath", "Output information about what classpath is being applied.")
val Ynogenericsig = BooleanSetting ("-Yno-generic-signatures", "Suppress generation of generic signatures for Java.")
@@ -195,7 +184,6 @@ trait ScalaSettings extends AbsScalaSettings
val Yshowsymkinds = BooleanSetting ("-Yshow-symkinds", "Print abbreviated symbol kinds next to symbol names.")
val Yshowsymowners = BooleanSetting ("-Yshow-symowners", "Print owner identifiers next to symbol names.")
val skip = PhasesSetting ("-Yskip", "Skip")
- val Ygenjavap = StringSetting ("-Ygen-javap", "dir", "Generate a parallel output directory of .javap files.", "")
val Ygenasmp = StringSetting ("-Ygen-asmp", "dir", "Generate a parallel output directory of .asmp files (ie ASM Textifier output).", "")
val Ydumpclasses = StringSetting ("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "")
val stopAfter = PhasesSetting ("-Ystop-after", "Stop after") withAbbreviation ("-stop") // backward compat
@@ -214,10 +202,6 @@ trait ScalaSettings extends AbsScalaSettings
val YclasspathImpl = ChoiceSetting ("-YclasspathImpl", "implementation", "Choose classpath scanning method.", List(ClassPathRepresentationType.Recursive, ClassPathRepresentationType.Flat), ClassPathRepresentationType.Recursive)
val YdisableFlatCpCaching = BooleanSetting ("-YdisableFlatCpCaching", "Do not cache flat classpath representation of classpath elements from jars across compiler instances.")
- val YvirtClasses = false // too embryonic to even expose as a -Y //BooleanSetting ("-Yvirtual-classes", "Support virtual classes")
- val YdisableUnreachablePrevention = BooleanSetting("-Ydisable-unreachable-prevention", "Disable the prevention of unreachable blocks in code generation.")
- val YnoLoadImplClass = BooleanSetting ("-Yno-load-impl-class", "Do not load $class.class files.")
-
val exposeEmptyPackage = BooleanSetting ("-Yexpose-empty-package", "Internal only: expose the empty package.").internalOnly()
val Ydelambdafy = ChoiceSetting ("-Ydelambdafy", "strategy", "Strategy used for translating lambdas into JVM code.", List("inline", "method"), "method")
@@ -304,10 +288,9 @@ trait ScalaSettings extends AbsScalaSettings
helpArg = "warning",
descr = "Enable optimizer warnings",
domain = YoptWarningsChoices,
- default = Some(List(YoptWarningsChoices.atInlineFailed.name))) withPostSetHook (self => {
- if (self.value subsetOf Set(YoptWarningsChoices.none, YoptWarningsChoices.atInlineFailedSummary)) YinlinerWarnings.value = false
- else YinlinerWarnings.value = true
- })
+ default = Some(List(YoptWarningsChoices.atInlineFailed.name)))
+
+ def YoptWarningsSummaryOnly = YoptWarnings.value subsetOf Set(YoptWarningsChoices.none, YoptWarningsChoices.atInlineFailedSummary)
def YoptWarningEmitAtInlineFailed =
!YoptWarnings.isSetByUser ||
@@ -352,22 +335,15 @@ trait ScalaSettings extends AbsScalaSettings
str => Some(if(str.equalsIgnoreCase("off")) Int.MaxValue else str.toInt))
val Yquasiquotedebug = BooleanSetting("-Yquasiquote-debug", "Trace quasiquote-related activities.")
- // TODO 2.12 Remove
- val Yinferdebug = BooleanSetting("-Yinfer-debug", "Trace type inference and implicit search.") withDeprecationMessage("Use -Ytyper-debug") enabling(List(Ytyperdebug))
-
/** Groups of Settings.
*/
val future = BooleanSetting("-Xfuture", "Turn on future language features.") enablingIfNotSetByUser futureSettings
- val optimise = BooleanSetting("-optimise", "Generates faster bytecode by applying optimisations to the program") withAbbreviation "-optimize" enablingIfNotSetByUser optimiseSettings
- val nooptimise = BooleanSetting("-Ynooptimise", "Clears all the flags set by -optimise. Useful for testing optimizations in isolation.") withAbbreviation "-Ynooptimize" disabling optimise::optimiseSettings
+ val optimise = BooleanSetting("-optimise", "Compiler flag for the optimizer in Scala 2.11")
+ .withAbbreviation("-optimize")
+ .withDeprecationMessage("In 2.12, -optimise enables -Yopt:l:classpath. Check -Yopt:help for using the Scala 2.12 optimizer.")
+ .withPostSetHook(_ => Yopt.tryToSet(List(YoptChoices.lClasspath.name)))
val Xexperimental = BooleanSetting("-Xexperimental", "Enable experimental extensions.") enablingIfNotSetByUser experimentalSettings
- /**
- * Settings motivated by GenBCode
- */
- val Ybackend = ChoiceSetting ("-Ybackend", "choice of bytecode emitter", "Choice of bytecode emitter.",
- List("GenBCode"),
- "GenBCode")
// Feature extensions
val XmacroSettings = MultiStringSetting("-Xmacro-settings", "option", "Custom settings for macros.")
@@ -391,8 +367,6 @@ trait ScalaSettings extends AbsScalaSettings
/** Test whether this is scaladoc we're looking at */
def isScaladoc = false
- def isBCodeActive = Ybackend.value == "GenBCode"
-
object MacroExpand {
val None = "none"
val Normal = "normal"
@@ -400,20 +374,18 @@ trait ScalaSettings extends AbsScalaSettings
}
def conflictWarning: Option[String] = {
- def oldOptimiseFlagsInGenBCode: Option[String] = {
- val optFlags: List[Setting] = if (optimise.value) List(optimise) else optimiseSettings.filter(_.value)
- if (isBCodeActive && optFlags.nonEmpty) {
- val msg = s"""Compiler settings for the 2.11 optimizer (${optFlags.map(_.name).mkString(", ")}) are incompatible with -Ybackend:GenBCode (which is the default in 2.12).
- |The optimizer settings are ignored. See -Yopt:help for enabling the new optimizer in 2.12.""".stripMargin
- Some(msg)
- } else
- None
- }
+ // See cd878232b5 for an example how to warn about conflicting settings
- List(oldOptimiseFlagsInGenBCode /*, moreToCome */).flatten match {
+ /*
+ def checkSomeConflict: Option[String] = ...
+
+ List(/* checkSomeConflict, ... */).flatten match {
case Nil => None
case warnings => Some("Conflicting compiler settings were detected. Some settings will be ignored.\n" + warnings.mkString("\n"))
}
+ */
+
+ None
}
}