summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-12-14 14:49:01 -0800
committerEugene Burmako <xeno.by@gmail.com>2012-12-14 14:49:01 -0800
commit14aa26ca0c346adbc79ccf4c0c9c35bbdd80c201 (patch)
tree2c4c54164237a80459b6aaaa01380dad70b9cdfc /test
parenta29293c8bc22b8a68b1033a440db14af49501f56 (diff)
parent098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d (diff)
downloadscala-14aa26ca0c346adbc79ccf4c0c9c35bbdd80c201.tar.gz
scala-14aa26ca0c346adbc79ccf4c0c9c35bbdd80c201.tar.bz2
scala-14aa26ca0c346adbc79ccf4c0c9c35bbdd80c201.zip
Merge pull request #1766 from scalamacros/topic/typed-ident-attachments
typedIdent no longer destroys attachments
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/attachments-typed-ident.check0
-rw-r--r--test/files/pos/attachments-typed-ident.flags1
-rw-r--r--test/files/pos/attachments-typed-ident/Impls_1.scala17
-rw-r--r--test/files/pos/attachments-typed-ident/Macros_Test_2.scala4
4 files changed, 22 insertions, 0 deletions
diff --git a/test/files/pos/attachments-typed-ident.check b/test/files/pos/attachments-typed-ident.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/attachments-typed-ident.check
diff --git a/test/files/pos/attachments-typed-ident.flags b/test/files/pos/attachments-typed-ident.flags
new file mode 100644
index 0000000000..cd66464f2f
--- /dev/null
+++ b/test/files/pos/attachments-typed-ident.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/test/files/pos/attachments-typed-ident/Impls_1.scala b/test/files/pos/attachments-typed-ident/Impls_1.scala
new file mode 100644
index 0000000000..cc40893a93
--- /dev/null
+++ b/test/files/pos/attachments-typed-ident/Impls_1.scala
@@ -0,0 +1,17 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object MyAttachment
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ val ident = Ident(newTermName("bar")) updateAttachment MyAttachment
+ assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments)
+ val typed = c.typeCheck(ident)
+ assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments)
+ c.Expr[Int](typed)
+ }
+
+ def foo = macro impl
+} \ No newline at end of file
diff --git a/test/files/pos/attachments-typed-ident/Macros_Test_2.scala b/test/files/pos/attachments-typed-ident/Macros_Test_2.scala
new file mode 100644
index 0000000000..37065ead4b
--- /dev/null
+++ b/test/files/pos/attachments-typed-ident/Macros_Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ def bar = 2
+ Macros.foo
+} \ No newline at end of file