From a2b523a39b4e56eb9ab5d9a5639f5b59d425e354 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 2 Oct 2013 17:21:27 +0200 Subject: blackbox restriction #1: can't refine the official return type When an application of a blackbox macro expands into a tree `x`, the expansion is wrapped into a type ascription `(x: T)`, where `T` is the declared return type of the blackbox macro with type arguments and path dependencies applied in consistency with the particular macro application being expanded. This invalidates blackbox macros as an implementation vehicle of type providers. --- .../neg/macro-blackbox-structural/Impls_Macros_1.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala (limited to 'test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala') diff --git a/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala b/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala new file mode 100644 index 0000000000..08f1c21e89 --- /dev/null +++ b/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.language.experimental.macros + +object Macros { + def impl(c: scala.reflect.macros.BlackboxContext) = { + import c.universe._ + q""" + trait Foo { + def x = 2 + } + new Foo {} + """ + } + + def foo = macro impl +} \ No newline at end of file -- cgit v1.2.3