File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -1434,11 +1434,22 @@ static void determineBestChoicesInContext(
14341434 }
14351435 }
14361436
1437- // If the parameter is `Any` we assume that all candidates are
1438- // convertible to it, which makes it a perfect match. The solver
1439- // would then decide whether erasing to an existential is preferable.
1440- if (paramType->isAny ())
1441- return 1 ;
1437+ if (paramType->isAnyExistentialType ()) {
1438+ // If the parameter is `Any` we assume that all candidates are
1439+ // convertible to it, which makes it a perfect match. The solver
1440+ // would then decide whether erasing to an existential is preferable.
1441+ if (paramType->isAny ())
1442+ return 1 ;
1443+
1444+ // If the parameter is `Any.Type` we assume that all metatype
1445+ // candidates are convertible to it.
1446+ if (auto *EMT = paramType->getAs <ExistentialMetatypeType>()) {
1447+ if (EMT->getExistentialInstanceType ()->isAny () &&
1448+ (candidateType->is <ExistentialMetatypeType>() ||
1449+ candidateType->is <MetatypeType>()))
1450+ return 1 ;
1451+ }
1452+ }
14421453
14431454 // Check if a candidate could be matched to a parameter by
14441455 // an existential opening.
You can’t perform that action at this time.
0 commit comments