diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-07-15 14:32:25 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-07-15 14:32:25 +0200 |
commit | 87eda3ada3f2bab806500e95ee6d902bec57ff70 (patch) | |
tree | 9e9d547f8afd4722bb452dcfa0e055a9894089f6 /test | |
parent | 2a137d00faddfc3c23ba52d5d0876e974d547798 (diff) | |
parent | 70afd0544e86456515caee62a3eaac41882d892f (diff) | |
download | scala-87eda3ada3f2bab806500e95ee6d902bec57ff70.tar.gz scala-87eda3ada3f2bab806500e95ee6d902bec57ff70.tar.bz2 scala-87eda3ada3f2bab806500e95ee6d902bec57ff70.zip |
Merge pull request #3845 from xeno-by/topic/attachment-subclassing
relaxes attachment-matching rules
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/macro-attachments/Macros_1.scala | 19 | ||||
-rw-r--r-- | test/files/pos/macro-attachments/Test_2.scala | 3 | ||||
-rw-r--r-- | test/files/run/reflection-attachments.check | 0 |
3 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 diff --git a/test/files/run/reflection-attachments.check b/test/files/run/reflection-attachments.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/reflection-attachments.check |