@@ -848,14 +848,15 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
848
848
Tok.isContextualKeyword (" async" )) {
849
849
850
850
if (asyncLoc.isValid ()) {
851
- diagnose (Tok, diag::duplicate_effect_specifier, Tok.getText ())
851
+ diagnose (Tok, diag::duplicate_effects_specifier, Tok.getText ())
852
+ .highlight (asyncLoc)
852
853
.fixItRemove (Tok.getLoc ());
853
854
} else if (existingArrowLoc.isValid ()) {
854
855
SourceLoc insertLoc = existingArrowLoc;
855
856
if (throwsLoc.isValid () &&
856
857
SourceMgr.isBeforeInBuffer (throwsLoc, insertLoc))
857
858
insertLoc = throwsLoc;
858
- diagnose (Tok, diag::async_or_throws_in_wrong_position, 2 )
859
+ diagnose (Tok, diag::async_or_throws_in_wrong_position, " async " )
859
860
.fixItRemove (Tok.getLoc ())
860
861
.fixItInsert (insertLoc, " async " );
861
862
} else if (throwsLoc.isValid ()) {
@@ -877,7 +878,8 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
877
878
bool isRethrows = Tok.is (tok::kw_rethrows);
878
879
879
880
if (throwsLoc.isValid ()) {
880
- diagnose (Tok, diag::duplicate_effect_specifier, Tok.getText ())
881
+ diagnose (Tok, diag::duplicate_effects_specifier, Tok.getText ())
882
+ .highlight (throwsLoc)
881
883
.fixItRemove (Tok.getLoc ());
882
884
} else if (Tok.isAny (tok::kw_throw, tok::kw_try)) {
883
885
// Replace 'throw' or 'try' with 'throws'.
@@ -888,8 +890,7 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
888
890
diagnose (Tok, diag::rethrowing_function_type)
889
891
.fixItReplace (Tok.getLoc (), " throws" );
890
892
} else if (existingArrowLoc.isValid ()) {
891
- diagnose (Tok, diag::async_or_throws_in_wrong_position,
892
- rethrows ? (isRethrows ? 1 : 0 ) : 0 )
893
+ diagnose (Tok, diag::async_or_throws_in_wrong_position, Tok.getText ())
893
894
.fixItRemove (Tok.getLoc ())
894
895
.fixItInsert (existingArrowLoc, (Tok.getText () + " " ).str ());
895
896
}
0 commit comments