We correct some typos in `ActOnArraySubscriptExpr` and
`ActOnOMPArraySectionExpr`, so when their result is `ExprError`, we can
end up correcting delayed typos in the same expressions again. In
general it is OK but when `NumTypos` is incorrect, we can hit the
assertion
> Assertion failed: (Entry != DelayedTypos.end() && "Failed to get the state for a TypoExpr!"), function getTypoExprState, file clang/lib/Sema/SemaLookup.cpp, line 5219.
This assertion is reproducible with Objective-C method
- (void)test {
[self undeclaredMethod:undeclaredArg];
NSMutableDictionary *opts = [NSMutableDictionary new];
opts[(__bridge id)undeclaredKey] = @0;
}
There is no test for the fix because `NumTypos` is still incorrect and
we hit the assertion
> Assertion failed: (DelayedTypos.empty() && "Uncorrected typos!"), function ~Sema, file clang/lib/Sema/Sema.cpp, line 382.
Another option is to fix tracking delayed typos but it is non-trivial as
in many cases we drop erroneous expressions without cleaning up
`TypoExpr` they contain. Also the assertion in `~Sema` isn't causing
problems with assertions disabled, while a missing `TypoExprState` can
cause a segmentation fault.
rdar://problem/47403222