diff options
author | Marcus Klaas de Vries <[email protected]> | 2019-01-06 20:39:36 +0000 |
---|---|---|
committer | Marcus Klaas de Vries <[email protected]> | 2019-01-06 21:17:54 +0000 |
commit | 82d9a77dade454ee8d09f198fa839e7755ff7bfb (patch) | |
tree | 791b3c0ee6069a06896c815795ff7e86877887df /crates/ra_hir/src/ty/tests.rs | |
parent | 4fc233a02e8dc07619a969400c445ec47c2b1a9d (diff) |
Touch up type inference for boolean operators
Also try to infer its subexpressions and set type expectations
whenever possible.
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 97c466890..1650606b7 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -157,11 +157,18 @@ impl S { | |||
157 | fn infer_boolean_op() { | 157 | fn infer_boolean_op() { |
158 | check_inference( | 158 | check_inference( |
159 | r#" | 159 | r#" |
160 | fn f(x: bool) -> i32 { | ||
161 | 0i32 | ||
162 | } | ||
163 | |||
160 | fn test() { | 164 | fn test() { |
161 | let x = a && b; | 165 | let x = a && b; |
162 | let y = true || false; | 166 | let y = true || false; |
163 | let z = x == y; | 167 | let z = x == y; |
164 | let h = CONST_1 <= CONST_2; | 168 | let h = CONST_1 <= CONST_2; |
169 | let c = f(z || y) + 5; | ||
170 | let d = b; | ||
171 | let e = 3i32 && "hello world"; | ||
165 | 172 | ||
166 | 10 < 3 | 173 | 10 < 3 |
167 | } | 174 | } |