Skip to content

Commit aed7d07

Browse files
committed
Merge branch 'all_remove_duplicate_module_adt' of https://github.com/Hmikihiro/rust-analyzer into all_remove_duplicate_module_adt
2 parents f9eebaf + 4e59657 commit aed7d07

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

crates/ide/src/goto_definition.rs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,6 +3274,108 @@ fn f() {
32743274
}
32753275

32763276
#[test]
3277+
fn goto_def_duplicate_with_methods() {
3278+
check(
3279+
r#"
3280+
struct foo;
3281+
3282+
impl foo {
3283+
fn fn_foo() {}
3284+
}
3285+
3286+
fn main() {
3287+
use {bar, bar::foo};
3288+
foo$0::fn_foo();
3289+
}
3290+
3291+
mod bar {
3292+
pub mod foo {
3293+
// ^^^
3294+
pub mod qux {
3295+
pub fn fn_foo() {}
3296+
}
3297+
pub use qux::fn_foo;
3298+
}
3299+
}
3300+
"#,
3301+
);
3302+
}
3303+
3304+
#[test]
3305+
fn goto_module_duplicate_with_type_alias() {
3306+
check(
3307+
r#"
3308+
struct qux;
3309+
type foo = qux;
3310+
3311+
fn main() {
3312+
use bar::foo;
3313+
fo$0o::fn_foo();
3314+
}
3315+
3316+
mod bar {
3317+
pub mod foo {
3318+
// ^^^
3319+
pub fn fn_foo() {}
3320+
}
3321+
}
3322+
"#,
3323+
)
3324+
}
3325+
3326+
#[test]
3327+
fn goto_struct_duplicate_with_module() {
3328+
check(
3329+
r#"
3330+
mod foo {
3331+
pub fn bar() {}
3332+
}
3333+
3334+
fn main() {
3335+
struct foo;
3336+
// ^^^
3337+
impl foo {
3338+
pub fn bar() {}
3339+
}
3340+
fo$0o::bar();
3341+
}"#,
3342+
)
3343+
}
3344+
3345+
#[test]
3346+
fn shadow_builtin_type_by_module() {
3347+
check(
3348+
r#"
3349+
mod Foo{
3350+
pub mod str {
3351+
// ^^^
3352+
pub fn foo() {}
3353+
}
3354+
}
3355+
3356+
fn main() {
3357+
use Foo::str;
3358+
let s = st$0r::foo();
3359+
}
3360+
"#,
3361+
);
3362+
}
3363+
3364+
#[test]
3365+
fn not_goto_module_because_str_is_builtin_type() {
3366+
check(
3367+
r#"
3368+
mod str {
3369+
pub fn foo() {}
3370+
}
3371+
3372+
fn main() {
3373+
let s = st$0r::f();
3374+
}
3375+
"#,
3376+
);
3377+
}
3378+
32773379
fn use_inside_body() {
32783380
check(
32793381
r#"

0 commit comments

Comments
 (0)