summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-12-29 09:38:12 -0800
committerPaul Phillips <paulp@improving.org>2012-12-29 09:38:12 -0800
commit93f3d63d67b0b1e81322b67488b80ee0a34d74e6 (patch)
tree97ae93eb21cebe61d7f0845a4b0cac22ec44cbed /test
parent7091c70a9930f939c3e33537ceee210584daae51 (diff)
parent6c3c0e391655457e917a8c85d2d74eb9297e0571 (diff)
downloadscala-93f3d63d67b0b1e81322b67488b80ee0a34d74e6.tar.gz
scala-93f3d63d67b0b1e81322b67488b80ee0a34d74e6.tar.bz2
scala-93f3d63d67b0b1e81322b67488b80ee0a34d74e6.zip
Merge pull request #1809 from scalamacros/topic/ident-attachments
fixes the typedIdent problem for good
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/attachments-typed-another-ident.check0
-rw-r--r--test/files/pos/attachments-typed-another-ident.flags1
-rw-r--r--test/files/pos/attachments-typed-another-ident/Impls_1.scala17
-rw-r--r--test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala5
4 files changed, 23 insertions, 0 deletions
diff --git a/test/files/pos/attachments-typed-another-ident.check b/test/files/pos/attachments-typed-another-ident.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/attachments-typed-another-ident.check
diff --git a/test/files/pos/attachments-typed-another-ident.flags b/test/files/pos/attachments-typed-another-ident.flags
new file mode 100644
index 0000000000..cd66464f2f
--- /dev/null
+++ b/test/files/pos/attachments-typed-another-ident.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/test/files/pos/attachments-typed-another-ident/Impls_1.scala b/test/files/pos/attachments-typed-another-ident/Impls_1.scala
new file mode 100644
index 0000000000..957bafc6ae
--- /dev/null
+++ b/test/files/pos/attachments-typed-another-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
+}
diff --git a/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala b/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala
new file mode 100644
index 0000000000..022639bfe9
--- /dev/null
+++ b/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ def bar = 2
+ Macros.foo
+}
+