Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"did you mean" typo suggestion improvement #46332

Closed
estebank opened this issue Nov 28, 2017 · 0 comments
Closed

"did you mean" typo suggestion improvement #46332

estebank opened this issue Nov 28, 2017 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. WG-diagnostics Working group: Diagnostics

Comments

@estebank
Copy link
Contributor

"did you mean" should first try to find the name with different capitalization. A case I just found

error[E0531]: cannot find tuple struct/variant `TyUInt` in module `ty`
   --> src/librustc/infer/error_reporting/mod.rs:680:44
    |
680 |             (&ty::TyRef(_, ref tnm1), &ty::TyUInt(_)) |
    |                                            ^^^^^^ did you mean `TyInt`?

There's a ty::TyUint, which confused me for a few seconds until I noticed the i->I typo and the suggestion hindered instead of helping.

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. E-needs-mentor WG-diagnostics Working group: Diagnostics labels Nov 28, 2017
bors added a commit that referenced this issue Dec 2, 2017
…ebank

Add case insensitive comparison, besides Levenstein for DYM

Closes #46332

Draft version. The idea is that Levenstein does not work for some cases when we have multiple equal weights for strings. I didn't understand the case with `if found != name => Some(found)` so it means that new code does not work correctly yet.

At least now I think that we might return all maximal weights from levenstein and think about next cases in priority order:

1) There is exact match -> None
2) There is exact match, but case insensitive -> Some(match)
3) There is some match from levenstein -> Some(matches.take_any)
4) There is no match -> None

@estebank WDYT?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. WG-diagnostics Working group: Diagnostics
Projects
None yet
Development

No branches or pull requests

1 participant