diff options
author | Marcus Klaas de Vries <[email protected]> | 2019-01-05 20:28:30 +0000 |
---|---|---|
committer | Marcus Klaas de Vries <[email protected]> | 2019-01-05 20:28:30 +0000 |
commit | 4fc233a02e8dc07619a969400c445ec47c2b1a9d (patch) | |
tree | dae33907a38b7c4ed9d1a63ff38803e99f1ae6df /crates/ra_hir/src/ty/tests.rs | |
parent | 3e42a158787955ff9f2e81be43479dbe8f2b1bb6 (diff) |
Implement type inference for boolean operators
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index fb53fcf0b..97c466890 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -153,6 +153,23 @@ impl S { | |||
153 | ); | 153 | ); |
154 | } | 154 | } |
155 | 155 | ||
156 | #[test] | ||
157 | fn infer_boolean_op() { | ||
158 | check_inference( | ||
159 | r#" | ||
160 | fn test() { | ||
161 | let x = a && b; | ||
162 | let y = true || false; | ||
163 | let z = x == y; | ||
164 | let h = CONST_1 <= CONST_2; | ||
165 | |||
166 | 10 < 3 | ||
167 | } | ||
168 | "#, | ||
169 | "0008_boolean_op.txt", | ||
170 | ); | ||
171 | } | ||
172 | |||
156 | fn infer(content: &str) -> String { | 173 | fn infer(content: &str) -> String { |
157 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 174 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
158 | let source_file = db.source_file(file_id); | 175 | let source_file = db.source_file(file_id); |