Skip to content

Commit d9a063c

Browse files
committed
[cxx-interop] Attempt to fix at -> subscript fix-it.
1 parent 96d0b35 commit d9a063c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4047,11 +4047,7 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
40474047
auto dotExpr = getAsExpr<UnresolvedDotExpr>(anchor);
40484048
auto callExpr = getAsExpr<CallExpr>(findParentExpr(dotExpr));
40494049

4050-
ctx.Diags.diagnose(loc, diag::projection_reference_not_imported,
4051-
name.getBaseIdentifier().str(), returnTypeStr);
4052-
ctx.Diags.diagnose(loc, diag::projection_may_return_interior_ptr,
4053-
name.getBaseIdentifier().str());
4054-
ctx.Diags.diagnose(loc, diag::at_to_subscript)
4050+
ctx.Diags.diagnose(dotExpr->getDotLoc(), diag::at_to_subscript)
40554051
.fixItRemove(
40564052
{dotExpr->getDotLoc(), callExpr->getArgs()->getStartLoc()})
40574053
.fixItReplaceChars(
@@ -4060,6 +4056,10 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
40604056
.fixItReplaceChars(
40614057
callExpr->getArgs()->getEndLoc(),
40624058
callExpr->getArgs()->getEndLoc().getAdvancedLoc(1), "]");
4059+
ctx.Diags.diagnose(loc, diag::projection_reference_not_imported,
4060+
name.getBaseIdentifier().str(), returnTypeStr);
4061+
ctx.Diags.diagnose(loc, diag::projection_may_return_interior_ptr,
4062+
name.getBaseIdentifier().str());
40634063
} else {
40644064
ctx.Diags.diagnose(loc, diag::projection_reference_not_imported,
40654065
name.getBaseIdentifier().str(), returnTypeStr);

0 commit comments

Comments
 (0)