Skip to content

Commit d75b34b

Browse files
authored
Merge pull request swiftlang#38753 from CodaFi/modulo-modules
[NFC] Remove Unused Module Parameter to Conformance Lookup
2 parents 7cf32d2 + 8082205 commit d75b34b

20 files changed

+20
-37
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,16 +3239,13 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
32393239
/// Look for conformances of this nominal type to the given
32403240
/// protocol.
32413241
///
3242-
/// \param module The module from which we initiate the search.
3243-
/// FIXME: This is currently unused.
3244-
///
32453242
/// \param protocol The protocol whose conformance is requested.
32463243
/// \param conformances Will be populated with the set of protocol
32473244
/// conformances found for this protocol.
32483245
///
32493246
/// \returns true if any conformances were found.
32503247
bool lookupConformance(
3251-
ModuleDecl *module, ProtocolDecl *protocol,
3248+
ProtocolDecl *protocol,
32523249
SmallVectorImpl<ProtocolConformance *> &conformances) const;
32533250

32543251
/// Retrieve all of the protocols that this nominal type conforms to.

lib/AST/ConformanceLookupTable.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,6 @@ void ConformanceLookupTable::registerProtocolConformance(
950950
}
951951

952952
bool ConformanceLookupTable::lookupConformance(
953-
ModuleDecl *module,
954953
NominalTypeDecl *nominal,
955954
ProtocolDecl *protocol,
956955
SmallVectorImpl<ProtocolConformance *> &conformances) {

lib/AST/ConformanceLookupTable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ class ConformanceLookupTable {
445445
/// conformances found for this protocol and nominal type.
446446
///
447447
/// \returns true if any conformances were found.
448-
bool lookupConformance(ModuleDecl *module,
449-
NominalTypeDecl *nominal,
448+
bool lookupConformance(NominalTypeDecl *nominal,
450449
ProtocolDecl *protocol,
451450
SmallVectorImpl<ProtocolConformance *> &conformances);
452451

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3133,7 +3133,7 @@ bool ValueDecl::canInferObjCFromRequirement(ValueDecl *requirement) {
31333133
// If the nominal type doesn't conform to the protocol at all, we
31343134
// cannot infer @objc no matter what we do.
31353135
SmallVector<ProtocolConformance *, 1> conformances;
3136-
if (!nominal->lookupConformance(getModuleContext(), proto, conformances))
3136+
if (!nominal->lookupConformance(proto, conformances))
31373137
return false;
31383138

31393139
// If any of the conformances is attributed to the context in which

lib/AST/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ LookupConformanceInModuleRequest::evaluate(
12321232

12331233
// Find the (unspecialized) conformance.
12341234
SmallVector<ProtocolConformance *, 2> conformances;
1235-
if (!nominal->lookupConformance(mod, protocol, conformances)) {
1235+
if (!nominal->lookupConformance(protocol, conformances)) {
12361236
if (!protocol->isSpecificProtocol(KnownProtocolKind::Sendable))
12371237
return getInvalidOrMissingConformance(type, protocol);
12381238

lib/AST/ProtocolConformance.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,11 +1284,10 @@ void NominalTypeDecl::prepareConformanceTable() const {
12841284
}
12851285

12861286
bool NominalTypeDecl::lookupConformance(
1287-
ModuleDecl *module, ProtocolDecl *protocol,
1287+
ProtocolDecl *protocol,
12881288
SmallVectorImpl<ProtocolConformance *> &conformances) const {
12891289
prepareConformanceTable();
12901290
return ConformanceTable->lookupConformance(
1291-
module,
12921291
const_cast<NominalTypeDecl *>(this),
12931292
protocol,
12941293
conformances);

lib/AST/Type.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,9 +2639,7 @@ getForeignRepresentable(Type type, ForeignLanguage language,
26392639
if (auto objcBridgeable
26402640
= ctx.getProtocol(KnownProtocolKind::ObjectiveCBridgeable)) {
26412641
SmallVector<ProtocolConformance *, 1> conformances;
2642-
if (nominal->lookupConformance(dc->getParentModule(),
2643-
objcBridgeable,
2644-
conformances))
2642+
if (nominal->lookupConformance(objcBridgeable, conformances))
26452643
break;
26462644
}
26472645
}

lib/ClangImporter/ImportType.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,7 @@ namespace {
589589
auto nominal = element->getAnyNominal();
590590
auto simdscalar = Impl.SwiftContext.getProtocol(KnownProtocolKind::SIMDScalar);
591591
SmallVector<ProtocolConformance *, 2> conformances;
592-
if (simdscalar && nominal->lookupConformance(nominal->getParentModule(),
593-
simdscalar, conformances)) {
592+
if (simdscalar && nominal->lookupConformance(simdscalar, conformances)) {
594593
// Element type conforms to SIMDScalar. Get the SIMDn generic type
595594
// if it exists.
596595
SmallString<8> name("SIMD");
@@ -2807,8 +2806,7 @@ bool ClangImporter::Implementation::matchesHashableBound(Type type) {
28072806
auto hashable = SwiftContext.getProtocol(KnownProtocolKind::Hashable);
28082807
SmallVector<ProtocolConformance *, 2> conformances;
28092808
return hashable &&
2810-
nominal->lookupConformance(nominal->getParentModule(), hashable,
2811-
conformances);
2809+
nominal->lookupConformance(hashable, conformances);
28122810
}
28132811

28142812
return false;

lib/Frontend/ModuleInterfaceSupport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ class InheritedProtocolCollector {
502502
const NominalTypeDecl *nominal,
503503
ProtocolDecl *proto) {
504504
SmallVector<ProtocolConformance *, 4> conformances;
505-
nominal->lookupConformance(M, proto, conformances);
505+
nominal->lookupConformance(proto, conformances);
506506
return llvm::all_of(conformances,
507507
[M](const ProtocolConformance *conformance) -> bool {
508508
return M == conformance->getDeclContext()->getParentModule();

lib/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4349,7 +4349,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
43494349
// Check for conformance to the literal protocol.
43504350
if (auto *NTD = T->getAnyNominal()) {
43514351
SmallVector<ProtocolConformance *, 2> conformances;
4352-
if (NTD->lookupConformance(CurrModule, P, conformances)) {
4352+
if (NTD->lookupConformance(P, conformances)) {
43534353
addTypeAnnotation(builder, T);
43544354
builder.setExpectedTypeRelation(typeRelation);
43554355
return;

0 commit comments

Comments
 (0)