aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/neg/t7494-before-parser
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/neg/t7494-before-parser')
-rw-r--r--tests/untried/neg/t7494-before-parser/ThePlugin.scala32
-rw-r--r--tests/untried/neg/t7494-before-parser/sample_2.flags1
-rw-r--r--tests/untried/neg/t7494-before-parser/sample_2.scala6
-rw-r--r--tests/untried/neg/t7494-before-parser/scalac-plugin.xml5
4 files changed, 44 insertions, 0 deletions
diff --git a/tests/untried/neg/t7494-before-parser/ThePlugin.scala b/tests/untried/neg/t7494-before-parser/ThePlugin.scala
new file mode 100644
index 000000000..bb335c9c9
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/ThePlugin.scala
@@ -0,0 +1,32 @@
+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 = "beforeparser"
+ val description = "Declares one plugin that wants to be before the parser phase"
+ val components = List[PluginComponent](thePhase)
+
+ private object thePhase extends PluginComponent {
+ val global = ThePlugin.this.global
+
+ val runsAfter = List[String]()
+ override val runsBefore = List[String]("parser")
+
+ val phaseName = ThePlugin.this.name
+
+ def newPhase(prev: Phase) = new ThePhase(prev)
+ }
+
+ private class ThePhase(prev: Phase) extends Phase(prev) {
+ def name = ThePlugin.this.name
+ def run: Unit = {}
+ }
+}
+
diff --git a/tests/untried/neg/t7494-before-parser/sample_2.flags b/tests/untried/neg/t7494-before-parser/sample_2.flags
new file mode 100644
index 000000000..0c92fc8a0
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-require:beforeparser
diff --git a/tests/untried/neg/t7494-before-parser/sample_2.scala b/tests/untried/neg/t7494-before-parser/sample_2.scala
new file mode 100644
index 000000000..73cdc64e4
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/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/tests/untried/neg/t7494-before-parser/scalac-plugin.xml b/tests/untried/neg/t7494-before-parser/scalac-plugin.xml
new file mode 100644
index 000000000..90ff27dc2
--- /dev/null
+++ b/tests/untried/neg/t7494-before-parser/scalac-plugin.xml
@@ -0,0 +1,5 @@
+<plugin>
+ <name>beforeparser</name>
+ <classname>scala.test.plugins.ThePlugin</classname>
+</plugin>
+