From 1683c95e159006d40a8458d29ef266ca741752c7 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 25 Jul 2013 12:58:56 -0700 Subject: SI-7622 Clean Up Phase Assembly Let optimiser components and continuations plugin opt-out when required flags are not set. Wasted time on a whitespace error in check file, so let --debug dump the processed check file and its diff. --- test/files/neg/t6446-additional.check | 6 +++ test/files/neg/t6446-missing.check | 5 +++ test/files/neg/t6446-show-phases.check | 5 +++ test/files/neg/t7494-no-options.check | 6 +++ test/files/neg/t7622-cyclic-dependency.check | 1 + .../neg/t7622-cyclic-dependency/ThePlugin.scala | 40 ++++++++++++++++++++ .../neg/t7622-cyclic-dependency/sample_2.flags | 1 + .../neg/t7622-cyclic-dependency/sample_2.scala | 6 +++ .../neg/t7622-cyclic-dependency/scalac-plugin.xml | 5 +++ test/files/neg/t7622-missing-dependency.check | 2 + .../neg/t7622-missing-dependency/ThePlugin.scala | 33 ++++++++++++++++ .../neg/t7622-missing-dependency/sample_2.flags | 1 + .../neg/t7622-missing-dependency/sample_2.scala | 6 +++ .../neg/t7622-missing-dependency/scalac-plugin.xml | 5 +++ test/files/neg/t7622-missing-required.check | 2 + test/files/neg/t7622-missing-required.flags | 1 + test/files/neg/t7622-missing-required.scala | 4 ++ test/files/neg/t7622-multi-followers.check | 1 + .../neg/t7622-multi-followers/ThePlugin.scala | 44 ++++++++++++++++++++++ .../files/neg/t7622-multi-followers/sample_2.flags | 1 + .../files/neg/t7622-multi-followers/sample_2.scala | 6 +++ .../neg/t7622-multi-followers/scalac-plugin.xml | 5 +++ 22 files changed, 186 insertions(+) create mode 100644 test/files/neg/t7622-cyclic-dependency.check create mode 100644 test/files/neg/t7622-cyclic-dependency/ThePlugin.scala create mode 100644 test/files/neg/t7622-cyclic-dependency/sample_2.flags create mode 100644 test/files/neg/t7622-cyclic-dependency/sample_2.scala create mode 100644 test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml create mode 100644 test/files/neg/t7622-missing-dependency.check create mode 100644 test/files/neg/t7622-missing-dependency/ThePlugin.scala create mode 100644 test/files/neg/t7622-missing-dependency/sample_2.flags create mode 100644 test/files/neg/t7622-missing-dependency/sample_2.scala create mode 100644 test/files/neg/t7622-missing-dependency/scalac-plugin.xml create mode 100644 test/files/neg/t7622-missing-required.check create mode 100644 test/files/neg/t7622-missing-required.flags create mode 100644 test/files/neg/t7622-missing-required.scala create mode 100644 test/files/neg/t7622-multi-followers.check create mode 100644 test/files/neg/t7622-multi-followers/ThePlugin.scala create mode 100644 test/files/neg/t7622-multi-followers/sample_2.flags create mode 100644 test/files/neg/t7622-multi-followers/sample_2.scala create mode 100644 test/files/neg/t7622-multi-followers/scalac-plugin.xml (limited to 'test/files/neg') diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check index be928095d3..6dfe072913 100755 --- a/test/files/neg/t6446-additional.check +++ b/test/files/neg/t6446-additional.check @@ -22,6 +22,7 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls icode 22 generate portable intermediate code +#partest -optimise inliner 23 optimization: do inlining inlinehandlers 24 optimization: inline exception handlers closelim 25 optimization: eliminate uncalled closures @@ -30,3 +31,8 @@ inlinehandlers 24 optimization: inline exception handlers jvm 28 generate JVM bytecode ploogin 29 A sample phase that does so many things it's kind of hard... terminal 30 the last phase during a compilation run +#partest !-optimise + jvm 23 generate JVM bytecode + ploogin 24 A sample phase that does so many things it's kind of hard... + terminal 25 the last phase during a compilation run +#partest diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check index 8ede1bd260..d4afa9b630 100755 --- a/test/files/neg/t6446-missing.check +++ b/test/files/neg/t6446-missing.check @@ -23,6 +23,10 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls icode 22 generate portable intermediate code +#partest !-optimise + jvm 23 generate JVM bytecode + terminal 24 the last phase during a compilation run +#partest -optimise inliner 23 optimization: do inlining inlinehandlers 24 optimization: inline exception handlers closelim 25 optimization: eliminate uncalled closures @@ -30,3 +34,4 @@ inlinehandlers 24 optimization: inline exception handlers dce 27 optimization: eliminate dead code jvm 28 generate JVM bytecode terminal 29 the last phase during a compilation run +#partest diff --git a/test/files/neg/t6446-show-phases.check b/test/files/neg/t6446-show-phases.check index 73cbfb6659..10a9e08b86 100644 --- a/test/files/neg/t6446-show-phases.check +++ b/test/files/neg/t6446-show-phases.check @@ -22,6 +22,10 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls icode 22 generate portable intermediate code +#partest !-optimise + jvm 23 generate JVM bytecode + terminal 24 the last phase during a compilation run +#partest -optimise inliner 23 optimization: do inlining inlinehandlers 24 optimization: inline exception handlers closelim 25 optimization: eliminate uncalled closures @@ -29,3 +33,4 @@ inlinehandlers 24 optimization: inline exception handlers dce 27 optimization: eliminate dead code jvm 28 generate JVM bytecode terminal 29 the last phase during a compilation run +#partest diff --git a/test/files/neg/t7494-no-options.check b/test/files/neg/t7494-no-options.check index 04fbf0ec72..0bde84c96c 100644 --- a/test/files/neg/t7494-no-options.check +++ b/test/files/neg/t7494-no-options.check @@ -23,6 +23,11 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls icode 22 generate portable intermediate code +#partest !-optimise + jvm 23 generate JVM bytecode + ploogin 24 A sample phase that does so many things it's kind of hard... + terminal 25 the last phase during a compilation run +#partest -optimise inliner 23 optimization: do inlining inlinehandlers 24 optimization: inline exception handlers closelim 25 optimization: eliminate uncalled closures @@ -31,3 +36,4 @@ inlinehandlers 24 optimization: inline exception handlers jvm 28 generate JVM bytecode ploogin 29 A sample phase that does so many things it's kind of hard... terminal 30 the last phase during a compilation run +#partest diff --git a/test/files/neg/t7622-cyclic-dependency.check b/test/files/neg/t7622-cyclic-dependency.check new file mode 100644 index 0000000000..3546964f5f --- /dev/null +++ b/test/files/neg/t7622-cyclic-dependency.check @@ -0,0 +1 @@ +error: Cycle in phase dependencies detected at cyclicdependency1, created phase-cycle.dot diff --git a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala new file mode 100644 index 0000000000..7a905ae32d --- /dev/null +++ b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala @@ -0,0 +1,40 @@ +package scala.test.plugins + +import scala.tools.nsc +import nsc.Global +import nsc.Phase +import nsc.plugins.Plugin +import nsc.plugins.PluginComponent + +class ThePlugin(val global: Global) extends Plugin { + import global._ + + val name = "cyclicdependency" + val description = "Declares two phases that have a cyclic dependency" + val components = List[PluginComponent](thePhase1,thePhase2) + + private object thePhase1 extends PluginComponent { + val global = ThePlugin.this.global + + val runsAfter = List[String]("tailcalls","cyclicdependency2") + + val phaseName = ThePlugin.this.name + "1" + + def newPhase(prev: Phase) = new ThePhase(prev, phaseName) + } + + private object thePhase2 extends PluginComponent { + val global = ThePlugin.this.global + + val runsAfter = List[String]("dce","cyclicdependency1") + + val phaseName = ThePlugin.this.name + "2" + + def newPhase(prev: Phase) = new ThePhase(prev, phaseName) + } + + private class ThePhase(prev: Phase, val name: String) extends Phase(prev) { + def run {} + } +} + diff --git a/test/files/neg/t7622-cyclic-dependency/sample_2.flags b/test/files/neg/t7622-cyclic-dependency/sample_2.flags new file mode 100644 index 0000000000..db25b88a12 --- /dev/null +++ b/test/files/neg/t7622-cyclic-dependency/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:. -Xplugin-require:cyclicdependency diff --git a/test/files/neg/t7622-cyclic-dependency/sample_2.scala b/test/files/neg/t7622-cyclic-dependency/sample_2.scala new file mode 100644 index 0000000000..73cdc64e40 --- /dev/null +++ b/test/files/neg/t7622-cyclic-dependency/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the sample plugin enabled +object Sample extends App { +} diff --git a/test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml b/test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml new file mode 100644 index 0000000000..2558d6fd03 --- /dev/null +++ b/test/files/neg/t7622-cyclic-dependency/scalac-plugin.xml @@ -0,0 +1,5 @@ + + ignored + scala.test.plugins.ThePlugin + + diff --git a/test/files/neg/t7622-missing-dependency.check b/test/files/neg/t7622-missing-dependency.check new file mode 100644 index 0000000000..a0d0e30870 --- /dev/null +++ b/test/files/neg/t7622-missing-dependency.check @@ -0,0 +1,2 @@ +error: Phase 'myplugin' requires: List(missing) +one error found diff --git a/test/files/neg/t7622-missing-dependency/ThePlugin.scala b/test/files/neg/t7622-missing-dependency/ThePlugin.scala new file mode 100644 index 0000000000..a87cbb8e45 --- /dev/null +++ b/test/files/neg/t7622-missing-dependency/ThePlugin.scala @@ -0,0 +1,33 @@ +package scala.test.plugins + +import scala.tools.nsc +import nsc.Global +import nsc.Phase +import nsc.plugins.Plugin +import nsc.plugins.PluginComponent + +class ThePlugin(val global: Global) extends Plugin { + import global._ + + val name = "myplugin" + val description = "Declares one plugin with a missing requirement" + val components = List[PluginComponent](thePhase) + + private object thePhase extends PluginComponent { + val global = ThePlugin.this.global + + val runsAfter = List[String]("typer") + + val phaseName = ThePlugin.this.name + + override val requires = List("missing") + + def newPhase(prev: Phase) = new ThePhase(prev) + } + + private class ThePhase(prev: Phase) extends Phase(prev) { + def name = thePhase.phaseName + def run {} + } +} + diff --git a/test/files/neg/t7622-missing-dependency/sample_2.flags b/test/files/neg/t7622-missing-dependency/sample_2.flags new file mode 100644 index 0000000000..d69035100e --- /dev/null +++ b/test/files/neg/t7622-missing-dependency/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:. -Xplugin-require:myplugin diff --git a/test/files/neg/t7622-missing-dependency/sample_2.scala b/test/files/neg/t7622-missing-dependency/sample_2.scala new file mode 100644 index 0000000000..73cdc64e40 --- /dev/null +++ b/test/files/neg/t7622-missing-dependency/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the sample plugin enabled +object Sample extends App { +} diff --git a/test/files/neg/t7622-missing-dependency/scalac-plugin.xml b/test/files/neg/t7622-missing-dependency/scalac-plugin.xml new file mode 100644 index 0000000000..3c14061dce --- /dev/null +++ b/test/files/neg/t7622-missing-dependency/scalac-plugin.xml @@ -0,0 +1,5 @@ + + myplugin + scala.test.plugins.ThePlugin + + diff --git a/test/files/neg/t7622-missing-required.check b/test/files/neg/t7622-missing-required.check new file mode 100644 index 0000000000..5982178581 --- /dev/null +++ b/test/files/neg/t7622-missing-required.check @@ -0,0 +1,2 @@ +error: Missing required plugin: special-plugin +one error found diff --git a/test/files/neg/t7622-missing-required.flags b/test/files/neg/t7622-missing-required.flags new file mode 100644 index 0000000000..65deac6feb --- /dev/null +++ b/test/files/neg/t7622-missing-required.flags @@ -0,0 +1 @@ +-Xplugin-require:special-plugin diff --git a/test/files/neg/t7622-missing-required.scala b/test/files/neg/t7622-missing-required.scala new file mode 100644 index 0000000000..a0ba487b24 --- /dev/null +++ b/test/files/neg/t7622-missing-required.scala @@ -0,0 +1,4 @@ + +// the amazing features of this trait +// are unlocked by compiling with a special plugin. +trait Amazing diff --git a/test/files/neg/t7622-multi-followers.check b/test/files/neg/t7622-multi-followers.check new file mode 100644 index 0000000000..5cda422ff0 --- /dev/null +++ b/test/files/neg/t7622-multi-followers.check @@ -0,0 +1 @@ +error: Phase parser has too many followers: multi1,multi2; created phase-order.dot diff --git a/test/files/neg/t7622-multi-followers/ThePlugin.scala b/test/files/neg/t7622-multi-followers/ThePlugin.scala new file mode 100644 index 0000000000..e7a49a9be6 --- /dev/null +++ b/test/files/neg/t7622-multi-followers/ThePlugin.scala @@ -0,0 +1,44 @@ +package scala.test.plugins + +import scala.tools.nsc +import nsc.Global +import nsc.Phase +import nsc.plugins.Plugin +import nsc.plugins.PluginComponent + +class ThePlugin(val global: Global) extends Plugin { + import global._ + + val name = "multi" + val description = "Declares two phases that both follow parser" + val components = List[PluginComponent](thePhase1,thePhase2) + + private object thePhase1 extends PluginComponent { + val global = ThePlugin.this.global + + val runsAfter = List[String]() + + override val runsRightAfter = Some("parser") + + val phaseName = ThePlugin.this.name + "1" + + def newPhase(prev: Phase) = new ThePhase(prev, phaseName) + } + + private object thePhase2 extends PluginComponent { + val global = ThePlugin.this.global + + val runsAfter = List[String]() + + override val runsRightAfter = Some("parser") + + val phaseName = ThePlugin.this.name + "2" + + def newPhase(prev: Phase) = new ThePhase(prev, phaseName) + } + + private class ThePhase(prev: Phase, val name: String) extends Phase(prev) { + def run {} + } +} + diff --git a/test/files/neg/t7622-multi-followers/sample_2.flags b/test/files/neg/t7622-multi-followers/sample_2.flags new file mode 100644 index 0000000000..d2e83e9723 --- /dev/null +++ b/test/files/neg/t7622-multi-followers/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:. -Xplugin-require:multi diff --git a/test/files/neg/t7622-multi-followers/sample_2.scala b/test/files/neg/t7622-multi-followers/sample_2.scala new file mode 100644 index 0000000000..73cdc64e40 --- /dev/null +++ b/test/files/neg/t7622-multi-followers/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the sample plugin enabled +object Sample extends App { +} diff --git a/test/files/neg/t7622-multi-followers/scalac-plugin.xml b/test/files/neg/t7622-multi-followers/scalac-plugin.xml new file mode 100644 index 0000000000..2558d6fd03 --- /dev/null +++ b/test/files/neg/t7622-multi-followers/scalac-plugin.xml @@ -0,0 +1,5 @@ + + ignored + scala.test.plugins.ThePlugin + + -- cgit v1.2.3