Skip to content

Commit 3480bf6

Browse files
committed
[Diagnostics] Fix #66206: Remove the whitespace on the left-hand side of "??";
1 parent 07f9384 commit 3480bf6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,10 +1405,14 @@ static void diagSyntacticUseRestrictions(const Expr *E, const DeclContext *DC,
14051405
Expr *subExpr = nullptr;
14061406
if (calleeName == "??" &&
14071407
(subExpr = isImplicitPromotionToOptional(lhs))) {
1408-
Ctx.Diags.diagnose(DRE->getLoc(), diag::use_of_qq_on_non_optional_value,
1409-
subExpr->getType())
1410-
.highlight(lhs->getSourceRange())
1411-
.fixItRemove(SourceRange(DRE->getLoc(), rhs->getEndLoc()));
1408+
1409+
Ctx.Diags
1410+
.diagnose(DRE->getLoc(), diag::use_of_qq_on_non_optional_value,
1411+
subExpr->getType())
1412+
.highlight(lhs->getSourceRange())
1413+
.fixItRemoveChars(
1414+
Lexer::getLocForEndOfToken(Ctx.SourceMgr, lhs->getEndLoc()),
1415+
Lexer::getLocForEndOfToken(Ctx.SourceMgr, rhs->getEndLoc()));
14121416
return;
14131417
}
14141418

0 commit comments

Comments
 (0)