Skip to content

Commit b59353b

Browse files
committed
Sema: Change a few checkConformance() calls to lookupConformance()
1 parent de57a74 commit b59353b

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

lib/Sema/DerivedConformanceCodable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static EnumDecl *validateCodingKeysType(const DerivedConformance &derived,
269269

270270
// Ensure that the type we found conforms to the CodingKey protocol.
271271
auto *codingKeyProto = C.getProtocol(KnownProtocolKind::CodingKey);
272-
if (!derived.getParentModule()->checkConformance(codingKeysType, codingKeyProto)) {
272+
if (!derived.getParentModule()->lookupConformance(codingKeysType, codingKeyProto)) {
273273
// If CodingKeys is a typealias which doesn't point to a valid nominal type,
274274
// codingKeysTypeDecl will be nullptr here. In that case, we need to warn on
275275
// the location of the usage, since there isn't an underlying type to

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ bool swift::diagnoseNonSendableTypes(
10491049
return false;
10501050

10511051
// FIXME: More detail for unavailable conformances.
1052-
auto conformance = module->checkConformance(type, proto);
1052+
auto conformance = module->lookupConformance(type, proto, /*allowMissing=*/true);
10531053
if (conformance.isInvalid() || conformance.hasUnavailableConformance()) {
10541054
return diagnoseSingleNonSendableType(
10551055
type, fromContext, inDerivedConformance, loc, diagnose);

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4339,9 +4339,9 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
43394339
// a member that could in turn satisfy *this* requirement.
43404340
auto derivableProto = cast<ProtocolDecl>(derivable->getDeclContext());
43414341
auto conformance =
4342-
DC->getParentModule()->checkConformance(Adoptee, derivableProto);
4342+
DC->getParentModule()->lookupConformance(Adoptee, derivableProto);
43434343
if (conformance.isConcrete()) {
4344-
(void)conformance.getConcrete()->getWitnessDecl(derivable);
4344+
(void) conformance.getConcrete()->getWitnessDecl(derivable);
43454345
}
43464346
}
43474347
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol P {
4+
func hash(into: inout Hasher)
5+
}
6+
7+
// P.hash(into:) is witnessed by the S.hash(into:) that is synthesized
8+
// for the Hashable conformance.
9+
struct S: P, Hashable {}
10+
11+
struct G<T> {}
12+
13+
extension G: Equatable where T: Equatable {}
14+
extension G: Hashable where T: Hashable {}
15+
16+
// Same here, but the conformance is conditional.
17+
extension G: P where T: P & Hashable {}

0 commit comments

Comments
 (0)