diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-12-16 17:01:00 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-12-28 23:21:01 +0100 |
commit | 6c3c0e391655457e917a8c85d2d74eb9297e0571 (patch) | |
tree | 1d200168301ae445b1d04a4e9632472867bd4ba7 /test/files/pos/attachments-typed-another-ident/Impls_1.scala | |
parent | d2a7aa4ba1c048e52affb0eb2b9167a18dc29c83 (diff) | |
download | scala-6c3c0e391655457e917a8c85d2d74eb9297e0571.tar.gz scala-6c3c0e391655457e917a8c85d2d74eb9297e0571.tar.bz2 scala-6c3c0e391655457e917a8c85d2d74eb9297e0571.zip |
fixes the typedIdent problem for good
Previous attachment retaining fix was only working for Idents which
get turned into Selects. Now it works for all transformations applied
to Idents (e.g. when an ident refers to something within a package obj).
Diffstat (limited to 'test/files/pos/attachments-typed-another-ident/Impls_1.scala')
-rw-r--r-- | test/files/pos/attachments-typed-another-ident/Impls_1.scala | 17 |
1 files changed, 17 insertions, 0 deletions
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 +} |