@@ -848,7 +848,7 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
848
848
Tok.isContextualKeyword (" async" )) {
849
849
850
850
if (asyncLoc.isValid ()) {
851
- diagnose (Tok, diag::duplicate_effect_specifier, 2 )
851
+ diagnose (Tok, diag::duplicate_effect_specifier, Tok. getText () )
852
852
.fixItRemove (Tok.getLoc ());
853
853
} else if (existingArrowLoc.isValid ()) {
854
854
SourceLoc insertLoc = existingArrowLoc;
@@ -876,18 +876,17 @@ ParserStatus Parser::parseEffectsSpecifiers(SourceLoc existingArrowLoc,
876
876
(Tok.isAny (tok::kw_throw, tok::kw_try) && !Tok.isAtStartOfLine ())) {
877
877
bool isRethrows = Tok.is (tok::kw_rethrows);
878
878
879
- if (Tok.isAny (tok::kw_throw, tok::kw_try)) {
879
+ if (throwsLoc.isValid ()) {
880
+ diagnose (Tok, diag::duplicate_effect_specifier, Tok.getText ())
881
+ .fixItRemove (Tok.getLoc ());
882
+ } else if (Tok.isAny (tok::kw_throw, tok::kw_try)) {
880
883
// Replace 'throw' or 'try' with 'throws'.
881
884
diagnose (Tok, diag::throw_in_function_type)
882
885
.fixItReplace (Tok.getLoc (), " throws" );
883
886
} else if (!rethrows && isRethrows) {
884
887
// Replace 'rethrows' with 'throws' unless it's allowed.
885
888
diagnose (Tok, diag::rethrowing_function_type)
886
889
.fixItReplace (Tok.getLoc (), " throws" );
887
- } else if (throwsLoc.isValid ()) {
888
- diagnose (Tok, diag::duplicate_effect_specifier,
889
- rethrows ? (isRethrows ? 1 : 0 ) : 0 )
890
- .fixItRemove (Tok.getLoc ());
891
890
} else if (existingArrowLoc.isValid ()) {
892
891
diagnose (Tok, diag::async_or_throws_in_wrong_position,
893
892
rethrows ? (isRethrows ? 1 : 0 ) : 0 )
0 commit comments