fix: Goto implementation to impls inside blocks

This commit is contained in:
Shoyu Vanilla 2024-03-12 01:13:13 +09:00
parent b91697de8f
commit 967a864d03
2 changed files with 97 additions and 1 deletions

View file

@ -337,6 +337,77 @@ impl Tr for S {
const C: usize = 4;
//^
}
"#,
);
}
#[test]
fn goto_adt_implementation_inside_block() {
check(
r#"
//- minicore: copy, derive
trait Bar {}
fn test() {
#[derive(Copy)]
//^^^^^^^^^^^^^^^
struct Foo$0;
impl Foo {}
//^^^
trait Baz {}
impl Bar for Foo {}
//^^^
impl Baz for Foo {}
//^^^
}
"#,
);
}
#[test]
fn goto_trait_implementation_inside_block() {
check(
r#"
struct Bar;
fn test() {
trait Foo$0 {}
struct Baz;
impl Foo for Bar {}
//^^^
impl Foo for Baz {}
//^^^
}
"#,
);
check(
r#"
struct Bar;
fn test() {
trait Foo {
fn foo$0() {}
}
struct Baz;
impl Foo for Bar {
fn foo() {}
//^^^
}
impl Foo for Baz {
fn foo() {}
//^^^
}
}
"#,
);
}