File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -92,23 +92,26 @@ object Implicits {
92
92
93
93
def viewCandidateKind (tpw : Type , argType : Type , resType : Type ): Candidate .Kind = {
94
94
95
- def methodCandidateKind (mt : MethodType , formal : => Type ) =
95
+ def methodCandidateKind (mt : MethodType , approx : Boolean ) =
96
96
if (! mt.isImplicitMethod &&
97
- mt.paramInfos.lengthCompare(1 ) == 0 &&
98
- ctx.test(implicit ctx => argType relaxed_<:< formal))
97
+ mt.paramInfos.lengthCompare(1 ) == 0 && {
98
+ var formal = widenSingleton(mt.paramInfos.head)
99
+ if (approx) formal = wildApprox(formal)
100
+ ctx.test(implicit ctx => argType relaxed_<:< formal)
101
+ })
99
102
Candidate .Conversion
100
103
else
101
104
Candidate .None
102
105
103
106
tpw match {
104
107
case mt : MethodType =>
105
- methodCandidateKind(mt, widenSingleton(mt.paramInfos.head) )
108
+ methodCandidateKind(mt, approx = false )
106
109
case poly : PolyType =>
107
110
// We do not need to call ProtoTypes#constrained on `poly` because
108
111
// `candidateKind` is always called with mode TypevarsMissContext enabled.
109
112
poly.resultType match {
110
113
case mt : MethodType =>
111
- methodCandidateKind(mt, wildApprox(widenSingleton(mt.paramInfos.head)) )
114
+ methodCandidateKind(mt, approx = true )
112
115
case rtp =>
113
116
viewCandidateKind(wildApprox(rtp), argType, resType)
114
117
}
You can’t perform that action at this time.
0 commit comments