aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-08 10:44:30 +0000
committerGitHub <[email protected]>2019-12-08 10:44:30 +0000
commitb236f6aa499f98985acd07a34eb0c0d147bf8d5f (patch)
treec42e1491fd61bbc2326d3d658d23cb19594d9ade /crates/ra_hir_ty/src
parentffcdd25cc8e7f1fd7fb4e3e8478c4cd1adfbf843 (diff)
parent51f4fb448f1993a20c9527a8e6d301a9202ce35a (diff)
Merge #2466
2466: Handle partial resolve cases r=matklad a=edwin0cheng Another try to fix #2443 : We resolve all imports every time in `DefCollector::collect` loop even it is resolved previously. This is because other unresolved imports and macros will bring in another `PerNs`, so we can only assume that it has been partially resolved. Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index 9c29a054e..812f171db 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -211,6 +211,35 @@ pub fn baz() -> usize { 31usize }
211} 211}
212 212
213#[test] 213#[test]
214fn infer_type_value_non_legacy_macro_use_as() {
215 assert_snapshot!(
216 infer(r#"
217mod m {
218 macro_rules! _foo {
219 ($x:ident) => { type $x = u64; }
220 }
221 pub(crate) use _foo as foo;
222}
223
224m::foo!(foo);
225use foo as bar;
226fn f() -> bar { 0 }
227fn main() {
228 let _a = f();
229}
230"#),
231 @r###"
232 [159; 164) '{ 0 }': u64
233 [161; 162) '0': u64
234 [175; 199) '{ ...f(); }': ()
235 [187; 189) '_a': u64
236 [193; 194) 'f': fn f() -> u64
237 [193; 196) 'f()': u64
238 "###
239 );
240}
241
242#[test]
214fn infer_builtin_macros_line() { 243fn infer_builtin_macros_line() {
215 assert_snapshot!( 244 assert_snapshot!(
216 infer(r#" 245 infer(r#"