File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1
1
// check-pass
2
2
3
3
fn main ( ) {
4
+ // Test that we can infer the type of binary operands when
5
+ // references are involved, on various types and operators.
4
6
let _: u8 = 0 + 0 ;
5
7
let _: u8 = 0 + & 0 ;
6
8
let _: u8 = & 0 + 0 ;
@@ -10,4 +12,19 @@ fn main() {
10
12
let _: f32 = 0.0 + & 0.0 ;
11
13
let _: f32 = & 0.0 + 0.0 ;
12
14
let _: f32 = & 0.0 + & 0.0 ;
15
+
16
+ let _: u8 = 0 << 0 ;
17
+ let _: u8 = 0 << & 0 ;
18
+ let _: u8 = & 0 << 0 ;
19
+ let _: u8 = & 0 << & 0 ;
20
+
21
+ // Test type inference when variable types are indirectly inferred.
22
+ let a = 22 ;
23
+ let _: usize = a + & 44 ;
24
+
25
+ // When we have no expected type, the types of the operands is the default type.
26
+ let _ = 0 + 0 ;
27
+ let _ = 0 + & 0 ;
28
+ let _ = & 0 + 0 ;
29
+ let _ = & 0 + & 0 ;
13
30
}
You can’t perform that action at this time.
0 commit comments