diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-06-03 11:08:50 -0700 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-06-03 11:08:50 -0700 |
commit | 69887ddd682057c4787e2e4377830390faf8ecf1 (patch) | |
tree | 1158f24dd50dac397e867a6d2d861171e7335c4f /test/files/run/macro-expand-tparams-prefix/Impls_1.scala | |
parent | c1cd65bb5276b715141df6d09fc95b0c44d2b4c2 (diff) | |
parent | 82f0925b69db8b5f9a3b10f58926c574433ca423 (diff) | |
download | scala-69887ddd682057c4787e2e4377830390faf8ecf1.tar.gz scala-69887ddd682057c4787e2e4377830390faf8ecf1.tar.bz2 scala-69887ddd682057c4787e2e4377830390faf8ecf1.zip |
Merge pull request #2577 from scalamacros/pullrequest/paradise
Backport from paradise/macros
Diffstat (limited to 'test/files/run/macro-expand-tparams-prefix/Impls_1.scala')
-rw-r--r-- | test/files/run/macro-expand-tparams-prefix/Impls_1.scala | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala new file mode 100644 index 0000000000..e92396d1b4 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala @@ -0,0 +1,40 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.Context + +object Impls1 { + def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) + c.Expr[Unit](body) + } +} + +object Impls2 { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val T = implicitly[c.WeakTypeTag[T]] + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) + c.Expr[Unit](body) + } +} + +object Impls345 { + def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { + import c.universe._ + c.Expr(Block(List( + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(())))) + } +} + +object Macros4 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + } + } +} |