-
Notifications
You must be signed in to change notification settings - Fork 19
Add spell checking of resolution errors to the Rust compiler #32
Comments
For reference, in Opa, whenever a developer attempted to reference an unbound identifier or an incorrectly-typed field, we picked the closest identifiers/field names, using a trivial implementation of edition distance, and this gave quite nice results. This approach requires patching both identifier resolution and the type-checker's error message generator, though, so this may be divided in two projects. |
For reference, the basis for Clang was the Levenshtein distance algorithm (not the Damerau-Levenshtein one) which is implemented in ADT/edit_distance.h, and involved a simple linear parse of known identifiers. Since its conception it has been refined by considering the possible kinds of identifiers/keywords that may appear at the point of suggestion to only consider those during the search. The entry point is now the TypoCorrection class. |
It sounds like we should just use's LLVM's TypoCorrection class. |
Sounds like a plan. |
There is some code in rustc for this now but it is laughably bad about the suggestions it provides. |
Status is pretty much the same. There's some code in tree but the accuracy is not good. I'm going to close this though because it's old and there are probably more interesting student projects to tackle these days. |
Some compilers will notice misspellings and try to offer suggestions. Adding such a feature to the Rust compiler is a nice compiler-hacking project with limited scope. Copy whatever clang does.
See also: 2281
The text was updated successfully, but these errors were encountered: