SCIP: Qualify parameters by the containing function

SCIP requires symbols to be unique, but multiple functions may have a
parameter with the same name. Qualify parameters according to the
containing function.
This commit is contained in:
Wilfred Hughes 2023-08-04 15:28:22 -07:00
parent c59bd2dc3f
commit edabffbd5a
2 changed files with 49 additions and 0 deletions

View file

@ -416,6 +416,44 @@ pub mod module {
);
}
#[test]
fn symbol_for_param() {
check_symbol(
r#"
//- /lib.rs crate:main deps:foo
use foo::example_mod::func;
fn main() {
func(42);
}
//- /foo/lib.rs crate:foo@0.1.0,https://a.b/foo.git library
pub mod example_mod {
pub fn func(x$0: usize) {}
}
"#,
"rust-analyzer cargo foo 0.1.0 example_mod/func().(x)",
);
}
#[test]
fn symbol_for_closure_param() {
check_symbol(
r#"
//- /lib.rs crate:main deps:foo
use foo::example_mod::func;
fn main() {
func();
}
//- /foo/lib.rs crate:foo@0.1.0,https://a.b/foo.git library
pub mod example_mod {
pub fn func() {
let f = |x$0: usize| {};
}
}
"#,
"rust-analyzer cargo foo 0.1.0 example_mod/func().(x)",
);
}
#[test]
fn local_symbol_for_local() {
check_symbol(