aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-11 14:02:59 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-11 14:02:59 +0000
commit821d980fd950679315bb12659a13347233895e67 (patch)
treebce5924d76aac4d0368081371e46b0d5f2ee1ad9 /crates/ra_hir/src/nameres
parentca1b0a123119b80d0cbbea2f18124640423efd8b (diff)
parent58ed8ee6650058d5dc4ce511e2d9c04fdfa09aaf (diff)
Merge #785
785: Fix completion of paths r=flodiebold a=matklad r? @flodiebold Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r--crates/ra_hir/src/nameres/tests.rs32
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]
540fn 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
539fn check_item_map_is_not_recomputed(initial: &str, file_change: &str) { 571fn 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();