diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index a76925b58..93bf431c4 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -113,6 +113,27 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { | |||
113 | ); | 113 | ); |
114 | } | 114 | } |
115 | 115 | ||
116 | #[test] | ||
117 | fn infer_backwards() { | ||
118 | check_inference( | ||
119 | r#" | ||
120 | fn takes_u32(x: u32) {} | ||
121 | |||
122 | struct S { i32_field: i32 } | ||
123 | |||
124 | fn test() -> &mut &f64 { | ||
125 | let a = unknown_function(); | ||
126 | takes_u32(a); | ||
127 | let b = unknown_function(); | ||
128 | S { i32_field: b }; | ||
129 | let c = unknown_function(); | ||
130 | &mut &c | ||
131 | } | ||
132 | "#, | ||
133 | "0006_backwards.txt", | ||
134 | ); | ||
135 | } | ||
136 | |||
116 | fn infer(content: &str) -> String { | 137 | fn infer(content: &str) -> String { |
117 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 138 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
118 | let source_file = db.source_file(file_id); | 139 | let source_file = db.source_file(file_id); |