summaryrefslogtreecommitdiff
path: root/test/files/run/macro-typecheck-macrosdisabled2
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-04-23 17:51:28 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-04-23 17:54:19 +0200
commit2b09d8caf5497c4e016a3e1179e5f7e842766176 (patch)
tree27c872f82fb8290b8cba6fa626ecd0b0dd627229 /test/files/run/macro-typecheck-macrosdisabled2
parent14df5d74b58505e082d6f7c0e42b51249d35eec4 (diff)
downloadscala-2b09d8caf5497c4e016a3e1179e5f7e842766176.tar.gz
scala-2b09d8caf5497c4e016a3e1179e5f7e842766176.tar.bz2
scala-2b09d8caf5497c4e016a3e1179e5f7e842766176.zip
rethinks tags
* introduces ArrayTag and ErasureTag * all type tags now feature erasure
Diffstat (limited to 'test/files/run/macro-typecheck-macrosdisabled2')
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala29
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Test_2.scala4
2 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
new file mode 100644
index 0000000000..1b840a6204
--- /dev/null
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -0,0 +1,29 @@
+import scala.reflect.makro.Context
+
+object Macros {
+ def impl_with_macros_enabled(c: Context) = {
+ import c.mirror._
+
+ val mr = Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("package")), newTermName("mirror"))
+ val tree1 = Apply(Select(mr, newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
+ val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false)
+ c.literal(ttree1.toString)
+ }
+
+ def foo_with_macros_enabled = macro impl_with_macros_enabled
+
+ def impl_with_macros_disabled(c: Context) = {
+ import c.mirror._
+
+ val mrPkg = staticModule("scala.reflect.package")
+ val mrSym = selectTerm(mrPkg, "mirror")
+ val NullaryMethodType(mrTpe) = mrSym.typeSignature
+ val mr = newFreeTerm("mr", mrTpe, scala.reflect.mirror)
+
+ val tree2 = Apply(Select(Ident(mr), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
+ val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
+ c.literal(ttree2.toString)
+ }
+
+ def foo_with_macros_disabled = macro impl_with_macros_disabled
+} \ No newline at end of file
diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Test_2.scala b/test/files/run/macro-typecheck-macrosdisabled2/Test_2.scala
new file mode 100644
index 0000000000..bdba39195b
--- /dev/null
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ println(Macros.foo_with_macros_enabled)
+ println(Macros.foo_with_macros_disabled)
+} \ No newline at end of file