@@ -2017,7 +2017,7 @@ bool TrailingClosureAmbiguityFailure::diagnoseAsNote() {
2017
2017
for (const auto &choicePair : choicesByLabel) {
2018
2018
auto diag = emitDiagnosticAt(
2019
2019
expr->getLoc(), diag::ambiguous_because_of_trailing_closure,
2020
- choicePair.first.empty(), choicePair.second->getName() );
2020
+ choicePair.first.empty(), choicePair.second);
2021
2021
swift::fixItEncloseTrailingClosure(getASTContext(), diag, callExpr,
2022
2022
choicePair.first);
2023
2023
}
@@ -2644,7 +2644,7 @@ bool ContextualFailure::diagnoseAsError() {
2644
2644
auto fnType = fromType->getAs<FunctionType>();
2645
2645
if (!fnType) {
2646
2646
emitDiagnostic(diag::expected_result_in_contextual_member,
2647
- choice->getName() , fromType, toType);
2647
+ choice, fromType, toType);
2648
2648
return true;
2649
2649
}
2650
2650
@@ -2680,16 +2680,16 @@ bool ContextualFailure::diagnoseAsError() {
2680
2680
if (fnType->getResult()->isEqual(toType)) {
2681
2681
auto diag = emitDiagnostic(
2682
2682
diag::expected_parens_in_contextual_member_type,
2683
- choice->getName() , fnType->getResult());
2683
+ choice, fnType->getResult());
2684
2684
applyFixIt(diag);
2685
2685
} else {
2686
2686
auto diag = emitDiagnostic(diag::expected_parens_in_contextual_member,
2687
- choice->getName() );
2687
+ choice);
2688
2688
applyFixIt(diag);
2689
2689
}
2690
2690
} else {
2691
2691
emitDiagnostic(diag::expected_argument_in_contextual_member,
2692
- choice->getName() , params.front().getPlainType());
2692
+ choice, params.front().getPlainType());
2693
2693
}
2694
2694
2695
2695
return true;
@@ -4901,7 +4901,7 @@ bool InvalidDynamicInitOnMetatypeFailure::diagnoseAsError() {
4901
4901
BaseType->getMetatypeInstanceType())
4902
4902
.highlight(BaseRange);
4903
4903
emitDiagnosticAt(Init, diag::note_nonrequired_initializer, Init->isImplicit(),
4904
- Init->getName() );
4904
+ Init);
4905
4905
return true;
4906
4906
}
4907
4907
@@ -5362,10 +5362,9 @@ bool MissingArgumentsFailure::diagnoseInvalidTupleDestructuring() const {
5362
5362
if (!funcType)
5363
5363
return false;
5364
5364
5365
- auto name = decl->getBaseName();
5366
5365
auto diagnostic =
5367
5366
emitDiagnostic(diag::cannot_convert_single_tuple_into_multiple_arguments,
5368
- decl->getDescriptiveKind(), name, name .isSpecial(),
5367
+ decl, decl->getBaseName() .isSpecial(),
5369
5368
funcType->getNumParams(), isa<TupleExpr>(argExpr));
5370
5369
5371
5370
// If argument is a literal tuple, let's suggest removal of parentheses.
@@ -5990,7 +5989,7 @@ bool InaccessibleMemberFailure::diagnoseAsError() {
5990
5989
CD->getResultInterfaceType(), accessLevel)
5991
5990
.highlight(nameLoc.getSourceRange());
5992
5991
} else {
5993
- emitDiagnosticAt(loc, diag::candidate_inaccessible, Member->getBaseName() ,
5992
+ emitDiagnosticAt(loc, diag::candidate_inaccessible, Member,
5994
5993
accessLevel)
5995
5994
.highlight(nameLoc.getSourceRange());
5996
5995
}
@@ -6060,19 +6059,19 @@ SourceLoc InvalidMemberRefInKeyPath::getLoc() const {
6060
6059
}
6061
6060
6062
6061
bool InvalidStaticMemberRefInKeyPath::diagnoseAsError() {
6063
- emitDiagnostic(diag::expr_keypath_static_member, getName (),
6062
+ emitDiagnostic(diag::expr_keypath_static_member, getMember (),
6064
6063
isForKeyPathDynamicMemberLookup());
6065
6064
return true;
6066
6065
}
6067
6066
6068
6067
bool InvalidEnumCaseRefInKeyPath::diagnoseAsError() {
6069
- emitDiagnostic(diag::expr_keypath_enum_case, getName (),
6068
+ emitDiagnostic(diag::expr_keypath_enum_case, getMember (),
6070
6069
isForKeyPathDynamicMemberLookup());
6071
6070
return true;
6072
6071
}
6073
6072
6074
6073
bool InvalidMemberWithMutatingGetterInKeyPath::diagnoseAsError() {
6075
- emitDiagnostic(diag::expr_keypath_mutating_getter, getName (),
6074
+ emitDiagnostic(diag::expr_keypath_mutating_getter, getMember (),
6076
6075
isForKeyPathDynamicMemberLookup());
6077
6076
return true;
6078
6077
}
@@ -6435,7 +6434,7 @@ bool MissingGenericArgumentsFailure::diagnoseForAnchor(
6435
6434
return true;
6436
6435
6437
6436
if (auto *SD = dyn_cast<SubscriptDecl>(DC)) {
6438
- emitDiagnosticAt(SD, diag::note_call_to_subscript, SD->getName() );
6437
+ emitDiagnosticAt(SD, diag::note_call_to_subscript, SD);
6439
6438
return true;
6440
6439
}
6441
6440
@@ -6446,7 +6445,7 @@ bool MissingGenericArgumentsFailure::diagnoseForAnchor(
6446
6445
emitDiagnosticAt(AFD,
6447
6446
AFD->isOperator() ? diag::note_call_to_operator
6448
6447
: diag::note_call_to_func,
6449
- AFD->getName() );
6448
+ AFD);
6450
6449
}
6451
6450
return true;
6452
6451
}
@@ -7547,7 +7546,7 @@ bool ExtraneousCallFailure::diagnoseAsError() {
7547
7546
if (auto *enumCase = dyn_cast<EnumElementDecl>(decl)) {
7548
7547
auto diagnostic =
7549
7548
emitDiagnostic(diag::unexpected_arguments_in_enum_case,
7550
- enumCase->getBaseIdentifier() );
7549
+ enumCase);
7551
7550
removeParensFixIt(diagnostic);
7552
7551
return true;
7553
7552
}
@@ -7601,7 +7600,7 @@ void NonEphemeralConversionFailure::emitSuggestionNotes() const {
7601
7600
auto *argExpr = getArgExpr();
7602
7601
emitDiagnosticAt(
7603
7602
argExpr->getLoc(), diag::ephemeral_pointer_argument_conversion_note,
7604
- getArgType(), getParamType(), getCallee(), getCalleeFullName() )
7603
+ getArgType(), getParamType(), getCallee())
7605
7604
.highlight(argExpr->getSourceRange());
7606
7605
7607
7606
// Then try to find a suitable alternative.
@@ -7740,11 +7739,11 @@ bool NonEphemeralConversionFailure::diagnoseAsError() {
7740
7739
auto *argExpr = getArgExpr();
7741
7740
if (isa<InOutExpr>(argExpr)) {
7742
7741
emitDiagnosticAt(argExpr->getLoc(), diag::cannot_use_inout_non_ephemeral,
7743
- argDesc, getCallee(), getCalleeFullName() )
7742
+ argDesc, getCallee())
7744
7743
.highlight(argExpr->getSourceRange());
7745
7744
} else {
7746
7745
emitDiagnosticAt(argExpr->getLoc(), diag::cannot_pass_type_to_non_ephemeral,
7747
- getArgType(), argDesc, getCallee(), getCalleeFullName() )
7746
+ getArgType(), argDesc, getCallee())
7748
7747
.highlight(argExpr->getSourceRange());
7749
7748
}
7750
7749
emitSuggestionNotes();
@@ -7807,7 +7806,7 @@ bool AssignmentTypeMismatchFailure::diagnoseAsNote() {
7807
7806
if (auto *decl = overload->choice.getDeclOrNull()) {
7808
7807
emitDiagnosticAt(decl,
7809
7808
diag::cannot_convert_candidate_result_to_contextual_type,
7810
- decl->getName() , getFromType(), getToType());
7809
+ decl, getFromType(), getToType());
7811
7810
return true;
7812
7811
}
7813
7812
}
@@ -8132,7 +8131,7 @@ bool AbstractRawRepresentableFailure::diagnoseAsNote() {
8132
8131
if (auto *decl = overload->choice.getDeclOrNull()) {
8133
8132
diagnostic.emplace(emitDiagnosticAt(
8134
8133
decl, diag::cannot_convert_candidate_result_to_contextual_type,
8135
- decl->getName() , ExpectedType, RawReprType));
8134
+ decl, ExpectedType, RawReprType));
8136
8135
}
8137
8136
} else if (auto argConv =
8138
8137
locator->getLastElementAs<LocatorPathElt::ApplyArgToParam>()) {
@@ -8471,7 +8470,7 @@ bool ReferenceToInvalidDeclaration::diagnoseAsError() {
8471
8470
// If no errors have been emitted yet, let's emit one
8472
8471
// about reference to an invalid declaration.
8473
8472
8474
- emitDiagnostic(diag::reference_to_invalid_decl, decl->getName() );
8473
+ emitDiagnostic(diag::reference_to_invalid_decl, decl);
8475
8474
emitDiagnosticAt(decl, diag::decl_declared_here, decl);
8476
8475
return true;
8477
8476
}
0 commit comments