-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Add case insensitive comparison, besides Levenstein for DYM #46347
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3212,6 +3212,18 @@ impl<'a> Resolver<'a> { | |
| let name = path[path.len() - 1].node.name; | ||
| // Make sure error reporting is deterministic. | ||
| names.sort_by_key(|name| name.as_str()); | ||
|
|
||
|
|
||
| // Ugly code, just to see if using case insensitive comparison will help | ||
| let exact_match = names.iter().find(|x| x.as_str().to_uppercase() == name.as_str().to_uppercase()); | ||
|
||
| // do not use Levenstein, just return the value we found (if any) | ||
| if exact_match.is_some() { | ||
| return match exact_match { | ||
| Some(found) => Some(found.clone()), | ||
| _ => None, | ||
| } | ||
| } | ||
|
||
|
|
||
|
||
| match find_best_match_for_name(names.iter(), &name.as_str(), None) { | ||
| Some(found) if found != name => Some(found), | ||
| _ => None, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // Original problem is Levenstein distance. | ||
|
|
||
|
||
| fn TyUint() { | ||
|
||
| println!("TyUint"); | ||
| } | ||
|
|
||
| fn TyInt() { | ||
| println!("TyInt"); | ||
| } | ||
|
|
||
|
|
||
| fn main() { | ||
| TyUInt(); | ||
| } | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case_insensitive_matchwould be a less-misleading name.