@@ -2017,7 +2017,7 @@ bool TrailingClosureAmbiguityFailure::diagnoseAsNote() {
20172017 for (const auto &choicePair : choicesByLabel) {
20182018 auto diag = emitDiagnosticAt (
20192019 expr->getLoc (), diag::ambiguous_because_of_trailing_closure,
2020- choicePair.first .empty (), choicePair.second -> getName () );
2020+ choicePair.first .empty (), choicePair.second );
20212021 swift::fixItEncloseTrailingClosure (getASTContext (), diag, callExpr,
20222022 choicePair.first );
20232023 }
@@ -2644,7 +2644,7 @@ bool ContextualFailure::diagnoseAsError() {
26442644 auto fnType = fromType->getAs <FunctionType>();
26452645 if (!fnType) {
26462646 emitDiagnostic (diag::expected_result_in_contextual_member,
2647- choice-> getName () , fromType, toType);
2647+ choice, fromType, toType);
26482648 return true ;
26492649 }
26502650
@@ -2680,16 +2680,16 @@ bool ContextualFailure::diagnoseAsError() {
26802680 if (fnType->getResult ()->isEqual (toType)) {
26812681 auto diag = emitDiagnostic (
26822682 diag::expected_parens_in_contextual_member_type,
2683- choice-> getName () , fnType->getResult ());
2683+ choice, fnType->getResult ());
26842684 applyFixIt (diag);
26852685 } else {
26862686 auto diag = emitDiagnostic (diag::expected_parens_in_contextual_member,
2687- choice-> getName () );
2687+ choice);
26882688 applyFixIt (diag);
26892689 }
26902690 } else {
26912691 emitDiagnostic (diag::expected_argument_in_contextual_member,
2692- choice-> getName () , params.front ().getPlainType ());
2692+ choice, params.front ().getPlainType ());
26932693 }
26942694
26952695 return true ;
@@ -4901,7 +4901,7 @@ bool InvalidDynamicInitOnMetatypeFailure::diagnoseAsError() {
49014901 BaseType->getMetatypeInstanceType ())
49024902 .highlight (BaseRange);
49034903 emitDiagnosticAt (Init, diag::note_nonrequired_initializer, Init->isImplicit (),
4904- Init-> getName () );
4904+ Init);
49054905 return true ;
49064906}
49074907
@@ -5362,10 +5362,9 @@ bool MissingArgumentsFailure::diagnoseInvalidTupleDestructuring() const {
53625362 if (!funcType)
53635363 return false ;
53645364
5365- auto name = decl->getBaseName ();
53665365 auto diagnostic =
53675366 emitDiagnostic (diag::cannot_convert_single_tuple_into_multiple_arguments,
5368- decl-> getDescriptiveKind (), name, name .isSpecial (),
5367+ decl, decl-> getBaseName () .isSpecial (),
53695368 funcType->getNumParams (), isa<TupleExpr>(argExpr));
53705369
53715370 // If argument is a literal tuple, let's suggest removal of parentheses.
@@ -5990,7 +5989,7 @@ bool InaccessibleMemberFailure::diagnoseAsError() {
59905989 CD->getResultInterfaceType (), accessLevel)
59915990 .highlight (nameLoc.getSourceRange ());
59925991 } else {
5993- emitDiagnosticAt (loc, diag::candidate_inaccessible, Member-> getBaseName () ,
5992+ emitDiagnosticAt (loc, diag::candidate_inaccessible, Member,
59945993 accessLevel)
59955994 .highlight (nameLoc.getSourceRange ());
59965995 }
@@ -6060,19 +6059,19 @@ SourceLoc InvalidMemberRefInKeyPath::getLoc() const {
60606059}
60616060
60626061bool InvalidStaticMemberRefInKeyPath::diagnoseAsError () {
6063- emitDiagnostic (diag::expr_keypath_static_member, getName (),
6062+ emitDiagnostic (diag::expr_keypath_static_member, getMember (),
60646063 isForKeyPathDynamicMemberLookup ());
60656064 return true ;
60666065}
60676066
60686067bool InvalidEnumCaseRefInKeyPath::diagnoseAsError () {
6069- emitDiagnostic (diag::expr_keypath_enum_case, getName (),
6068+ emitDiagnostic (diag::expr_keypath_enum_case, getMember (),
60706069 isForKeyPathDynamicMemberLookup ());
60716070 return true ;
60726071}
60736072
60746073bool InvalidMemberWithMutatingGetterInKeyPath::diagnoseAsError () {
6075- emitDiagnostic (diag::expr_keypath_mutating_getter, getName (),
6074+ emitDiagnostic (diag::expr_keypath_mutating_getter, getMember (),
60766075 isForKeyPathDynamicMemberLookup ());
60776076 return true ;
60786077}
@@ -6435,7 +6434,7 @@ bool MissingGenericArgumentsFailure::diagnoseForAnchor(
64356434 return true ;
64366435
64376436 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);
64396438 return true ;
64406439 }
64416440
@@ -6446,7 +6445,7 @@ bool MissingGenericArgumentsFailure::diagnoseForAnchor(
64466445 emitDiagnosticAt (AFD,
64476446 AFD->isOperator () ? diag::note_call_to_operator
64486447 : diag::note_call_to_func,
6449- AFD-> getName () );
6448+ AFD);
64506449 }
64516450 return true ;
64526451 }
@@ -7547,7 +7546,7 @@ bool ExtraneousCallFailure::diagnoseAsError() {
75477546 if (auto *enumCase = dyn_cast<EnumElementDecl>(decl)) {
75487547 auto diagnostic =
75497548 emitDiagnostic (diag::unexpected_arguments_in_enum_case,
7550- enumCase-> getBaseIdentifier () );
7549+ enumCase);
75517550 removeParensFixIt (diagnostic);
75527551 return true ;
75537552 }
@@ -7601,7 +7600,7 @@ void NonEphemeralConversionFailure::emitSuggestionNotes() const {
76017600 auto *argExpr = getArgExpr ();
76027601 emitDiagnosticAt (
76037602 argExpr->getLoc (), diag::ephemeral_pointer_argument_conversion_note,
7604- getArgType (), getParamType (), getCallee (), getCalleeFullName () )
7603+ getArgType (), getParamType (), getCallee ())
76057604 .highlight (argExpr->getSourceRange ());
76067605
76077606 // Then try to find a suitable alternative.
@@ -7740,11 +7739,11 @@ bool NonEphemeralConversionFailure::diagnoseAsError() {
77407739 auto *argExpr = getArgExpr ();
77417740 if (isa<InOutExpr>(argExpr)) {
77427741 emitDiagnosticAt (argExpr->getLoc (), diag::cannot_use_inout_non_ephemeral,
7743- argDesc, getCallee (), getCalleeFullName () )
7742+ argDesc, getCallee ())
77447743 .highlight (argExpr->getSourceRange ());
77457744 } else {
77467745 emitDiagnosticAt (argExpr->getLoc (), diag::cannot_pass_type_to_non_ephemeral,
7747- getArgType (), argDesc, getCallee (), getCalleeFullName () )
7746+ getArgType (), argDesc, getCallee ())
77487747 .highlight (argExpr->getSourceRange ());
77497748 }
77507749 emitSuggestionNotes ();
@@ -7807,7 +7806,7 @@ bool AssignmentTypeMismatchFailure::diagnoseAsNote() {
78077806 if (auto *decl = overload->choice .getDeclOrNull ()) {
78087807 emitDiagnosticAt (decl,
78097808 diag::cannot_convert_candidate_result_to_contextual_type,
7810- decl-> getName () , getFromType (), getToType ());
7809+ decl, getFromType (), getToType ());
78117810 return true ;
78127811 }
78137812 }
@@ -8132,7 +8131,7 @@ bool AbstractRawRepresentableFailure::diagnoseAsNote() {
81328131 if (auto *decl = overload->choice .getDeclOrNull ()) {
81338132 diagnostic.emplace (emitDiagnosticAt (
81348133 decl, diag::cannot_convert_candidate_result_to_contextual_type,
8135- decl-> getName () , ExpectedType, RawReprType));
8134+ decl, ExpectedType, RawReprType));
81368135 }
81378136 } else if (auto argConv =
81388137 locator->getLastElementAs <LocatorPathElt::ApplyArgToParam>()) {
@@ -8471,7 +8470,7 @@ bool ReferenceToInvalidDeclaration::diagnoseAsError() {
84718470 // If no errors have been emitted yet, let's emit one
84728471 // about reference to an invalid declaration.
84738472
8474- emitDiagnostic (diag::reference_to_invalid_decl, decl-> getName () );
8473+ emitDiagnostic (diag::reference_to_invalid_decl, decl);
84758474 emitDiagnosticAt (decl, diag::decl_declared_here, decl);
84768475 return true ;
84778476}
0 commit comments