diff options
author | Florian Diebold <[email protected]> | 2019-01-10 21:49:43 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-01-11 21:59:00 +0000 |
commit | 1212e59beed25d768bfaf7bb202aa955a87106e9 (patch) | |
tree | e2996f670efd50d346cfa8dd0f836bcb65aca4dc /crates/ra_hir/src/ty/tests.rs | |
parent | f60153ee9e1d598c170743633448aa3ede8cb72e (diff) |
Fix assertion error in unification (hopefully)
Currently, all types that we handle during inference need to be resolved as far
as possible at the time. It's maybe too brittle of an invariant; I need to think
how we can do this better. This should fix #484 though, I hope (if
it's the same case as I managed to reproduce).
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index d8c0af326..815aecda7 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -230,6 +230,18 @@ fn test2(a1: *const A, a2: *mut A) { | |||
230 | ); | 230 | ); |
231 | } | 231 | } |
232 | 232 | ||
233 | #[test] | ||
234 | fn infer_bug_484() { | ||
235 | check_inference( | ||
236 | r#" | ||
237 | fn test() { | ||
238 | let x = if true {}; | ||
239 | } | ||
240 | "#, | ||
241 | "bug_484.txt", | ||
242 | ); | ||
243 | } | ||
244 | |||
233 | fn infer(content: &str) -> String { | 245 | fn infer(content: &str) -> String { |
234 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 246 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
235 | let source_file = db.source_file(file_id); | 247 | let source_file = db.source_file(file_id); |