diff options
author | martende <entcrd@yahoo.com> | 2012-11-27 14:08:53 +0100 |
---|---|---|
committer | martende <entcrd@yahoo.com> | 2012-11-27 14:08:53 +0100 |
commit | 597a949e8700d585dc89979b66375367ac73acc2 (patch) | |
tree | 1f8e967bf4d82c26d20ae0e3ce293509fab1750b /test/files/run | |
parent | 2a8291a3568abc848e79acaacd82e90932a77c8a (diff) | |
download | scala-597a949e8700d585dc89979b66375367ac73acc2.tar.gz scala-597a949e8700d585dc89979b66375367ac73acc2.tar.bz2 scala-597a949e8700d585dc89979b66375367ac73acc2.zip |
SI-5753 macros cannot be loaded when inherited from a class or a trait
enclClass should be taken from Tree otherwise we can jump to declaration
class/trait.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t5753_1.check | 1 | ||||
-rw-r--r-- | test/files/run/t5753_1.flags | 1 | ||||
-rw-r--r-- | test/files/run/t5753_1/Impls_Macros_1.scala | 10 | ||||
-rw-r--r-- | test/files/run/t5753_1/Test_2.scala | 4 | ||||
-rw-r--r-- | test/files/run/t5753_2.check | 1 | ||||
-rw-r--r-- | test/files/run/t5753_2.flags | 1 | ||||
-rw-r--r-- | test/files/run/t5753_2/Impls_Macros_1.scala | 10 | ||||
-rw-r--r-- | test/files/run/t5753_2/Test_2.scala | 4 |
8 files changed, 32 insertions, 0 deletions
diff --git a/test/files/run/t5753_1.check b/test/files/run/t5753_1.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/files/run/t5753_1.check @@ -0,0 +1 @@ +42
\ No newline at end of file diff --git a/test/files/run/t5753_1.flags b/test/files/run/t5753_1.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/t5753_1.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/t5753_1/Impls_Macros_1.scala b/test/files/run/t5753_1/Impls_Macros_1.scala new file mode 100644 index 0000000000..1664301f5f --- /dev/null +++ b/test/files/run/t5753_1/Impls_Macros_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +trait Impls { + def impl(c: Context)(x: c.Expr[Any]) = x +} + +object Macros extends Impls { + def foo(x: Any) = macro impl +}
\ No newline at end of file diff --git a/test/files/run/t5753_1/Test_2.scala b/test/files/run/t5753_1/Test_2.scala new file mode 100644 index 0000000000..a2777638bc --- /dev/null +++ b/test/files/run/t5753_1/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros._ + println(foo(42)) +}
\ No newline at end of file diff --git a/test/files/run/t5753_2.check b/test/files/run/t5753_2.check new file mode 100644 index 0000000000..f70d7bba4a --- /dev/null +++ b/test/files/run/t5753_2.check @@ -0,0 +1 @@ +42
\ No newline at end of file diff --git a/test/files/run/t5753_2.flags b/test/files/run/t5753_2.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/t5753_2.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/t5753_2/Impls_Macros_1.scala b/test/files/run/t5753_2/Impls_Macros_1.scala new file mode 100644 index 0000000000..e23c0b938b --- /dev/null +++ b/test/files/run/t5753_2/Impls_Macros_1.scala @@ -0,0 +1,10 @@ +import scala.reflect.macros.{Context => Ctx} + +trait Macro_T { + def foo[T](c: Ctx)(s: c.Expr[T]) = s +} + +object Macros { + def foo[T](s: T) = macro Impls.foo[T] + object Impls extends Macro_T +} diff --git a/test/files/run/t5753_2/Test_2.scala b/test/files/run/t5753_2/Test_2.scala new file mode 100644 index 0000000000..a2777638bc --- /dev/null +++ b/test/files/run/t5753_2/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros._ + println(foo(42)) +}
\ No newline at end of file |