Issue 143509
Summary Typo correction should be smarter about context
Labels enhancement, clang:frontend, quality-of-implementation, clang:diagnostics
Assignees
Reporter AaronBallman
    Currently, typo correction has very little intelligence about the context of the typo being corrected. As a result, we fail to suggest corrections as well as we could. For example:

This case fails to recognize we're in a context where we expect one of a handful of keywords:
```
struct S {
  S() = defaul;
};
```
https://godbolt.org/z/o4snPEGve
(The same applies in many other circumstances; we should have a general mechanism that filters keywords by context.)

This case fails to recognize a type is invalid (but only in C) and suggests we replace `lock` by `long`:
```
void func() {
  long x;
 x = (lock);
}
```
https://godbolt.org/z/cxbjbE1bP

This case fails to recognize that only a type is valid:
```
int lang;
int main() {
 (void)(ling)12;
}
```
https://godbolt.org/z/hc3rnrbKz

I expect more examples exist. The thrust of the request is to make typo correction a bit more situationally aware whenever possible.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to