fix: Resolve generic parameters within use captures

This commit is contained in:
Lukas Wirth 2024-12-05 14:37:38 +01:00
parent 7f39ee3fce
commit d6b62265b5
5 changed files with 90 additions and 2 deletions

View file

@ -3102,6 +3102,75 @@ fn main() { let _: S; }
r#"
use lib::S as Baz;
fn main() { let _: Baz; }
"#,
);
}
#[test]
fn rename_type_param_ref_in_use_bound() {
check(
"U",
r#"
fn foo<T>() -> impl use<T$0> Trait {}
"#,
r#"
fn foo<U>() -> impl use<U> Trait {}
"#,
);
}
#[test]
fn rename_type_param_in_use_bound() {
check(
"U",
r#"
fn foo<T$0>() -> impl use<T> Trait {}
"#,
r#"
fn foo<U>() -> impl use<U> Trait {}
"#,
);
}
#[test]
fn rename_lifetime_param_ref_in_use_bound() {
check(
"u",
r#"
fn foo<'t>() -> impl use<'t$0> Trait {}
"#,
r#"
fn foo<'u>() -> impl use<'u> Trait {}
"#,
);
}
#[test]
fn rename_lifetime_param_in_use_bound() {
check(
"u",
r#"
fn foo<'t$0>() -> impl use<'t> Trait {}
"#,
r#"
fn foo<'u>() -> impl use<'u> Trait {}
"#,
);
}
#[test]
fn rename_parent_type_param_in_use_bound() {
check(
"U",
r#"
trait Trait<T> {
fn foo() -> impl use<T$0> Trait {}
}
"#,
r#"
trait Trait<U> {
fn foo() -> impl use<U> Trait {}
}
"#,
);
}