Skip to content

Commit 8e63412

Browse files
committed
Emit 'try' before 'await' in fix-it
Actually put the try fix-it before the await if it is available.
1 parent fdbaedc commit 8e63412

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,10 @@ class Context {
17191719
if (!suggestTryFixIt)
17201720
return;
17211721

1722+
// 'try' should go before 'await'
1723+
if (awaitLoc.isValid())
1724+
insertLoc = awaitLoc;
1725+
17221726
Diags.diagnose(loc, diag::note_forgot_try)
17231727
.fixItInsert(insertLoc, "try ");
17241728
Diags.diagnose(loc, diag::note_error_to_optional)

0 commit comments

Comments
 (0)