Mozilla-Student-Projects / Projects-Tracker

Keep tracks of Firefox/Thunderbird/Firefox OS features that can/should/will be implemented as add-ons/apps.
66 stars 19 forks source link

Add spell checking of resolution errors to the Rust compiler #32

Closed brson closed 10 years ago

brson commented 12 years ago

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

Yoric commented 12 years ago

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.

matthieu-m commented 12 years ago

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.

brson commented 12 years ago

It sounds like we should just use's LLVM's TypoCorrection class.

Yoric commented 12 years ago

Sounds like a plan.

brson commented 11 years ago

There is some code in rustc for this now but it is laughably bad about the suggestions it provides.

brson commented 10 years ago

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.