diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 23:05:28 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 23:05:28 +0000 |
commit | 68d320a680b5df802b2c3e7dad5d890e3309ed60 (patch) | |
tree | f38fafe9cbc4efea5574afa6c40a0fea403bf34c /crates/ra_hir/src/ty/tests.rs | |
parent | ab46f8abf195a78c018d8b23896eb920d16b028b (diff) | |
parent | a2b6d3da30020421c97100d7c8699a3b4f8cd6fb (diff) |
Merge #544
544: Implement rudimentary type inference for unary operators r=marcusklaas a=marcusklaas
Co-authored-by: Marcus Klaas de Vries <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 929fee04c..5d7bc25cc 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -159,6 +159,29 @@ fn test() { | |||
159 | } | 159 | } |
160 | 160 | ||
161 | #[test] | 161 | #[test] |
162 | fn infer_unary_op() { | ||
163 | check_inference( | ||
164 | r#" | ||
165 | enum SomeType {} | ||
166 | |||
167 | fn test(x: SomeType) { | ||
168 | let b = false; | ||
169 | let c = !b; | ||
170 | let a = 100; | ||
171 | let d: i128 = -a; | ||
172 | let e = -100; | ||
173 | let f = !!!true; | ||
174 | -3.14; | ||
175 | -x; | ||
176 | !x; | ||
177 | -"hello"; | ||
178 | } | ||
179 | "#, | ||
180 | "unary_op.txt", | ||
181 | ); | ||
182 | } | ||
183 | |||
184 | #[test] | ||
162 | fn infer_backwards() { | 185 | fn infer_backwards() { |
163 | check_inference( | 186 | check_inference( |
164 | r#" | 187 | r#" |