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 11// check-pass
22
33fn main ( ) {
4+ // Test that we can infer the type of binary operands when
5+ // references are involved, on various types and operators.
46 let _: u8 = 0 + 0 ;
57 let _: u8 = 0 + & 0 ;
68 let _: u8 = & 0 + 0 ;
@@ -10,4 +12,19 @@ fn main() {
1012 let _: f32 = 0.0 + & 0.0 ;
1113 let _: f32 = & 0.0 + 0.0 ;
1214 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 ;
1330}
You can’t perform that action at this time.
0 commit comments