Parameterize conformance lookup on whether "missing" conformances are allowed.

Many clients of the conformance lookup operations would prefer to get
an invalid conformance (== there is no conformance) rather than a
missing conformance. Parameterize the conformance lookup operations so
that most callers won't see missing conformances, by filtering them
out at the end. Opt-in those callers that do want to see missing
conformances so they can be diagnosed.
This commit is contained in:
Doug Gregor
2021-07-30 07:54:23 -07:00
parent de44396bd2
commit f9c34756ef
13 changed files with 75 additions and 45 deletions

View File

@@ -6225,7 +6225,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
case ConstraintKind::LiteralConformsTo: {
// Check whether this type conforms to the protocol.
auto conformance = DC->getParentModule()->lookupConformance(
type, protocol);
type, protocol, /*allowMissing=*/true);
if (conformance) {
return recordConformance(conformance);
}