File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1429,11 +1429,13 @@ static void determineBestChoicesInContext(
14291429 }
14301430 }
14311431
1432- // If the parameter is `Any` we assume that all candidates are
1433- // convertible to it, which makes it a perfect match. The solver
1434- // would then decide whether erasing to an existential is preferable.
1435- if (paramType->isAny ())
1436- return 1 ;
1432+ // If the parameter is `Any`, it's generally a perfect match, except
1433+ // when the candidate is an existential metatype. In that case, it would
1434+ // cause (T.Type) -> (Any) disjunctions to outrank (T.Type) -> (Any.Type).
1435+ if (paramType->isAny () &&
1436+ !candidateType->is <ExistentialMetatypeType>()) {
1437+ return 1.0 ;
1438+ }
14371439
14381440 // Check if a candidate could be matched to a parameter by
14391441 // an existential opening.
You can’t perform that action at this time.
0 commit comments