Add case insensitive comparison, besides Levenstein
This commit is contained in:
parent
1dc0b573e7
commit
6506f9c253
2 changed files with 26 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
14
src/test/ui/issue46332.rs
Normal file
14
src/test/ui/issue46332.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Original problem is Levenstein distance.
|
||||
|
||||
fn TyUint() {
|
||||
println!("TyUint");
|
||||
}
|
||||
|
||||
fn TyInt() {
|
||||
println!("TyInt");
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
TyUInt();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue