diff options
author | Paul Phillips <paulp@improving.org> | 2013-03-05 07:57:23 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-03-05 07:57:23 -0800 |
commit | 1a84c86ce400d0a80065fa8d23a9506dc19e92f0 (patch) | |
tree | bf70ba1f113b8bb535850b5e42f27a51dcb2eff4 /test | |
parent | 5d54cf9e375d796c59b1dd488c15f88f4bfb14d6 (diff) | |
parent | 1117be8418525ce20af847bdcfdbbe66b9cf3d4d (diff) | |
download | scala-1a84c86ce400d0a80065fa8d23a9506dc19e92f0.tar.gz scala-1a84c86ce400d0a80065fa8d23a9506dc19e92f0.tar.bz2 scala-1a84c86ce400d0a80065fa8d23a9506dc19e92f0.zip |
Merge pull request #2178 from scalamacros/ticket/7190
SI-7190 macros no longer give rise to bridges
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t7190.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/pos/t7190.scala b/test/files/pos/t7190.scala new file mode 100644 index 0000000000..f7ccded1b4 --- /dev/null +++ b/test/files/pos/t7190.scala @@ -0,0 +1,26 @@ +import scala.language.experimental.macros +import scala.reflect.macros._ + +trait A[T] { + def min[U >: T](implicit ord: Numeric[U]): T = macro A.min[T, U] +} + +object A { + def min[T: c.WeakTypeTag, U >: T: c.WeakTypeTag](c: Context)(ord: c.Expr[Numeric[U]]): c.Expr[T] = { + c.universe.reify { + ord.splice.zero.asInstanceOf[T] + } + } +} + +class B extends A[Int] { + override def min[U >: Int](implicit ord: Numeric[U]): Int = macro B.min[U] +} + +object B { + def min[U >: Int: c.WeakTypeTag](c: Context)(ord: c.Expr[Numeric[U]]): c.Expr[Int] = { + c.universe.reify { + ord.splice.zero.asInstanceOf[Int] + } + } +}
\ No newline at end of file |