Skip to content

Commit 11304b7

Browse files
committed
AST: Take decls instead of identifiers in some conformance diagnostics.
NFC.
1 parent 911933e commit 11304b7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,7 +3126,7 @@ NOTE(declared_protocol_conformance_here,none,
31263126

31273127
ERROR(witness_unavailable,none,
31283128
"unavailable %kind0 was used to satisfy a requirement of protocol %1%select{|: %2}2",
3129-
(const ValueDecl *, Identifier, StringRef))
3129+
(const ValueDecl *, const ProtocolDecl *, StringRef))
31303130

31313131
WARNING(witness_deprecated,none,
31323132
"deprecated default implementation is used to satisfy %kind0 required by "
@@ -6781,7 +6781,7 @@ WARNING(availability_enum_element_no_potential_warn,
67816781

67826782
ERROR(availability_protocol_requires_version,
67836783
none, "protocol %0 requires %1 to be available in %2 %3 and newer",
6784-
(Identifier, DeclName, StringRef, llvm::VersionTuple))
6784+
(const ProtocolDecl *, const ValueDecl *, StringRef, llvm::VersionTuple))
67856785

67866786
NOTE(availability_protocol_requirement_here, none,
67876787
"protocol requirement here", ())

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4313,8 +4313,7 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
43134313
SourceLoc diagLoc = getLocForDiagnosingWitness(conformance, witness);
43144314
diags.diagnose(
43154315
diagLoc, diag::availability_protocol_requires_version,
4316-
conformance->getProtocol()->getName(),
4317-
witness->getName(),
4316+
conformance->getProtocol(), witness,
43184317
prettyPlatformString(targetPlatform(ctx.LangOpts)),
43194318
check.RequiredAvailability.getOSVersion().getLowerEndpoint());
43204319
emitDeclaredHereIfNeeded(diags, diagLoc, witness);
@@ -4385,9 +4384,8 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
43854384
SourceLoc diagLoc = getLocForDiagnosingWitness(conformance, witness);
43864385
auto *attr = AvailableAttr::isUnavailable(witness);
43874386
EncodedDiagnosticMessage EncodedMessage(attr->Message);
4388-
diags.diagnose(diagLoc, diag::witness_unavailable,
4389-
witness, conformance->getProtocol()->getName(),
4390-
EncodedMessage.Message);
4387+
diags.diagnose(diagLoc, diag::witness_unavailable, witness,
4388+
conformance->getProtocol(), EncodedMessage.Message);
43914389
emitDeclaredHereIfNeeded(diags, diagLoc, witness);
43924390
diags.diagnose(requirement, diag::kind_declname_declared_here,
43934391
DescriptiveDeclKind::Requirement,

0 commit comments

Comments
 (0)