Skip to content

Sema: Remove a dead param on TypeChecker::conformsToProtocol #34904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions lib/Sema/TypeCheckProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4849,15 +4849,11 @@ TypeChecker::containsProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC,
}

ProtocolConformanceRef
TypeChecker::conformsToProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC,
SourceLoc ComplainLoc) {
TypeChecker::conformsToProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC) {
// Look up conformance in the module.
ModuleDecl *M = DC->getParentModule();
auto lookupResult = M->lookupConformance(T, Proto);
if (lookupResult.isInvalid()) {
if (ComplainLoc.isValid()) {
diagnoseConformanceFailure(T, Proto, DC, ComplainLoc);
}
return ProtocolConformanceRef::forInvalid();
}

Expand All @@ -4869,16 +4865,8 @@ TypeChecker::conformsToProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC,
// If we have a conditional requirements that
// we need to check, do so now.
if (!condReqs->empty()) {
// Figure out the location of the conditional conformance.
auto conformanceDC = lookupResult.getConcrete()->getDeclContext();
SourceLoc noteLoc;
if (auto ext = dyn_cast<ExtensionDecl>(conformanceDC))
noteLoc = ext->getLoc();
else
noteLoc = cast<NominalTypeDecl>(conformanceDC)->getLoc();

auto conditionalCheckResult = checkGenericArguments(
DC, ComplainLoc, noteLoc, T,
DC, SourceLoc(), SourceLoc(), T,
{lookupResult.getRequirement()->getSelfInterfaceType()}, *condReqs,
[](SubstitutableType *dependentType) { return Type(dependentType); });
switch (conditionalCheckResult) {
Expand Down
8 changes: 1 addition & 7 deletions lib/Sema/TypeChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -763,16 +763,10 @@ ProtocolConformanceRef containsProtocol(Type T, ProtocolDecl *Proto,
/// \param DC The context in which to check conformance. This affects, for
/// example, extension visibility.
///
/// \param ComplainLoc If valid, then this function will emit diagnostics if
/// T does not conform to the given protocol. The primary diagnostic will
/// be placed at this location, with notes for each of the protocol
/// requirements not satisfied.
///
/// \returns The protocol conformance, if \c T conforms to the
/// protocol \c Proto, or \c None.
ProtocolConformanceRef conformsToProtocol(Type T, ProtocolDecl *Proto,
DeclContext *DC,
SourceLoc ComplainLoc = SourceLoc());
DeclContext *DC);

/// This is similar to \c conformsToProtocol, but returns \c true for cases where
/// the type \p T could be dynamically cast to \p Proto protocol, such as a non-final
Expand Down