summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2012-09-26 11:36:01 -0700
committerSom Snytt <som.snytt@gmail.com>2012-12-18 10:34:14 -0800
commitfadb306fdf3d37284fd29c50aa3956cabe79480d (patch)
tree7389f4155de0aae885d6ade1bc82c80e99c8b52c /test
parente14917528e1c080a7f10785e21de36f3a7769718 (diff)
downloadscala-fadb306fdf3d37284fd29c50aa3956cabe79480d.tar.gz
scala-fadb306fdf3d37284fd29c50aa3956cabe79480d.tar.bz2
scala-fadb306fdf3d37284fd29c50aa3956cabe79480d.zip
PluginComponent contributes description to -Xshow-phases.
In Global, SubComponent is called a phase descriptor, but it doesn't actually have a description. (Phase itself does.) This fix adds a description to PluginComponent so that plugins can describe what they do in -Xshow-phases. Elliptical descriptions Exploded archives Plugged-in partest Roundup at the Little h!
Diffstat (limited to 'test')
-rwxr-xr-xtest/files/neg/t6446-additional.check31
-rw-r--r--test/files/neg/t6446-additional/ploogin_1.scala31
-rw-r--r--test/files/neg/t6446-additional/sample_2.flags1
-rw-r--r--test/files/neg/t6446-additional/sample_2.scala6
-rw-r--r--test/files/neg/t6446-additional/scalac-plugin.xml4
-rwxr-xr-xtest/files/neg/t6446-list.check1
-rw-r--r--test/files/neg/t6446-list/ploogin_1.scala31
-rw-r--r--test/files/neg/t6446-list/sample_2.flags1
-rw-r--r--test/files/neg/t6446-list/sample_2.scala6
-rw-r--r--test/files/neg/t6446-list/scalac-plugin.xml4
-rwxr-xr-xtest/files/neg/t6446-missing.check31
-rw-r--r--test/files/neg/t6446-missing/sample_2.flags1
-rw-r--r--test/files/neg/t6446-missing/sample_2.scala6
-rw-r--r--test/files/neg/t6446-missing/scalac-plugin.xml4
-rw-r--r--test/files/neg/t6446-show-phases.check30
-rw-r--r--test/files/neg/t6446-show-phases.flags1
-rw-r--r--test/files/neg/t6446-show-phases.scala3
-rw-r--r--test/files/run/inline-ex-handlers.scala2
-rw-r--r--test/files/run/programmatic-main.check60
-rw-r--r--test/files/run/t4351.check (renamed from test/files/pos/t4351.check)0
-rw-r--r--test/files/run/t4351.scala (renamed from test/files/pos/t4351.scala)3
21 files changed, 225 insertions, 32 deletions
diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check
new file mode 100755
index 0000000000..53dd383941
--- /dev/null
+++ b/test/files/neg/t6446-additional.check
@@ -0,0 +1,31 @@
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers, translate patterns
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ icode 22 generate portable intermediate code
+ inliner 23 optimization: do inlining
+inlinehandlers 24 optimization: inline exception handlers
+ closelim 25 optimization: eliminate uncalled closures
+ dce 26 optimization: eliminate dead code
+ jvm 27 generate JVM bytecode
+ ploogin 28 A sample phase that does so many things it's kind of hard...
+ terminal 29 The last phase in the compiler chain
diff --git a/test/files/neg/t6446-additional/ploogin_1.scala b/test/files/neg/t6446-additional/ploogin_1.scala
new file mode 100644
index 0000000000..ed6adfc1cf
--- /dev/null
+++ b/test/files/neg/t6446-additional/ploogin_1.scala
@@ -0,0 +1,31 @@
+
+package t6446
+
+import scala.tools.nsc.{ Global, Phase }
+import scala.tools.nsc.plugins.{ Plugin, PluginComponent }
+import scala.reflect.io.Path
+import scala.reflect.io.File
+
+/** A test plugin. */
+class Ploogin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "ploogin"
+ val description = "A sample plugin for testing."
+ val components = List[PluginComponent](TestComponent)
+
+ private object TestComponent extends PluginComponent {
+ val global: Ploogin.this.global.type = Ploogin.this.global
+ //override val runsBefore = List("refchecks")
+ val runsAfter = List("jvm")
+ val phaseName = Ploogin.this.name
+ override def description = "A sample phase that does so many things it's kind of hard to describe briefly."
+ def newPhase(prev: Phase) = new TestPhase(prev)
+ class TestPhase(prev: Phase) extends StdPhase(prev) {
+ override def description = TestComponent.this.description
+ def apply(unit: CompilationUnit) {
+ // kewl kode
+ }
+ }
+ }
+}
diff --git a/test/files/neg/t6446-additional/sample_2.flags b/test/files/neg/t6446-additional/sample_2.flags
new file mode 100644
index 0000000000..4d518c2286
--- /dev/null
+++ b/test/files/neg/t6446-additional/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xshow-phases
diff --git a/test/files/neg/t6446-additional/sample_2.scala b/test/files/neg/t6446-additional/sample_2.scala
new file mode 100644
index 0000000000..73cdc64e40
--- /dev/null
+++ b/test/files/neg/t6446-additional/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/t6446-additional/scalac-plugin.xml b/test/files/neg/t6446-additional/scalac-plugin.xml
new file mode 100644
index 0000000000..e849bb5919
--- /dev/null
+++ b/test/files/neg/t6446-additional/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+<name>sample-plugin</name>
+<classname>t6446.Ploogin</classname>
+</plugin>
diff --git a/test/files/neg/t6446-list.check b/test/files/neg/t6446-list.check
new file mode 100755
index 0000000000..fa5c581941
--- /dev/null
+++ b/test/files/neg/t6446-list.check
@@ -0,0 +1 @@
+ploogin - A sample plugin for testing.
diff --git a/test/files/neg/t6446-list/ploogin_1.scala b/test/files/neg/t6446-list/ploogin_1.scala
new file mode 100644
index 0000000000..ed6adfc1cf
--- /dev/null
+++ b/test/files/neg/t6446-list/ploogin_1.scala
@@ -0,0 +1,31 @@
+
+package t6446
+
+import scala.tools.nsc.{ Global, Phase }
+import scala.tools.nsc.plugins.{ Plugin, PluginComponent }
+import scala.reflect.io.Path
+import scala.reflect.io.File
+
+/** A test plugin. */
+class Ploogin(val global: Global) extends Plugin {
+ import global._
+
+ val name = "ploogin"
+ val description = "A sample plugin for testing."
+ val components = List[PluginComponent](TestComponent)
+
+ private object TestComponent extends PluginComponent {
+ val global: Ploogin.this.global.type = Ploogin.this.global
+ //override val runsBefore = List("refchecks")
+ val runsAfter = List("jvm")
+ val phaseName = Ploogin.this.name
+ override def description = "A sample phase that does so many things it's kind of hard to describe briefly."
+ def newPhase(prev: Phase) = new TestPhase(prev)
+ class TestPhase(prev: Phase) extends StdPhase(prev) {
+ override def description = TestComponent.this.description
+ def apply(unit: CompilationUnit) {
+ // kewl kode
+ }
+ }
+ }
+}
diff --git a/test/files/neg/t6446-list/sample_2.flags b/test/files/neg/t6446-list/sample_2.flags
new file mode 100644
index 0000000000..9cb3232964
--- /dev/null
+++ b/test/files/neg/t6446-list/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xplugin-list
diff --git a/test/files/neg/t6446-list/sample_2.scala b/test/files/neg/t6446-list/sample_2.scala
new file mode 100644
index 0000000000..73cdc64e40
--- /dev/null
+++ b/test/files/neg/t6446-list/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/t6446-list/scalac-plugin.xml b/test/files/neg/t6446-list/scalac-plugin.xml
new file mode 100644
index 0000000000..e849bb5919
--- /dev/null
+++ b/test/files/neg/t6446-list/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+<name>sample-plugin</name>
+<classname>t6446.Ploogin</classname>
+</plugin>
diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check
new file mode 100755
index 0000000000..f976bf480e
--- /dev/null
+++ b/test/files/neg/t6446-missing.check
@@ -0,0 +1,31 @@
+Warning: class not found: t6446.Ploogin
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers, translate patterns
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ icode 22 generate portable intermediate code
+ inliner 23 optimization: do inlining
+inlinehandlers 24 optimization: inline exception handlers
+ closelim 25 optimization: eliminate uncalled closures
+ dce 26 optimization: eliminate dead code
+ jvm 27 generate JVM bytecode
+ terminal 28 The last phase in the compiler chain
diff --git a/test/files/neg/t6446-missing/sample_2.flags b/test/files/neg/t6446-missing/sample_2.flags
new file mode 100644
index 0000000000..4d518c2286
--- /dev/null
+++ b/test/files/neg/t6446-missing/sample_2.flags
@@ -0,0 +1 @@
+-Xplugin:. -Xshow-phases
diff --git a/test/files/neg/t6446-missing/sample_2.scala b/test/files/neg/t6446-missing/sample_2.scala
new file mode 100644
index 0000000000..73cdc64e40
--- /dev/null
+++ b/test/files/neg/t6446-missing/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/t6446-missing/scalac-plugin.xml b/test/files/neg/t6446-missing/scalac-plugin.xml
new file mode 100644
index 0000000000..9c34d63f83
--- /dev/null
+++ b/test/files/neg/t6446-missing/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+<name>missing-plugin</name>
+<classname>t6446.Ploogin</classname>
+</plugin>
diff --git a/test/files/neg/t6446-show-phases.check b/test/files/neg/t6446-show-phases.check
new file mode 100644
index 0000000000..5bbe43990c
--- /dev/null
+++ b/test/files/neg/t6446-show-phases.check
@@ -0,0 +1,30 @@
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers, translate patterns
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ icode 22 generate portable intermediate code
+ inliner 23 optimization: do inlining
+inlinehandlers 24 optimization: inline exception handlers
+ closelim 25 optimization: eliminate uncalled closures
+ dce 26 optimization: eliminate dead code
+ jvm 27 generate JVM bytecode
+ terminal 28 The last phase in the compiler chain
diff --git a/test/files/neg/t6446-show-phases.flags b/test/files/neg/t6446-show-phases.flags
new file mode 100644
index 0000000000..845666e100
--- /dev/null
+++ b/test/files/neg/t6446-show-phases.flags
@@ -0,0 +1 @@
+-Xshow-phases
diff --git a/test/files/neg/t6446-show-phases.scala b/test/files/neg/t6446-show-phases.scala
new file mode 100644
index 0000000000..a9afb042d2
--- /dev/null
+++ b/test/files/neg/t6446-show-phases.scala
@@ -0,0 +1,3 @@
+
+// testing compiler flag output only
+object Test extends App
diff --git a/test/files/run/inline-ex-handlers.scala b/test/files/run/inline-ex-handlers.scala
index a96b938e13..33e794b940 100644
--- a/test/files/run/inline-ex-handlers.scala
+++ b/test/files/run/inline-ex-handlers.scala
@@ -1,7 +1,7 @@
import scala.tools.partest.IcodeTest
object Test extends IcodeTest {
- override def printIcodeAfterPhase = "inlineExceptionHandlers"
+ override def printIcodeAfterPhase = "inlinehandlers"
}
import scala.util.Random._
diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check
index bdf76ddce1..d472c569d2 100644
--- a/test/files/run/programmatic-main.check
+++ b/test/files/run/programmatic-main.check
@@ -1,31 +1,31 @@
- phase name id description
- ---------- -- -----------
- parser 1 parse source into ASTs, perform simple desugaring
- namer 2 resolve names, attach symbols to named trees
- packageobjects 3 load package objects
- typer 4 the meat and potatoes: type the trees
- patmat 5 translate match expressions
- superaccessors 6 add super accessors in traits and nested classes
- extmethods 7 add extension methods for inline classes
- pickler 8 serialize symbol tables
- refchecks 9 reference/override checking, translate nested objects
- uncurry 10 uncurry, translate function values to anonymous classes
- tailcalls 11 replace tail calls by jumps
- specialize 12 @specialized-driven class and method specialization
- explicitouter 13 this refs to outer pointers, translate patterns
- erasure 14 erase types, add interfaces for traits
- posterasure 15 clean up erased inline classes
- lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
- lambdalift 17 move nested functions to top level
- constructors 18 move field definitions into constructors
- flatten 19 eliminate inner classes
- mixin 20 mixin composition
- cleanup 21 platform-specific cleanups, generate reflective calls
- icode 22 generate portable intermediate code
- inliner 23 optimization: do inlining
-inlineExceptionHandlers 24 optimization: inline exception handlers
- closelim 25 optimization: eliminate uncalled closures
- dce 26 optimization: eliminate dead code
- jvm 27 generate JVM bytecode
- terminal 28 The last phase in the compiler chain
+ phase name id description
+ ---------- -- -----------
+ parser 1 parse source into ASTs, perform simple desugaring
+ namer 2 resolve names, attach symbols to named trees
+packageobjects 3 load package objects
+ typer 4 the meat and potatoes: type the trees
+ patmat 5 translate match expressions
+superaccessors 6 add super accessors in traits and nested classes
+ extmethods 7 add extension methods for inline classes
+ pickler 8 serialize symbol tables
+ refchecks 9 reference/override checking, translate nested objects
+ uncurry 10 uncurry, translate function values to anonymous classes
+ tailcalls 11 replace tail calls by jumps
+ specialize 12 @specialized-driven class and method specialization
+ explicitouter 13 this refs to outer pointers, translate patterns
+ erasure 14 erase types, add interfaces for traits
+ posterasure 15 clean up erased inline classes
+ lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
+ lambdalift 17 move nested functions to top level
+ constructors 18 move field definitions into constructors
+ flatten 19 eliminate inner classes
+ mixin 20 mixin composition
+ cleanup 21 platform-specific cleanups, generate reflective calls
+ icode 22 generate portable intermediate code
+ inliner 23 optimization: do inlining
+inlinehandlers 24 optimization: inline exception handlers
+ closelim 25 optimization: eliminate uncalled closures
+ dce 26 optimization: eliminate dead code
+ jvm 27 generate JVM bytecode
+ terminal 28 The last phase in the compiler chain
diff --git a/test/files/pos/t4351.check b/test/files/run/t4351.check
index cb5d407e13..cb5d407e13 100644
--- a/test/files/pos/t4351.check
+++ b/test/files/run/t4351.check
diff --git a/test/files/pos/t4351.scala b/test/files/run/t4351.scala
index 2d57588793..d954d748b7 100644
--- a/test/files/pos/t4351.scala
+++ b/test/files/run/t4351.scala
@@ -1,7 +1,8 @@
object Test {
def main(args: Array[String]): Unit = {
- try new BooleanPropImpl() value
+ try new BooleanPropImpl().value
catch {
+ // was: StackOverflowError
case e: RuntimeException => println("runtime exception")
}
}