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 @@ -1429,11 +1429,22 @@ 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 (paramType->isAnyExistentialType ()) {
1433+ // If the parameter is `Any` we assume that all candidates are
1434+ // convertible to it, which makes it a perfect match. The solver
1435+ // would then decide whether erasing to an existential is preferable.
1436+ if (paramType->isAny ())
1437+ return 1 ;
1438+
1439+ // If the parameter is `Any.Type` we assume that all metatype
1440+ // candidates are convertible to it.
1441+ if (auto *EMT = paramType->getAs <ExistentialMetatypeType>()) {
1442+ if (EMT->getExistentialInstanceType ()->isAny () &&
1443+ (candidateType->is <ExistentialMetatypeType>() ||
1444+ candidateType->is <MetatypeType>()))
1445+ return 1 ;
1446+ }
1447+ }
14371448
14381449 // Check if a candidate could be matched to a parameter by
14391450 // an existential opening.
You can’t perform that action at this time.
0 commit comments