diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-02-27 16:27:10 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-02-27 16:27:10 +0100 |
commit | 1117be8418525ce20af847bdcfdbbe66b9cf3d4d (patch) | |
tree | a76003c58f8b89ce1b5d3d5b6d9ec39684b363d2 /test/files/pos/t7190.scala | |
parent | 3b85c3d22b9d62e9e07c53f235ae8e889581ddc8 (diff) | |
download | scala-1117be8418525ce20af847bdcfdbbe66b9cf3d4d.tar.gz scala-1117be8418525ce20af847bdcfdbbe66b9cf3d4d.tar.bz2 scala-1117be8418525ce20af847bdcfdbbe66b9cf3d4d.zip |
SI-7190 macros no longer give rise to bridges
Amazingly enough, this got through all the testing we performed. But now
erasure knows that it shouldn't generate bridges for macro methods.
Diffstat (limited to 'test/files/pos/t7190.scala')
-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 |