@@ -848,14 +848,15 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
848848 Tok.isContextualKeyword (" async" )) {
849849
850850 if (asyncLoc.isValid ()) {
851- diagnose (Tok, diag::duplicate_effect_specifier, Tok.getText ())
851+ diagnose (Tok, diag::duplicate_effects_specifier, Tok.getText ())
852+ .highlight (asyncLoc)
852853 .fixItRemove (Tok.getLoc ());
853854 } else if (existingArrowLoc.isValid ()) {
854855 SourceLoc insertLoc = existingArrowLoc;
855856 if (throwsLoc.isValid () &&
856857 SourceMgr.isBeforeInBuffer (throwsLoc, insertLoc))
857858 insertLoc = throwsLoc;
858- diagnose (Tok, diag::async_or_throws_in_wrong_position, 2 )
859+ diagnose (Tok, diag::async_or_throws_in_wrong_position, " async " )
859860 .fixItRemove (Tok.getLoc ())
860861 .fixItInsert (insertLoc, " async " );
861862 } else if (throwsLoc.isValid ()) {
@@ -877,7 +878,8 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
877878 bool isRethrows = Tok.is (tok::kw_rethrows);
878879
879880 if (throwsLoc.isValid ()) {
880- diagnose (Tok, diag::duplicate_effect_specifier, Tok.getText ())
881+ diagnose (Tok, diag::duplicate_effects_specifier, Tok.getText ())
882+ .highlight (throwsLoc)
881883 .fixItRemove (Tok.getLoc ());
882884 } else if (Tok.isAny (tok::kw_throw, tok::kw_try)) {
883885 // Replace 'throw' or 'try' with 'throws'.
@@ -888,8 +890,7 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
888890 diagnose (Tok, diag::rethrowing_function_type)
889891 .fixItReplace (Tok.getLoc (), " throws" );
890892 } 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 ())
893894 .fixItRemove (Tok.getLoc ())
894895 .fixItInsert (existingArrowLoc, (Tok.getText () + " " ).str ());
895896 }
0 commit comments