Skip to content
This repository was archived by the owner on May 27, 2020. It is now read-only.

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

Closed
brson opened this issue Sep 24, 2012 · 6 comments
Closed

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

brson opened this issue Sep 24, 2012 · 6 comments

Comments

@brson
Copy link

brson commented Sep 24, 2012

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
Copy link
Contributor

Yoric commented Sep 25, 2012

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
Copy link

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
Copy link
Author

brson commented Sep 25, 2012

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

@Yoric
Copy link
Contributor

Yoric commented Sep 25, 2012

Sounds like a plan.

@brson
Copy link
Author

brson commented May 8, 2013

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

@brson
Copy link
Author

brson commented May 15, 2014

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.

@brson brson closed this as completed May 15, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants