aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled/rewrite-needed
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-12-21 12:44:03 +0100
committerMartin Odersky <odersky@gmail.com>2014-12-21 12:44:03 +0100
commitb6755f6927c07337b0819d7503f2c7b1674d892f (patch)
tree1758dff616c91e4d52e26cd3e407651aa3034fe1 /tests/disabled/rewrite-needed
parent7d513b4f3342c17e8b603a43c40770d0f97424de (diff)
downloaddotty-b6755f6927c07337b0819d7503f2c7b1674d892f.tar.gz
dotty-b6755f6927c07337b0819d7503f2c7b1674d892f.tar.bz2
dotty-b6755f6927c07337b0819d7503f2c7b1674d892f.zip
tests reorgs
Move some tests into proper slots + comments what they are.
Diffstat (limited to 'tests/disabled/rewrite-needed')
-rw-r--r--tests/disabled/rewrite-needed/CustomGlobal.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/disabled/rewrite-needed/CustomGlobal.scala b/tests/disabled/rewrite-needed/CustomGlobal.scala
new file mode 100644
index 000000000..a5668bd7c
--- /dev/null
+++ b/tests/disabled/rewrite-needed/CustomGlobal.scala
@@ -0,0 +1,33 @@
+package custom
+
+import scala.tools.nsc._, reporters._, typechecker._
+
+/** Demonstration of a custom Global with a custom Typer,
+ * decoupled from trunk. Demonstration:
+ *
+{{{
+scalac -d . CustomGlobal.scala && scala -nc -Yglobal-class custom.CustomGlobal \
+ -e 'class Bippy(x: Int) ; def f = new Bippy(5)'
+
+I'm typing a Bippy! It's a ClassDef.
+I'm typing a Bippy! It's a Ident.
+I'm typing a Bippy! It's a DefDef.
+}}}
+ *
+ */
+class CustomGlobal(currentSettings: Settings, reporter: Reporter) extends Global(currentSettings, reporter) {
+ override lazy val analyzer = new {
+ val global: CustomGlobal.this.type = CustomGlobal.this
+ } with Analyzer {
+ override def newTyper(context: Context): Typer = new CustomTyper(context)
+
+ class CustomTyper(context : Context) extends Typer(context) {
+ override def typed(tree: Tree, mode: Mode, pt: Type): Tree = {
+ if (tree.summaryString contains "Bippy")
+ println("I'm typing a Bippy! It's a " + tree.shortClass + ".")
+
+ super.typed(tree, mode, pt)
+ }
+ }
+ }
+}