From ce3a8030fa59e5a9082528bf6f1ffc12a9277bc9 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 15 Feb 2016 21:58:22 +0100 Subject: Rewrite a few more tests to the new optimizer --- test/files/neg/sealed-final-neg.flags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/files/neg') diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags index 01bd79154a..673aca8931 100644 --- a/test/files/neg/sealed-final-neg.flags +++ b/test/files/neg/sealed-final-neg.flags @@ -1 +1 @@ --Xfatal-warnings -Yopt:l:project -Yinline-warnings \ No newline at end of file +-Xfatal-warnings -Yopt:l:project -Yopt-warnings \ No newline at end of file -- cgit v1.2.3 From b7626d998ee415271105450f125c507629b8eae2 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 15 Feb 2016 16:56:48 +0100 Subject: 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. --- project/ScalaOptionParser.scala | 12 ++--- src/compiler/scala/tools/nsc/Reporting.scala | 19 ++++--- .../scala/tools/nsc/ast/parser/Parsers.scala | 5 -- .../scala/tools/nsc/backend/jvm/BCodeHelpers.scala | 5 +- .../scala/tools/nsc/settings/FscSettings.scala | 4 +- .../scala/tools/nsc/settings/ScalaSettings.scala | 58 ++++++---------------- .../scala/tools/nsc/transform/CleanUp.scala | 18 ++----- .../scala/tools/nsc/transform/Delambdafy.scala | 4 +- .../scala/tools/nsc/transform/LambdaLift.scala | 5 +- .../scala/tools/nsc/transform/UnCurry.scala | 5 +- src/compiler/scala/tools/util/PathResolver.scala | 11 +--- test/files/neg/case-collision2.flags | 2 +- test/files/neg/incompatibleSettings.check | 6 --- test/files/neg/incompatibleSettings.flags | 1 - test/files/neg/incompatibleSettings.scala | 1 - test/files/neg/inlineMaxSize.flags | 2 +- test/files/neg/optimiseDeprecated.check | 4 ++ test/files/neg/optimiseDeprecated.flags | 1 + test/files/neg/optimiseDeprecated.scala | 1 + test/files/pos/t9111-inliner-workaround.flags | 2 +- test/files/run/bcodeInlinerMixed.flags | 2 +- test/files/run/nothingTypeDce.flags | 2 +- test/files/run/nothingTypeDce.scala | 2 +- test/files/run/nothingTypeNoOpt.flags | 2 +- test/files/run/nothingTypeNoOpt.scala | 2 +- test/files/run/t3452b-bcode.check | 2 - test/files/run/t3452b-bcode.flags | 1 - test/files/run/t3452b-bcode/J_2.java | 6 --- test/files/run/t3452b-bcode/S_1.scala | 17 ------- test/files/run/t3452b-bcode/S_3.scala | 5 -- test/files/run/t7407.flags | 2 +- test/files/run/t7407b.flags | 1 - test/files/run/t8233-bcode.flags | 1 - test/files/run/t8233-bcode.scala | 31 ------------ test/files/run/t8845.flags | 1 - test/files/run/t8925.flags | 2 +- test/files/run/t9097.scala | 1 - .../junit/scala/issues/OptimizedBytecodeTest.scala | 7 +++ .../scala/tools/nsc/backend/jvm/BTypesTest.scala | 2 +- .../tools/nsc/backend/jvm/DefaultMethodTest.scala | 2 +- .../tools/nsc/backend/jvm/DirectCompileTest.scala | 2 +- .../tools/nsc/backend/jvm/IndyLambdaTest.scala | 2 +- .../jvm/analysis/NullnessAnalyzerTest.scala | 2 +- .../jvm/analysis/ProdConsAnalyzerTest.scala | 2 +- .../backend/jvm/opt/BTypesFromClassfileTest.scala | 2 +- .../tools/nsc/backend/jvm/opt/CallGraphTest.scala | 2 +- .../jvm/opt/CompactLocalVariablesTest.scala | 4 +- .../jvm/opt/EmptyExceptionHandlersTest.scala | 4 +- .../tools/nsc/backend/jvm/opt/InlineInfoTest.scala | 2 +- .../nsc/backend/jvm/opt/InlineWarningTest.scala | 2 +- .../backend/jvm/opt/InlinerIllegalAccessTest.scala | 2 +- .../jvm/opt/InlinerSeparateCompilationTest.scala | 2 +- .../nsc/backend/jvm/opt/ScalaInlineInfoTest.scala | 2 +- .../nsc/backend/jvm/opt/UnreachableCodeTest.scala | 6 +-- .../backend/jvm/opt/UnusedLocalVariablesTest.scala | 2 +- .../scala/tools/nsc/settings/SettingsTest.scala | 10 ++-- .../nsc/transform/delambdafy/DelambdafyTest.scala | 4 +- 57 files changed, 92 insertions(+), 217 deletions(-) delete mode 100644 test/files/neg/incompatibleSettings.check delete mode 100644 test/files/neg/incompatibleSettings.flags delete mode 100644 test/files/neg/incompatibleSettings.scala create mode 100644 test/files/neg/optimiseDeprecated.check create mode 100644 test/files/neg/optimiseDeprecated.flags create mode 100644 test/files/neg/optimiseDeprecated.scala delete mode 100644 test/files/run/t3452b-bcode.check delete mode 100644 test/files/run/t3452b-bcode.flags delete mode 100644 test/files/run/t3452b-bcode/J_2.java delete mode 100644 test/files/run/t3452b-bcode/S_1.scala delete mode 100644 test/files/run/t3452b-bcode/S_3.scala delete mode 100644 test/files/run/t7407b.flags delete mode 100644 test/files/run/t8233-bcode.flags delete mode 100644 test/files/run/t8233-bcode.scala delete mode 100644 test/files/run/t8845.flags (limited to 'test/files/neg') diff --git a/project/ScalaOptionParser.scala b/project/ScalaOptionParser.scala index da8a3bf460..08a1de2e22 100644 --- a/project/ScalaOptionParser.scala +++ b/project/ScalaOptionParser.scala @@ -82,27 +82,25 @@ object ScalaOptionParser { // TODO retrieve this data programatically, ala https://github.com/scala/scala-tool-support/blob/master/bash-completion/src/main/scala/BashCompletion.scala private def booleanSettingNames = List("-X", "-Xcheckinit", "-Xdev", "-Xdisable-assertions", "-Xexperimental", "-Xfatal-warnings", "-Xfull-lubs", "-Xfuture", "-Xlog-free-terms", "-Xlog-free-types", "-Xlog-implicit-conversions", "-Xlog-implicits", "-Xlog-reflective-calls", "-Xno-forwarders", "-Xno-patmat-analysis", "-Xno-uescape", "-Xnojline", "-Xprint-pos", "-Xprint-types", "-Xprompt", "-Xresident", "-Xshow-phases", "-Xstrict-inference", "-Xverify", "-Y", - "-Ybreak-cycles", "-Yclosure-elim", "-Yconst-opt", "-Ydead-code", "-Ydebug", "-Ycompact-trees", "-Ydisable-unreachable-prevention", "-YdisableFlatCpCaching", "-Ydoc-debug", - "-Yeta-expand-keeps-star", "-Yide-debug", "-Yinfer-argument-types", "-Yinfer-by-name", "-Yinfer-debug", "-Yinline", "-Yinline-handlers", - "-Yinline-warnings", "-Yissue-debug", "-Ylog-classpath", "-Ymacro-debug-lite", "-Ymacro-debug-verbose", "-Ymacro-no-expand", - "-Yno-completion", "-Yno-generic-signatures", "-Yno-imports", "-Yno-load-impl-class", "-Yno-predef", "-Ynooptimise", + "-Ybreak-cycles", "-Ydebug", "-Ycompact-trees", "-YdisableFlatCpCaching", "-Ydoc-debug", + "-Yeta-expand-keeps-star", "-Yide-debug", "-Yinfer-argument-types", "-Yinfer-by-name", + "-Yissue-debug", "-Ylog-classpath", "-Ymacro-debug-lite", "-Ymacro-debug-verbose", "-Ymacro-no-expand", + "-Yno-completion", "-Yno-generic-signatures", "-Yno-imports", "-Yno-predef", "-Yoverride-objects", "-Yoverride-vars", "-Ypatmat-debug", "-Yno-adapted-args", "-Ypos-debug", "-Ypresentation-debug", "-Ypresentation-strict", "-Ypresentation-verbose", "-Yquasiquote-debug", "-Yrangepos", "-Yreify-copypaste", "-Yreify-debug", "-Yrepl-class-based", "-Yrepl-sync", "-Yshow-member-pos", "-Yshow-symkinds", "-Yshow-symowners", "-Yshow-syms", "-Yshow-trees", "-Yshow-trees-compact", "-Yshow-trees-stringified", "-Ytyper-debug", "-Ywarn-adapted-args", "-Ywarn-dead-code", "-Ywarn-inaccessible", "-Ywarn-infer-any", "-Ywarn-nullary-override", "-Ywarn-nullary-unit", "-Ywarn-numeric-widen", "-Ywarn-unused", "-Ywarn-unused-import", "-Ywarn-value-discard", "-deprecation", "-explaintypes", "-feature", "-help", "-no-specialization", "-nobootcp", "-nowarn", "-optimise", "-print", "-unchecked", "-uniqid", "-usejavacp", "-usemanifestcp", "-verbose", "-version") private def stringSettingNames = List("-Xgenerate-phase-graph", "-Xmain-class", "-Xpluginsdir", "-Xshow-class", "-Xshow-object", "-Xsource-reader", "-Ydump-classes", "-Ygen-asmp", - "-Ygen-javap", "-Ypresentation-log", "-Ypresentation-replay", "-Yrepl-outdir", "-d", "-dependencyfile", "-encoding", "-Xscript") + "-Ypresentation-log", "-Ypresentation-replay", "-Yrepl-outdir", "-d", "-dependencyfile", "-encoding", "-Xscript") private def pathSettingNames = List("-bootclasspath", "-classpath", "-extdirs", "-javabootclasspath", "-javaextdirs", "-sourcepath", "-toolcp") private val phases = List("all", "parser", "namer", "packageobjects", "typer", "patmat", "superaccessors", "extmethods", "pickler", "refchecks", "uncurry", "tailcalls", "specialize", "explicitouter", "erasure", "posterasure", "lazyvals", "lambdalift", "constructors", "flatten", "mixin", "cleanup", "delambdafy", "icode", "jvm", "terminal") private val phaseSettings = List("-Xprint-icode", "-Ystop-after", "-Yskip", "-Yshow", "-Ystop-before", "-Ybrowse", "-Ylog", "-Ycheck", "-Xprint") private def multiStringSettingNames = List("-Xmacro-settings", "-Xplugin", "-Xplugin-disable", "-Xplugin-require") private def intSettingNames = List("-Xmax-classfile-name", "-Xelide-below", "-Ypatmat-exhaust-depth", "-Ypresentation-delay", "-Yrecursion") private def choiceSettingNames = Map[String, List[String]]( - "-Ybackend" -> List("GenASM", "GenBCode"), "-YclasspathImpl" -> List("flat", "recursive"), "-Ydelambdafy" -> List("inline", "method"), - "-Ylinearizer" -> List("dfs", "dump", "normal", "rpo"), "-Ymacro-expand" -> List("discard", "none"), "-Yresolve-term-conflict" -> List("error", "object", "package"), "-g" -> List("line", "none", "notailcails", "source", "vars"), diff --git a/src/compiler/scala/tools/nsc/Reporting.scala b/src/compiler/scala/tools/nsc/Reporting.scala index e11cba466e..5bdbf4bb6a 100644 --- a/src/compiler/scala/tools/nsc/Reporting.scala +++ b/src/compiler/scala/tools/nsc/Reporting.scala @@ -26,27 +26,30 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w protected def PerRunReporting = new PerRunReporting class PerRunReporting extends PerRunReportingBase { /** Collects for certain classes of warnings during this run. */ - private class ConditionalWarning(what: String, option: Settings#BooleanSetting)(reRunFlag: String = option.name) { + private class ConditionalWarning(what: String, doReport: () => Boolean, setting: Settings#Setting) { + def this(what: String, booleanSetting: Settings#BooleanSetting) { + this(what, () => booleanSetting, booleanSetting) + } val warnings = mutable.LinkedHashMap[Position, String]() def warn(pos: Position, msg: String) = - if (option) reporter.warning(pos, msg) + if (doReport()) reporter.warning(pos, msg) else if (!(warnings contains pos)) warnings += ((pos, msg)) def summarize() = - if (warnings.nonEmpty && (option.isDefault || option)) { + if (warnings.nonEmpty && (setting.isDefault || doReport())) { val numWarnings = warnings.size val warningVerb = if (numWarnings == 1) "was" else "were" val warningCount = countElementsAsString(numWarnings, s"$what warning") - reporter.warning(NoPosition, s"there $warningVerb $warningCount; re-run with $reRunFlag for details") + reporter.warning(NoPosition, s"there $warningVerb $warningCount; re-run with ${setting.name} for details") } } // This change broke sbt; I gave it the thrilling name of uncheckedWarnings0 so // as to recover uncheckedWarnings for its ever-fragile compiler interface. - private val _deprecationWarnings = new ConditionalWarning("deprecation", settings.deprecation)() - private val _uncheckedWarnings = new ConditionalWarning("unchecked", settings.unchecked)() - private val _featureWarnings = new ConditionalWarning("feature", settings.feature)() - private val _inlinerWarnings = new ConditionalWarning("inliner", settings.YinlinerWarnings)(if (settings.isBCodeActive) settings.YoptWarnings.name else settings.YinlinerWarnings.name) + private val _deprecationWarnings = new ConditionalWarning("deprecation", settings.deprecation) + private val _uncheckedWarnings = new ConditionalWarning("unchecked", settings.unchecked) + private val _featureWarnings = new ConditionalWarning("feature", settings.feature) + private val _inlinerWarnings = new ConditionalWarning("inliner", () => !settings.YoptWarningsSummaryOnly, settings.YoptWarnings) private val _allConditionalWarnings = List(_deprecationWarnings, _uncheckedWarnings, _featureWarnings, _inlinerWarnings) // TODO: remove in favor of the overload that takes a Symbol, give that argument a default (NoSymbol) diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 831a0412cd..d4715471f6 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2811,11 +2811,6 @@ self => if (mods.isTrait) (Modifiers(Flags.TRAIT), List()) else (accessModifierOpt(), paramClauses(name, classContextBounds, ofCaseClass = mods.isCase)) var mods1 = mods - if (mods.isTrait) { - if (settings.YvirtClasses && in.token == SUBTYPE) mods1 |= Flags.DEFERRED - } else if (in.token == SUBTYPE) { - syntaxError("classes are not allowed to be virtual", skipIt = false) - } val template = templateOpt(mods1, name, constrMods withAnnotations constrAnnots, vparamss, tstart) val result = gen.mkClassDef(mods1, name, tparams, template) // Context bounds generate implicit parameters (part of the template) with types diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index f423f3c7fe..2698225a06 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -60,10 +60,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { def isAnonymousOrLocalClass(classSym: Symbol): Boolean = { assert(classSym.isClass, s"not a class: $classSym") val r = exitingPickler(classSym.isAnonymousClass) || !classSym.originalOwner.isClass - if (r && settings.Ybackend.value == "GenBCode") { - // this assertion only holds in GenBCode. lambda lift renames symbols and may accidentally - // introduce `$lambda` into a class name, making `isDelambdafyFunction` true. under GenBCode - // we prevent this, see `nonAnon` in LambdaLift. + if (r) { // phase travel necessary: after flatten, the name includes the name of outer classes. // if some outer name contains $lambda, a non-lambda class is considered lambda. assert(exitingPickler(!classSym.isDelambdafyFunction), classSym.name) diff --git a/src/compiler/scala/tools/nsc/settings/FscSettings.scala b/src/compiler/scala/tools/nsc/settings/FscSettings.scala index fffbb4333f..d6013e0b00 100644 --- a/src/compiler/scala/tools/nsc/settings/FscSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/FscSettings.scala @@ -37,9 +37,7 @@ class FscSettings(error: String => Unit) extends Settings(error) { /** If a setting (other than a PathSetting) represents a path or paths. * For use in absolutization. */ - private def holdsPath = Set[Settings#Setting]( - d, dependencyfile, pluginsDir, Ygenjavap - ) + private def holdsPath = Set[Settings#Setting](d, dependencyfile, pluginsDir) override def processArguments(arguments: List[String], processAll: Boolean): (Boolean, List[String]) = { val (r, args) = super.processArguments(arguments, processAll) 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 } } diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index 112dedce81..0fb6213d36 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -21,16 +21,8 @@ abstract class CleanUp extends Statics with Transform with ast.TreeDSL { val phaseName: String = "cleanup" /* used in GenBCode: collects ClassDef symbols owning a main(Array[String]) method */ - private var entryPoints: List[Symbol] = null - def getEntryPoints: List[Symbol] = { - assert(settings.isBCodeActive, "Candidate Java entry points are collected here only when GenBCode in use.") - entryPoints sortBy ("" + _.fullName) // For predictably ordered error messages. - } - - override def newPhase(prev: scala.tools.nsc.Phase): StdPhase = { - entryPoints = if (settings.isBCodeActive) Nil else null; - super.newPhase(prev) - } + private var entryPoints: List[Symbol] = Nil + def getEntryPoints: List[Symbol] = entryPoints sortBy ("" + _.fullName) // For predictably ordered error messages. protected def newTransformer(unit: CompilationUnit): Transformer = new CleanUpTransformer(unit) @@ -378,11 +370,7 @@ abstract class CleanUp extends Statics with Transform with ast.TreeDSL { } override def transform(tree: Tree): Tree = tree match { - - case _: ClassDef - if (entryPoints != null) && - genBCode.isJavaEntryPoint(tree.symbol, currentUnit) - => + case _: ClassDef if genBCode.isJavaEntryPoint(tree.symbol, currentUnit) => // collecting symbols for entry points here (as opposed to GenBCode where they are used) // has the advantage of saving an additional pass over all ClassDefs. entryPoints ::= tree.symbol diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala index f15d05f7df..9825efdc67 100644 --- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala +++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala @@ -570,8 +570,6 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre // The functional interface that can be used to adapt the lambda target method `target` to the // given function type. Returns `NoSymbol` if the compiler settings are unsuitable. private def java8CompatFunctionalInterface(target: Symbol, functionType: Type): (Symbol, Boolean) = { - val canUseLambdaMetafactory = settings.isBCodeActive - val sym = functionType.typeSymbol val pack = currentRun.runDefinitions.Scala_Java8_CompatPackage val name1 = specializeTypes.specializedFunctionName(sym, functionType.typeArgs) @@ -583,6 +581,6 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre } else { pack.info.decl(name1.toTypeName.prepend("J")) } - (if (canUseLambdaMetafactory) functionalInterface else NoSymbol, isSpecialized) + (functionalInterface, isSpecialized) } } diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index f6e2dd68f0..a372136781 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -246,9 +246,8 @@ abstract class LambdaLift extends InfoTransform { } // make sure that the name doesn't make the symbol accidentally `isAnonymousClass` (et.al) by - // introducing `$anon` in its name. to be cautious, we don't make this change in the default - // backend under 2.11.x, so only in GenBCode. - def nonAnon(s: String) = if (settings.Ybackend.value == "GenBCode") nme.ensureNonAnon(s) else s + // introducing `$anon` in its name. + def nonAnon(s: String) = nme.ensureNonAnon(s) def newName(sym: Symbol): Name = { val originalName = sym.name diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 7cd05b56c3..eea1f53cbc 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -236,10 +236,7 @@ abstract class UnCurry extends InfoTransform !(specialized =:= fun.tpe) } - def canUseDelamdafyMethod = ( - (inConstructorFlag == 0) // Avoiding synthesizing code prone to SI-6666, SI-8363 by using old-style lambda translation - && (!isSpecialized || settings.isBCodeActive) // DelambdafyTransformer currently only emits generic FunctionN-s, use the old style in the meantime - ) + def canUseDelamdafyMethod = inConstructorFlag == 0 // Avoiding synthesizing code prone to SI-6666, SI-8363 by using old-style lambda translation if (inlineFunctionExpansion || !canUseDelamdafyMethod) { val parents = addSerializable(abstractFunctionForFunctionType(fun.tpe)) val anonClass = fun.symbol.owner newAnonymousFunctionClass(fun.pos, inConstructorFlag) addAnnotation SerialVersionUIDAnnotation diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala index 42b939f18b..1c9167b2ea 100644 --- a/src/compiler/scala/tools/util/PathResolver.scala +++ b/src/compiler/scala/tools/util/PathResolver.scala @@ -167,12 +167,6 @@ object PathResolver { |}""".asLines } - // used in PathResolver constructor - private object NoImplClassJavaContext extends JavaContext { - override def isValidName(name: String): Boolean = - !ReflectionUtils.scalacShouldntLoadClassfile(name) - } - @deprecated("This method is no longer used be scalap and will be deleted", "2.11.5") def fromPathString(path: String, context: JavaContext = DefaultJavaContext): JavaClassPath = { val s = new Settings() @@ -313,10 +307,7 @@ abstract class PathResolverBase[BaseClassPathType <: ClassFileLookup[AbstractFil class PathResolver(settings: Settings, context: JavaContext) extends PathResolverBase[ClassPath[AbstractFile], JavaClassPath](settings, context) { - def this(settings: Settings) = - this(settings, - if (settings.YnoLoadImplClass) PathResolver.NoImplClassJavaContext - else DefaultJavaContext) + def this(settings: Settings) = this(settings, DefaultJavaContext) override protected def computeResult(): JavaClassPath = new JavaClassPath(containers.toIndexedSeq, context) diff --git a/test/files/neg/case-collision2.flags b/test/files/neg/case-collision2.flags index bea46902c9..85d8eb2ba2 100644 --- a/test/files/neg/case-collision2.flags +++ b/test/files/neg/case-collision2.flags @@ -1 +1 @@ --Ybackend:GenBCode -Xfatal-warnings +-Xfatal-warnings diff --git a/test/files/neg/incompatibleSettings.check b/test/files/neg/incompatibleSettings.check deleted file mode 100644 index 0f28d41825..0000000000 --- a/test/files/neg/incompatibleSettings.check +++ /dev/null @@ -1,6 +0,0 @@ -warning: Conflicting compiler settings were detected. Some settings will be ignored. -Compiler settings for the 2.11 optimizer (-optimise) 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. -error: No warnings can be incurred under -Xfatal-warnings. -one warning found -one error found diff --git a/test/files/neg/incompatibleSettings.flags b/test/files/neg/incompatibleSettings.flags deleted file mode 100644 index 00dd9c1c24..0000000000 --- a/test/files/neg/incompatibleSettings.flags +++ /dev/null @@ -1 +0,0 @@ --optimise -Ybackend:GenBCode -Xfatal-warnings diff --git a/test/files/neg/incompatibleSettings.scala b/test/files/neg/incompatibleSettings.scala deleted file mode 100644 index 826a1a5bc2..0000000000 --- a/test/files/neg/incompatibleSettings.scala +++ /dev/null @@ -1 +0,0 @@ -class C diff --git a/test/files/neg/inlineMaxSize.flags b/test/files/neg/inlineMaxSize.flags index 9c6b811622..18b474e797 100644 --- a/test/files/neg/inlineMaxSize.flags +++ b/test/files/neg/inlineMaxSize.flags @@ -1 +1 @@ --Ybackend:GenBCode -Ydelambdafy:method -Yopt:l:classpath -Yopt-warnings -Xfatal-warnings \ No newline at end of file +-Ydelambdafy:method -Yopt:l:classpath -Yopt-warnings -Xfatal-warnings \ No newline at end of file diff --git a/test/files/neg/optimiseDeprecated.check b/test/files/neg/optimiseDeprecated.check new file mode 100644 index 0000000000..d51d48f023 --- /dev/null +++ b/test/files/neg/optimiseDeprecated.check @@ -0,0 +1,4 @@ +warning: -optimise is deprecated: In 2.12, -optimise enables -Yopt:l:classpath. Check -Yopt:help for using the Scala 2.12 optimizer. +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/optimiseDeprecated.flags b/test/files/neg/optimiseDeprecated.flags new file mode 100644 index 0000000000..42fca6d836 --- /dev/null +++ b/test/files/neg/optimiseDeprecated.flags @@ -0,0 +1 @@ +-optimise -deprecation -Xfatal-warnings diff --git a/test/files/neg/optimiseDeprecated.scala b/test/files/neg/optimiseDeprecated.scala new file mode 100644 index 0000000000..826a1a5bc2 --- /dev/null +++ b/test/files/neg/optimiseDeprecated.scala @@ -0,0 +1 @@ +class C diff --git a/test/files/pos/t9111-inliner-workaround.flags b/test/files/pos/t9111-inliner-workaround.flags index 63b5558cfd..422d6be431 100644 --- a/test/files/pos/t9111-inliner-workaround.flags +++ b/test/files/pos/t9111-inliner-workaround.flags @@ -1 +1 @@ --Ybackend:GenBCode -Yopt:l:classpath \ No newline at end of file +-Yopt:l:classpath \ No newline at end of file diff --git a/test/files/run/bcodeInlinerMixed.flags b/test/files/run/bcodeInlinerMixed.flags index 63b5558cfd..422d6be431 100644 --- a/test/files/run/bcodeInlinerMixed.flags +++ b/test/files/run/bcodeInlinerMixed.flags @@ -1 +1 @@ --Ybackend:GenBCode -Yopt:l:classpath \ No newline at end of file +-Yopt:l:classpath \ No newline at end of file diff --git a/test/files/run/nothingTypeDce.flags b/test/files/run/nothingTypeDce.flags index fde52cc7df..8785c036f6 100644 --- a/test/files/run/nothingTypeDce.flags +++ b/test/files/run/nothingTypeDce.flags @@ -1 +1 @@ --Ybackend:GenBCode -Yopt:unreachable-code +-Yopt:unreachable-code diff --git a/test/files/run/nothingTypeDce.scala b/test/files/run/nothingTypeDce.scala index 92d3ca6f89..5c3a0731fd 100644 --- a/test/files/run/nothingTypeDce.scala +++ b/test/files/run/nothingTypeDce.scala @@ -1,6 +1,6 @@ // See comment in BCodeBodyBuilder -// -Ybackend:GenBCode -Yopt:unreachable-code +// -Yopt:unreachable-code class C { // can't just emit a call to ???, that returns value of type Nothing$ (not Int). diff --git a/test/files/run/nothingTypeNoOpt.flags b/test/files/run/nothingTypeNoOpt.flags index d3e4d61e19..bc22511cff 100644 --- a/test/files/run/nothingTypeNoOpt.flags +++ b/test/files/run/nothingTypeNoOpt.flags @@ -1 +1 @@ --Ybackend:GenBCode -Yopt:l:none +-Yopt:l:none diff --git a/test/files/run/nothingTypeNoOpt.scala b/test/files/run/nothingTypeNoOpt.scala index 454539a4b1..33b20ba851 100644 --- a/test/files/run/nothingTypeNoOpt.scala +++ b/test/files/run/nothingTypeNoOpt.scala @@ -1,6 +1,6 @@ // See comment in BCodeBodyBuilder -// -target:jvm-1.6 -Ybackend:GenBCode -Yopt:l:none +// -target:jvm-1.6 -Yopt:l:none // target enables stack map frame generation class C { diff --git a/test/files/run/t3452b-bcode.check b/test/files/run/t3452b-bcode.check deleted file mode 100644 index 204c3d0437..0000000000 --- a/test/files/run/t3452b-bcode.check +++ /dev/null @@ -1,2 +0,0 @@ -Search received: test -SearchC received: test diff --git a/test/files/run/t3452b-bcode.flags b/test/files/run/t3452b-bcode.flags deleted file mode 100644 index c30091d3de..0000000000 --- a/test/files/run/t3452b-bcode.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenBCode diff --git a/test/files/run/t3452b-bcode/J_2.java b/test/files/run/t3452b-bcode/J_2.java deleted file mode 100644 index 839f334508..0000000000 --- a/test/files/run/t3452b-bcode/J_2.java +++ /dev/null @@ -1,6 +0,0 @@ -public class J_2 { - public static void j() { - StringSearch.search("test"); - StringSearch.searchC("test"); - } -} diff --git a/test/files/run/t3452b-bcode/S_1.scala b/test/files/run/t3452b-bcode/S_1.scala deleted file mode 100644 index a209f12035..0000000000 --- a/test/files/run/t3452b-bcode/S_1.scala +++ /dev/null @@ -1,17 +0,0 @@ -trait Search[M] { - def search(input: M): C[Int] = { - println("Search received: " + input) - null - } -} - -class SearchC[M] { - def searchC(input: M): C[Int] = { - println("SearchC received: " + input) - null - } -} - -object StringSearch extends SearchC[String] with Search[String] - -trait C[T] diff --git a/test/files/run/t3452b-bcode/S_3.scala b/test/files/run/t3452b-bcode/S_3.scala deleted file mode 100644 index 102b433f47..0000000000 --- a/test/files/run/t3452b-bcode/S_3.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - J_2.j() - } -} diff --git a/test/files/run/t7407.flags b/test/files/run/t7407.flags index ffc65f4b81..bc22511cff 100644 --- a/test/files/run/t7407.flags +++ b/test/files/run/t7407.flags @@ -1 +1 @@ --Yopt:l:none -Ybackend:GenBCode +-Yopt:l:none diff --git a/test/files/run/t7407b.flags b/test/files/run/t7407b.flags deleted file mode 100644 index c30091d3de..0000000000 --- a/test/files/run/t7407b.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenBCode diff --git a/test/files/run/t8233-bcode.flags b/test/files/run/t8233-bcode.flags deleted file mode 100644 index c30091d3de..0000000000 --- a/test/files/run/t8233-bcode.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenBCode diff --git a/test/files/run/t8233-bcode.scala b/test/files/run/t8233-bcode.scala deleted file mode 100644 index 72d013e553..0000000000 --- a/test/files/run/t8233-bcode.scala +++ /dev/null @@ -1,31 +0,0 @@ -object Test { - def bar(s: String) = s; - val o: Option[Null] = None - def nullReference { - val a: Null = o.get - bar(a) // Was: VerifyError under GenICode - } - - def literal { - val a: Null = null - bar(a) - } - - /** Check SI-8330 for details */ - def expectedUnitInABranch(b: Boolean): Boolean = { - if (b) { - val x = 12 - () - } else { - // here expected type is (unboxed) Unit - null - } - true - } - - def main(args: Array[String]): Unit = { - try { nullReference } catch { case _: NoSuchElementException => } - literal - expectedUnitInABranch(true) - } -} diff --git a/test/files/run/t8845.flags b/test/files/run/t8845.flags deleted file mode 100644 index c30091d3de..0000000000 --- a/test/files/run/t8845.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenBCode diff --git a/test/files/run/t8925.flags b/test/files/run/t8925.flags index ffc65f4b81..bc22511cff 100644 --- a/test/files/run/t8925.flags +++ b/test/files/run/t8925.flags @@ -1 +1 @@ --Yopt:l:none -Ybackend:GenBCode +-Yopt:l:none diff --git a/test/files/run/t9097.scala b/test/files/run/t9097.scala index 2b5cf66a75..49c0bbe79a 100644 --- a/test/files/run/t9097.scala +++ b/test/files/run/t9097.scala @@ -6,7 +6,6 @@ object Test extends StoreReporterDirectTest { override def extraSettings: String = List( "-usejavacp", "-Xfatal-warnings", - "-Ybackend:GenBCode", "-Ydelambdafy:method", "-Xprint:delambdafy", s"-d ${testOutput.path}" diff --git a/test/junit/scala/issues/OptimizedBytecodeTest.scala b/test/junit/scala/issues/OptimizedBytecodeTest.scala index 58ab6c2134..0e1a52b1c8 100644 --- a/test/junit/scala/issues/OptimizedBytecodeTest.scala +++ b/test/junit/scala/issues/OptimizedBytecodeTest.scala @@ -380,4 +380,11 @@ class OptimizedBytecodeTest extends ClearAfterClass { val List(c, f) = compileClasses(compiler)(code) assertInvoke(getSingleMethod(c, "crash"), "C", "map") } + + @Test + def optimiseEnablesNewOpt(): Unit = { + val code = """class C { def t = (1 to 10) foreach println }""" + val List(c) = readAsmClasses(compile(newCompiler(extraArgs = "-optimise -deprecation"))(code, allowMessage = _.msg.contains("is deprecated"))) + assertInvoke(getSingleMethod(c, "t"), "C", "C$$$anonfun$1") // range-foreach inlined from classpath + } } diff --git a/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala b/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala index 6ada0e20fb..8b8e2b36de 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/BTypesTest.scala @@ -12,7 +12,7 @@ import scala.tools.testing.ClearAfterClass object BTypesTest extends ClearAfterClass.Clearable { var compiler = { - val comp = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:none") + val comp = newCompiler(extraArgs = "-Yopt:l:none") new comp.Run() // initializes some of the compiler comp.exitingDelambdafy(comp.scalaPrimitives.init()) // needed: it's only done when running the backend, and we don't actually run the compiler comp.exitingDelambdafy(comp.genBCode.bTypes.initializeCoreBTypes()) diff --git a/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala b/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala index e57e95bac4..2ce9d21331 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala @@ -11,7 +11,7 @@ import JavaConverters._ import scala.tools.testing.ClearAfterClass object DefaultMethodTest extends ClearAfterClass.Clearable { - var compiler = newCompiler(extraArgs = "-Ybackend:GenBCode") + var compiler = newCompiler() def clear(): Unit = { compiler = null } } diff --git a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala index 240d3523f1..0cdc6ead10 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala @@ -10,7 +10,7 @@ import scala.tools.partest.ASMConverters._ import scala.tools.testing.ClearAfterClass object DirectCompileTest extends ClearAfterClass.Clearable { - var compiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:method") + var compiler = newCompiler(extraArgs = "-Yopt:l:method") def clear(): Unit = { compiler = null } } diff --git a/test/junit/scala/tools/nsc/backend/jvm/IndyLambdaTest.scala b/test/junit/scala/tools/nsc/backend/jvm/IndyLambdaTest.scala index f5f93fef5c..758566fe53 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/IndyLambdaTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/IndyLambdaTest.scala @@ -11,7 +11,7 @@ import scala.tools.testing.ClearAfterClass import scala.collection.JavaConverters._ object IndyLambdaTest extends ClearAfterClass.Clearable { - var compiler = newCompiler(extraArgs = "-Ybackend:GenBCode") + var compiler = newCompiler() def clear(): Unit = { compiler = null diff --git a/test/junit/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzerTest.scala index daff6fc223..78dbab82f4 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzerTest.scala @@ -20,7 +20,7 @@ import AsmUtils._ import scala.collection.convert.decorateAsScala._ object NullnessAnalyzerTest extends ClearAfterClass.Clearable { - var noOptCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:none") + var noOptCompiler = newCompiler(extraArgs = "-Yopt:l:none") def clear(): Unit = { noOptCompiler = null diff --git a/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala index 4835eb3cdf..d54b8ac563 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala @@ -15,7 +15,7 @@ import CodeGenTools._ import AsmUtils._ object ProdConsAnalyzerTest extends ClearAfterClass.Clearable { - var noOptCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:none") + var noOptCompiler = newCompiler(extraArgs = "-Yopt:l:none") def clear(): Unit = { noOptCompiler = null diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala index 1b6c080234..9e6a148dba 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala @@ -22,7 +22,7 @@ import scala.collection.convert.decorateAsScala._ @RunWith(classOf[JUnit4]) class BTypesFromClassfileTest { // inliner enabled -> inlineInfos are collected (and compared) in ClassBTypes - val compiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:inline-global") + val compiler = newCompiler(extraArgs = "-Yopt:inline-global") import compiler._ import definitions._ diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/CallGraphTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/CallGraphTest.scala index 3857d3e8ce..6e1ac3ba9f 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/CallGraphTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/CallGraphTest.scala @@ -25,7 +25,7 @@ import scala.collection.convert.decorateAsScala._ import scala.tools.testing.ClearAfterClass object CallGraphTest extends ClearAfterClass.Clearable { - var compiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:inline-global -Yopt-warnings") + var compiler = newCompiler(extraArgs = "-Yopt:inline-global -Yopt-warnings") def clear(): Unit = { compiler = null } // allows inspecting the caches after a compilation run diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/CompactLocalVariablesTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/CompactLocalVariablesTest.scala index cd298f822a..ac1b759fe2 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/CompactLocalVariablesTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/CompactLocalVariablesTest.scala @@ -17,8 +17,8 @@ class CompactLocalVariablesTest { // recurse-unreachable-jumps is required for eliminating catch blocks, in the first dce round they // are still live.only after eliminating the empty handler the catch blocks become unreachable. - val methodOptCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:unreachable-code,compact-locals") - val noCompactVarsCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:unreachable-code") + val methodOptCompiler = newCompiler(extraArgs = "-Yopt:unreachable-code,compact-locals") + val noCompactVarsCompiler = newCompiler(extraArgs = "-Yopt:unreachable-code") @Test def compactUnused(): Unit = { diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala index cb01f3d164..22aed4207f 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/EmptyExceptionHandlersTest.scala @@ -14,8 +14,8 @@ import ASMConverters._ import scala.tools.testing.ClearAfterClass object EmptyExceptionHandlersTest extends ClearAfterClass.Clearable { - var noOptCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:none") - var dceCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:unreachable-code") + var noOptCompiler = newCompiler(extraArgs = "-Yopt:l:none") + var dceCompiler = newCompiler(extraArgs = "-Yopt:unreachable-code") def clear(): Unit = { noOptCompiler = null dceCompiler = null diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineInfoTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineInfoTest.scala index c25933e63e..036816605b 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineInfoTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineInfoTest.scala @@ -19,7 +19,7 @@ import BackendReporting._ import scala.collection.convert.decorateAsScala._ object InlineInfoTest extends ClearAfterClass.Clearable { - var compiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:classpath") + var compiler = newCompiler(extraArgs = "-Yopt:l:classpath") def clear(): Unit = { compiler = null } def notPerRun: List[Clearable] = List( diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala index 5f7a6d0633..84d3d71964 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala @@ -28,7 +28,7 @@ import scala.collection.convert.decorateAsScala._ import scala.tools.testing.ClearAfterClass object InlineWarningTest extends ClearAfterClass.Clearable { - val argsNoWarn = "-Ybackend:GenBCode -Yopt:l:classpath" + val argsNoWarn = "-Yopt:l:classpath" val args = argsNoWarn + " -Yopt-warnings" var compiler = newCompiler(extraArgs = args) var compilerWarnAll = newCompiler(extraArgs = argsNoWarn + " -Yopt-warnings:_") diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerIllegalAccessTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerIllegalAccessTest.scala index f1be44a094..884027cd90 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerIllegalAccessTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerIllegalAccessTest.scala @@ -20,7 +20,7 @@ import scala.collection.convert.decorateAsScala._ import scala.tools.testing.ClearAfterClass object InlinerIllegalAccessTest extends ClearAfterClass.Clearable { - var compiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:none") + var compiler = newCompiler(extraArgs = "-Yopt:l:none") def clear(): Unit = { compiler = null } } diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala index 44b6c7ca9e..63c743b075 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala @@ -16,7 +16,7 @@ import AsmUtils._ import scala.collection.convert.decorateAsScala._ object InlinerSeparateCompilationTest { - val args = "-Ybackend:GenBCode -Yopt:l:classpath" + val args = "-Yopt:l:classpath" } @RunWith(classOf[JUnit4]) diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala index c07d1fe3c4..d141c48811 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala @@ -17,7 +17,7 @@ import scala.collection.convert.decorateAsScala._ import scala.tools.testing.ClearAfterClass object ScalaInlineInfoTest extends ClearAfterClass.Clearable { - var compiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:none") + var compiler = newCompiler(extraArgs = "-Yopt:l:none") def clear(): Unit = { compiler = null } } diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/UnreachableCodeTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/UnreachableCodeTest.scala index 62ee09e9de..902709e041 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/UnreachableCodeTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/UnreachableCodeTest.scala @@ -18,9 +18,9 @@ import scala.tools.testing.ClearAfterClass object UnreachableCodeTest extends ClearAfterClass.Clearable { // jvm-1.6 enables emitting stack map frames, which impacts the code generation wrt dead basic blocks, // see comment in BCodeBodyBuilder - var methodOptCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:method") - var dceCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:unreachable-code") - var noOptCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:l:none") + var methodOptCompiler = newCompiler(extraArgs = "-Yopt:l:method") + var dceCompiler = newCompiler(extraArgs = "-Yopt:unreachable-code") + var noOptCompiler = newCompiler(extraArgs = "-Yopt:l:none") def clear(): Unit = { methodOptCompiler = null diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/UnusedLocalVariablesTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/UnusedLocalVariablesTest.scala index 769736669b..4f71df1822 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/UnusedLocalVariablesTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/UnusedLocalVariablesTest.scala @@ -15,7 +15,7 @@ import ASMConverters._ import scala.tools.testing.ClearAfterClass object UnusedLocalVariablesTest extends ClearAfterClass.Clearable { - var dceCompiler = newCompiler(extraArgs = "-Ybackend:GenBCode -Yopt:unreachable-code") + var dceCompiler = newCompiler(extraArgs = "-Yopt:unreachable-code") def clear(): Unit = { dceCompiler = null } } diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala index a0015f4465..01a2351011 100644 --- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala +++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala @@ -26,16 +26,16 @@ class SettingsTest { assertThrows[IllegalArgumentException](check("-Ytest-setting:rubbish")) } - @Test def userSettingsHavePrecedenceOverOptimize() { + @Test def userSettingsHavePrecedenceOverExperimental() { def check(args: String*): MutableSettings#BooleanSetting = { val s = new MutableSettings(msg => throw new IllegalArgumentException(msg)) val (ok, residual) = s.processArguments(args.toList, processAll = true) assert(residual.isEmpty) - s.inline // among -optimize + s.YmethodInfer // among -Xexperimental } - assertTrue(check("-optimise").value) - assertFalse(check("-optimise", "-Yinline:false").value) - assertFalse(check("-Yinline:false", "-optimise").value) + assertTrue(check("-Xexperimental").value) + assertFalse(check("-Xexperimental", "-Yinfer-argument-types:false").value) + assertFalse(check("-Yinfer-argument-types:false", "-Xexperimental").value) } // for the given args, select the desired setting diff --git a/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala b/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala index 010078e28a..e4bf038f32 100644 --- a/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala +++ b/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala @@ -52,7 +52,7 @@ object Delambdafy { val srcFile = makeSourceFile(codeForMultiOutput, "delambdafyTest.scala") val outDir = AbstractFile.getDirectory(TempDir.createTempDir()) val outDirPath = outDir.canonicalPath - val extraArgs = "-Ybackend:GenBCode -Ydelambdafy:method" + val extraArgs = "-Ydelambdafy:method" val argsWithOutDir = extraArgs + s" -d $outDirPath -cp $outDirPath" val compiler = newCompilerWithoutVirtualOutdir(extraArgs = argsWithOutDir) compiler.settings.outputDirs.add(srcFile.file, outDir) @@ -63,7 +63,7 @@ object Delambdafy { outDir.delete() classfiles } - + @Test def shouldFindOutputFoldersForAllPromotedLambdasAsMethod(): Unit = { val actual = compileToMultipleOutputWithDelamdbafyMethod() -- cgit v1.2.3