From 22b9b9abe73e57cac300a2c6b493507fc816770a Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 18 Jan 2021 18:21:40 +0100 Subject: Add test for reference search on self declaration param --- crates/ide/src/references.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crates/ide/src') diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 51a2f4327..df9c31aef 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -930,6 +930,26 @@ impl Foo { ); } + #[test] + fn test_find_self_refs_decl() { + check( + r#" +struct Foo { bar: i32 } + +impl Foo { + fn foo(self$0) { + self; + } +} +"#, + expect![[r#" + self SelfParam FileId(0) 47..51 47..51 SelfParam + + FileId(0) 63..67 Other Read + "#]], + ); + } + fn check(ra_fixture: &str, expect: Expect) { check_with_scope(ra_fixture, None, expect) } -- cgit v1.2.3