diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-02 16:33:48 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-02 16:33:48 +0200 |
commit | f196ee2ee7807f007d2397a4d6168800900ae7fa (patch) | |
tree | 475de2822a89d25217acc0b7ff0fbc7f3d798519 /test/files/pos/macro-attachments | |
parent | 61dbf4ac711094db38a4b2dfb853d88499c2b1a5 (diff) | |
parent | 01f2d279e84fda300176e83ee94c17c08ad1dc3f (diff) | |
download | scala-f196ee2ee7807f007d2397a4d6168800900ae7fa.tar.gz scala-f196ee2ee7807f007d2397a4d6168800900ae7fa.tar.bz2 scala-f196ee2ee7807f007d2397a4d6168800900ae7fa.zip |
Merge commit '01f2d27' into merge/2.11-to-2.12-is-it-really-sept-2-already-where-was-summer
Diffstat (limited to 'test/files/pos/macro-attachments')
-rw-r--r-- | test/files/pos/macro-attachments/Macros_1.scala | 19 | ||||
-rw-r--r-- | test/files/pos/macro-attachments/Test_2.scala | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/files/pos/macro-attachments/Macros_1.scala b/test/files/pos/macro-attachments/Macros_1.scala new file mode 100644 index 0000000000..38d05d5b85 --- /dev/null +++ b/test/files/pos/macro-attachments/Macros_1.scala @@ -0,0 +1,19 @@ +import scala.language.experimental.macros +import scala.reflect.macros.whitebox.Context + +trait Base +class Att extends Base + +object Macros { + def impl(c: Context) = { + import c.universe._ + import c.internal._ + import decorators._ + val dummy = q"x" + dummy.updateAttachment(new Att) + if (dummy.attachments.get[Base].isEmpty) c.abort(c.enclosingPosition, "that's not good") + q"()" + } + + def foo: Any = macro impl +}
\ No newline at end of file diff --git a/test/files/pos/macro-attachments/Test_2.scala b/test/files/pos/macro-attachments/Test_2.scala new file mode 100644 index 0000000000..acfddae942 --- /dev/null +++ b/test/files/pos/macro-attachments/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.foo +}
\ No newline at end of file |