diff options
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 9b621fbc2..f1a1f5b76 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -536,6 +536,38 @@ fn reexport_across_crates() { | |||
536 | ); | 536 | ); |
537 | } | 537 | } |
538 | 538 | ||
539 | #[test] | ||
540 | fn values_dont_shadow_extern_crates() { | ||
541 | let mut db = MockDatabase::with_files( | ||
542 | " | ||
543 | //- /main.rs | ||
544 | fn foo() {} | ||
545 | use foo::Bar; | ||
546 | |||
547 | //- /foo/lib.rs | ||
548 | pub struct Bar; | ||
549 | ", | ||
550 | ); | ||
551 | db.set_crate_graph_from_fixture(crate_graph! { | ||
552 | "main": ("/main.rs", ["foo"]), | ||
553 | "foo": ("/foo/lib.rs", []), | ||
554 | }); | ||
555 | let main_id = db.file_id_of("/main.rs"); | ||
556 | |||
557 | let module = crate::source_binder::module_from_file_id(&db, main_id).unwrap(); | ||
558 | let krate = module.krate(&db).unwrap(); | ||
559 | let item_map = db.item_map(krate); | ||
560 | |||
561 | check_module_item_map( | ||
562 | &item_map, | ||
563 | module.module_id, | ||
564 | " | ||
565 | Bar: t v | ||
566 | foo: v | ||
567 | ", | ||
568 | ); | ||
569 | } | ||
570 | |||
539 | fn check_item_map_is_not_recomputed(initial: &str, file_change: &str) { | 571 | fn check_item_map_is_not_recomputed(initial: &str, file_change: &str) { |
540 | let (mut db, pos) = MockDatabase::with_position(initial); | 572 | let (mut db, pos) = MockDatabase::with_position(initial); |
541 | let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); | 573 | let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); |