diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-12-13 02:20:47 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-12-13 10:48:22 +0100 |
commit | 098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d (patch) | |
tree | 45d9b5fa5d768402e7eb51ae6a755dea2cb89e6f /test | |
parent | a6f10cf7f4245f2dfcf2fef5fab5255b6fca119f (diff) | |
download | scala-098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d.tar.gz scala-098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d.tar.bz2 scala-098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d.zip |
typedIdent no longer destroys attachments
When transforming Idents to qualified Selects, typedIdent used to forget
about carrying original attachments to the resulting tree. Not anymore.
Diffstat (limited to 'test')
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 |