aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-15 23:05:28 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-15 23:05:28 +0000
commit68d320a680b5df802b2c3e7dad5d890e3309ed60 (patch)
treef38fafe9cbc4efea5574afa6c40a0fea403bf34c /crates/ra_hir/src/ty/tests.rs
parentab46f8abf195a78c018d8b23896eb920d16b028b (diff)
parenta2b6d3da30020421c97100d7c8699a3b4f8cd6fb (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.rs23
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]
162fn infer_unary_op() {
163 check_inference(
164 r#"
165enum SomeType {}
166
167fn 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]
162fn infer_backwards() { 185fn infer_backwards() {
163 check_inference( 186 check_inference(
164 r#" 187 r#"