aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-30 14:13:06 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-30 14:13:06 +0100
commit3cf841e1bc2bf354c180dc80fb394c0e0a843965 (patch)
treef01cf9c3589ae920c50696ce244c98b2454834b3 /crates/ra_hir/src/nameres
parent6b88735fe6cd3b259816c7c90a2675ee057c9e4c (diff)
parentb6a854e161cc122e6d9ae12084b6a1d1f4d0f241 (diff)
Merge #1352
1352: Builtins r=matklad a=matklad closes #1340 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r--crates/ra_hir/src/nameres/tests.rs1
-rw-r--r--crates/ra_hir/src/nameres/tests/incremental.rs4
-rw-r--r--crates/ra_hir/src/nameres/tests/primitives.rs24
3 files changed, 27 insertions, 2 deletions
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index ffb627c02..a15e62bbe 100644
--- a/crates/ra_hir/src/nameres/tests.rs
+++ b/crates/ra_hir/src/nameres/tests.rs
@@ -1,6 +1,7 @@
1mod macros; 1mod macros;
2mod globs; 2mod globs;
3mod incremental; 3mod incremental;
4mod primitives;
4 5
5use std::sync::Arc; 6use std::sync::Arc;
6 7
diff --git a/crates/ra_hir/src/nameres/tests/incremental.rs b/crates/ra_hir/src/nameres/tests/incremental.rs
index 001f76ac3..bc721f6e0 100644
--- a/crates/ra_hir/src/nameres/tests/incremental.rs
+++ b/crates/ra_hir/src/nameres/tests/incremental.rs
@@ -116,7 +116,7 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() {
116 let events = db.log_executed(|| { 116 let events = db.log_executed(|| {
117 let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); 117 let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap();
118 let decls = module.declarations(&db); 118 let decls = module.declarations(&db);
119 assert_eq!(decls.len(), 1); 119 assert_eq!(decls.len(), 18);
120 }); 120 });
121 assert!(format!("{:?}", events).contains("crate_def_map"), "{:#?}", events) 121 assert!(format!("{:?}", events).contains("crate_def_map"), "{:#?}", events)
122 } 122 }
@@ -126,7 +126,7 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() {
126 let events = db.log_executed(|| { 126 let events = db.log_executed(|| {
127 let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); 127 let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap();
128 let decls = module.declarations(&db); 128 let decls = module.declarations(&db);
129 assert_eq!(decls.len(), 1); 129 assert_eq!(decls.len(), 18);
130 }); 130 });
131 assert!(!format!("{:?}", events).contains("crate_def_map"), "{:#?}", events) 131 assert!(!format!("{:?}", events).contains("crate_def_map"), "{:#?}", events)
132 } 132 }
diff --git a/crates/ra_hir/src/nameres/tests/primitives.rs b/crates/ra_hir/src/nameres/tests/primitives.rs
new file mode 100644
index 000000000..734744835
--- /dev/null
+++ b/crates/ra_hir/src/nameres/tests/primitives.rs
@@ -0,0 +1,24 @@
1use super::*;
2
3#[test]
4fn primitive_reexport() {
5 let map = def_map(
6 "
7 //- /lib.rs
8 mod foo;
9 use foo::int;
10
11 //- /foo.rs
12 pub use i32 as int;
13 ",
14 );
15 assert_snapshot_matches!(map, @r###"
16 ⋮crate
17 ⋮foo: t
18 ⋮int: t
19
20 ⋮crate::foo
21 ⋮int: t
22 "###
23 );
24}