aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/tests.rs7
-rw-r--r--crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt41
2 files changed, 38 insertions, 10 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 {
157fn infer_boolean_op() { 157fn infer_boolean_op() {
158 check_inference( 158 check_inference(
159 r#" 159 r#"
160fn f(x: bool) -> i32 {
161 0i32
162}
163
160fn test() { 164fn 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}
diff --git a/crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt b/crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt
index cc07cdccb..ca01ad159 100644
--- a/crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt
+++ b/crates/ra_hir/src/ty/tests/data/0008_boolean_op.txt
@@ -1,10 +1,31 @@
1[21; 22) 'x': bool 1[28; 32) '0i32': i32
2[68; 69) 'z': bool 2[22; 34) '{ 0i32 }': i32
3[72; 78) 'x == y': bool 3[6; 7) 'x': [unknown]
4[45; 58) 'true || false': bool 4[127; 134) 'CONST_1': [unknown]
5[11; 125) '{ ... < 3 }': bool 5[201; 205) '3i32': bool
6[117; 123) '10 < 3': bool 6[76; 77) 'y': bool
7[88; 89) 'h': bool 7[65; 66) 'b': bool
8[41; 42) 'y': bool 8[60; 66) 'a && b': bool
9[92; 110) 'CONST_...ONST_2': bool 9[127; 145) 'CONST_...ONST_2': bool
10[25; 31) 'a && b': bool 10[182; 183) 'd': [unknown]
11[229; 231) '10': [unknown]
12[209; 222) '"hello world"': bool
13[229; 235) '10 < 3': bool
14[186; 187) 'b': [unknown]
15[159; 172) 'f(z || y) + 5': [unknown]
16[56; 57) 'x': bool
17[112; 113) 'y': bool
18[201; 222) '3i32 &...world"': bool
19[234; 235) '3': [unknown]
20[138; 145) 'CONST_2': [unknown]
21[80; 93) 'true || false': bool
22[46; 237) '{ ... < 3 }': bool
23[197; 198) 'e': bool
24[107; 113) 'x == y': bool
25[88; 93) 'false': bool
26[80; 84) 'true': bool
27[123; 124) 'h': bool
28[155; 156) 'c': [unknown]
29[103; 104) 'z': bool
30[60; 61) 'a': bool
31[107; 108) 'x': bool