Skip to content

Commit bb78171

Browse files
committed
[NFC] forEachMissingConformance doesn't use module
1 parent b5a8ebf commit bb78171

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

include/swift/AST/ProtocolConformanceRef.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ProtocolConformanceRef {
128128
/// Determine whether this conformance (or a conformance it depends on)
129129
/// involves a "missing" conformance anywhere. Such conformances
130130
/// cannot be depended on to always exist.
131-
bool hasMissingConformance(ModuleDecl *module) const;
131+
bool hasMissingConformance() const;
132132

133133
/// Enumerate the missing conformances in this conformance.
134134
///
@@ -140,7 +140,6 @@ class ProtocolConformanceRef {
140140
/// \returns \c true if any invocation of \c fn returned true,
141141
/// \c false otherwise.
142142
bool forEachMissingConformance(
143-
ModuleDecl *module,
144143
llvm::function_ref<bool(BuiltinProtocolConformance *missing)> fn) const;
145144

146145
using OpaqueValue = void*;

lib/AST/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ ProtocolConformanceRef ModuleDecl::lookupConformance(Type type,
16961696
// replace the result with an "invalid" result.
16971697
if (!allowMissing &&
16981698
shouldCreateMissingConformances(type, protocol) &&
1699-
result.hasMissingConformance(this))
1699+
result.hasMissingConformance())
17001700
return ProtocolConformanceRef::forInvalid();
17011701

17021702
return result;

lib/AST/ProtocolConformanceRef.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,22 +319,21 @@ bool ProtocolConformanceRef::hasUnavailableConformance() const {
319319
return false;
320320
}
321321

322-
bool ProtocolConformanceRef::hasMissingConformance(ModuleDecl *module) const {
323-
return forEachMissingConformance(module,
322+
bool ProtocolConformanceRef::hasMissingConformance() const {
323+
return forEachMissingConformance(
324324
[](BuiltinProtocolConformance *builtin) {
325325
return true;
326326
});
327327
}
328328

329329
bool ProtocolConformanceRef::forEachMissingConformance(
330-
ModuleDecl *module,
331330
llvm::function_ref<bool(BuiltinProtocolConformance *missing)> fn) const {
332331
if (isInvalid() || isAbstract())
333332
return false;
334333

335334
if (isPack()) {
336335
for (auto conformance : getPack()->getPatternConformances()) {
337-
if (conformance.forEachMissingConformance(module, fn))
336+
if (conformance.forEachMissingConformance(fn))
338337
return true;
339338
}
340339

@@ -352,7 +351,7 @@ bool ProtocolConformanceRef::forEachMissingConformance(
352351
// Check conformances that are part of this conformance.
353352
auto subMap = concreteConf->getSubstitutionMap();
354353
for (auto conformance : subMap.getConformances()) {
355-
if (conformance.forEachMissingConformance(module, fn))
354+
if (conformance.forEachMissingConformance(fn))
356355
return true;
357356
}
358357

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8414,8 +8414,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
84148414
increaseScore(SK_Unavailable, locator);
84158415

84168416
unsigned numMissing = 0;
8417-
conformance.forEachMissingConformance(DC->getParentModule(),
8418-
[&numMissing](auto *missing) {
8417+
conformance.forEachMissingConformance([&numMissing](auto *missing) {
84198418
++numMissing;
84208419
return false;
84218420
});

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7672,7 +7672,7 @@ ConstraintSystem::inferKeyPathLiteralCapability(KeyPathExpr *keyPath) {
76727672
auto conformance = lookupConformance(argTy, sendable);
76737673
isSendable &=
76747674
bool(conformance) &&
7675-
!conformance.hasMissingConformance(DC->getParentModule());
7675+
!conformance.hasMissingConformance();
76767676
}
76777677
}
76787678
}

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ bool swift::isSendableType(ModuleDecl *module, Type type) {
701701
return false;
702702

703703
// Look for missing Sendable conformances.
704-
return !conformance.forEachMissingConformance(module,
704+
return !conformance.forEachMissingConformance(
705705
[](BuiltinProtocolConformance *missing) {
706706
return missing->getProtocol()->isSpecificProtocol(
707707
KnownProtocolKind::Sendable);
@@ -1082,7 +1082,7 @@ bool swift::diagnoseNonSendableTypes(
10821082

10831083
// Walk the conformance, diagnosing any missing Sendable conformances.
10841084
bool anyMissing = false;
1085-
conformance.forEachMissingConformance(module,
1085+
conformance.forEachMissingConformance(
10861086
[&](BuiltinProtocolConformance *missing) {
10871087
if (diagnoseSingleNonSendableType(
10881088
missing->getType(), fromContext,
@@ -1281,7 +1281,7 @@ namespace {
12811281
return true;
12821282

12831283
// Look for missing Sendable conformances.
1284-
return conformance.forEachMissingConformance(module,
1284+
return conformance.forEachMissingConformance(
12851285
[&](BuiltinProtocolConformance *missing) {
12861286
// For anything other than Sendable, fail.
12871287
if (missing->getProtocol() != sendableProto)

0 commit comments

Comments
 (0)