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. --- .../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 ++++ 4 files changed, 45 insertions(+) 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 (limited to 'test/files/neg/t7622-missing-dependency') 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 + + -- cgit v1.2.3