File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
src/compiler/scala/tools/nsc/transform Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -447,6 +447,7 @@ abstract class Erasure extends AddInterfaces
447447 def checkPair (member : Symbol , other : Symbol ) {
448448 val otpe = specialErasure(root)(other.tpe)
449449 val bridgeNeeded = exitingErasure (
450+ ! member.isMacro &&
450451 ! (other.tpe =:= member.tpe) &&
451452 ! (deconstMap(other.tpe) =:= deconstMap(member.tpe)) &&
452453 { var e = bridgesScope.lookupEntry(member.name)
Original file line number Diff line number Diff line change 1+ import scala .language .experimental .macros
2+ import scala .reflect .macros ._
3+
4+ trait A [T ] {
5+ def min [U >: T ](implicit ord : Numeric [U ]): T = macro A .min[T , U ]
6+ }
7+
8+ object A {
9+ def min [T : c.WeakTypeTag , U >: T : c.WeakTypeTag ](c : Context )(ord : c.Expr [Numeric [U ]]): c.Expr [T ] = {
10+ c.universe.reify {
11+ ord.splice.zero.asInstanceOf [T ]
12+ }
13+ }
14+ }
15+
16+ class B extends A [Int ] {
17+ override def min [U >: Int ](implicit ord : Numeric [U ]): Int = macro B .min[U ]
18+ }
19+
20+ object B {
21+ def min [U >: Int : c.WeakTypeTag ](c : Context )(ord : c.Expr [Numeric [U ]]): c.Expr [Int ] = {
22+ c.universe.reify {
23+ ord.splice.zero.asInstanceOf [Int ]
24+ }
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments