diff options
Diffstat (limited to 'test/files/run/t6379/Macros_1.scala')
-rw-r--r-- | test/files/run/t6379/Macros_1.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/t6379/Macros_1.scala b/test/files/run/t6379/Macros_1.scala new file mode 100644 index 0000000000..4f3daf4978 --- /dev/null +++ b/test/files/run/t6379/Macros_1.scala @@ -0,0 +1,26 @@ +import scala.reflect.macros.whitebox._ +import scala.language.experimental.macros +import java.io._ + +object Macros { + def impl(c: Context) = { + var messages = List[String]() + def println(msg: String) = messages :+= msg + + import c.universe._ + def test(sym: MethodSymbol): Unit = { + println(s"uninitialized ${sym.name}: ${sym.exceptions}") + sym.info + println(s"initialized ${sym.name}: ${sym.exceptions}") + } + + println("compile-time") + test(typeOf[Closeable].declaration(TermName("close")).asMethod) + test(typeOf[Product1[_]].declaration(TermName("productElement")).asMethod) + test(c.mirror.staticClass("Reader").info.decl(TermName("read")).asMethod) + + q"..${messages.map(msg => q"println($msg)")}" + } + + def foo: Any = macro impl +}
\ No newline at end of file |