Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit b2ebf97

Browse files
authored
Merge pull request swiftlang#34904 from AnthonyLatsis/sema-misc
2 parents 3fd4aae + 99ce275 commit b2ebf97

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4849,15 +4849,11 @@ TypeChecker::containsProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC,
48494849
}
48504850

48514851
ProtocolConformanceRef
4852-
TypeChecker::conformsToProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC,
4853-
SourceLoc ComplainLoc) {
4852+
TypeChecker::conformsToProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC) {
48544853
// Look up conformance in the module.
48554854
ModuleDecl *M = DC->getParentModule();
48564855
auto lookupResult = M->lookupConformance(T, Proto);
48574856
if (lookupResult.isInvalid()) {
4858-
if (ComplainLoc.isValid()) {
4859-
diagnoseConformanceFailure(T, Proto, DC, ComplainLoc);
4860-
}
48614857
return ProtocolConformanceRef::forInvalid();
48624858
}
48634859

@@ -4869,16 +4865,8 @@ TypeChecker::conformsToProtocol(Type T, ProtocolDecl *Proto, DeclContext *DC,
48694865
// If we have a conditional requirements that
48704866
// we need to check, do so now.
48714867
if (!condReqs->empty()) {
4872-
// Figure out the location of the conditional conformance.
4873-
auto conformanceDC = lookupResult.getConcrete()->getDeclContext();
4874-
SourceLoc noteLoc;
4875-
if (auto ext = dyn_cast<ExtensionDecl>(conformanceDC))
4876-
noteLoc = ext->getLoc();
4877-
else
4878-
noteLoc = cast<NominalTypeDecl>(conformanceDC)->getLoc();
4879-
48804868
auto conditionalCheckResult = checkGenericArguments(
4881-
DC, ComplainLoc, noteLoc, T,
4869+
DC, SourceLoc(), SourceLoc(), T,
48824870
{lookupResult.getRequirement()->getSelfInterfaceType()}, *condReqs,
48834871
[](SubstitutableType *dependentType) { return Type(dependentType); });
48844872
switch (conditionalCheckResult) {

lib/Sema/TypeChecker.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -763,16 +763,10 @@ ProtocolConformanceRef containsProtocol(Type T, ProtocolDecl *Proto,
763763
/// \param DC The context in which to check conformance. This affects, for
764764
/// example, extension visibility.
765765
///
766-
/// \param ComplainLoc If valid, then this function will emit diagnostics if
767-
/// T does not conform to the given protocol. The primary diagnostic will
768-
/// be placed at this location, with notes for each of the protocol
769-
/// requirements not satisfied.
770-
///
771766
/// \returns The protocol conformance, if \c T conforms to the
772767
/// protocol \c Proto, or \c None.
773768
ProtocolConformanceRef conformsToProtocol(Type T, ProtocolDecl *Proto,
774-
DeclContext *DC,
775-
SourceLoc ComplainLoc = SourceLoc());
769+
DeclContext *DC);
776770

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

0 commit comments

Comments
 (0)