@@ -45,14 +45,21 @@ object Implicits {
45
45
protected def filterMatching (pt : Type )(implicit ctx : Context ): List [TermRef ] = track(" filterMatching" ) {
46
46
47
47
def refMatches (ref : TermRef )(implicit ctx : Context ) = {
48
-
48
+
49
49
def discardForView (tpw : Type , argType : Type ): Boolean = tpw match {
50
- case tpw : MethodType =>
51
- tpw.isImplicit ||
52
- tpw.paramTypes.length != 1 ||
53
- ! (argType <:< tpw.paramTypes.head)(ctx.fresh.withExploreTyperState)
54
- case tpw : PolyType =>
55
- discardForView((new WildApprox ) apply tpw.resultType, argType)
50
+ case mt : MethodType =>
51
+ mt.isImplicit ||
52
+ mt.paramTypes.length != 1 ||
53
+ ! (argType <:< mt.paramTypes.head)(ctx.fresh.withExploreTyperState)
54
+ case poly : PolyType =>
55
+ poly.resultType match {
56
+ case mt : MethodType =>
57
+ mt.isImplicit ||
58
+ mt.paramTypes.length != 1 ||
59
+ ! (argType <:< ((new WildApprox ) apply mt.paramTypes.head))(ctx.fresh.withExploreTyperState)
60
+ case rtp =>
61
+ discardForView((new WildApprox ) apply rtp, argType)
62
+ }
56
63
case tpw : TermRef =>
57
64
false // can't discard overloaded refs
58
65
case tpw =>
@@ -65,7 +72,7 @@ object Implicits {
65
72
true
66
73
}
67
74
}
68
-
75
+
69
76
def discardForValueType (tpw : Type ): Boolean = tpw match {
70
77
case mt : MethodType => ! mt.isImplicit
71
78
case mt : PolyType => discardForValueType(tpw.resultType)
@@ -74,7 +81,7 @@ object Implicits {
74
81
75
82
def discard = pt match {
76
83
case pt : ViewProto => discardForView(ref.widen, pt.argType)
77
- case _ : ValueType => ! defn.isFunctionType(pt) && discardForValueType(ref.widen)
84
+ case _ : ValueType => ! defn.isFunctionType(pt) && discardForValueType(ref.widen)
78
85
case _ => false
79
86
}
80
87
@@ -146,7 +153,7 @@ object Implicits {
146
153
}
147
154
}
148
155
149
- private def computeEligible (tp : Type ): List [TermRef ] = ctx.traceIndented(i " computeEligible $tp in $refs%, % " , implicitsDetailed) {
156
+ private def computeEligible (tp : Type ): List [TermRef ] = /* >|> */ ctx.traceIndented(i " computeEligible $tp in $refs%, % " , implicitsDetailed) /* <|< */ {
150
157
if (monitored) record(s " check eligible refs in ctx " , refs.length)
151
158
val ownEligible = filterMatching(tp)
152
159
if (outerCtx == NoContext ) ownEligible
0 commit comments