| 1 | export fn entry1() void { |
| 2 | const spartan_count: u16 = 300; |
| 3 | const byte: u8 = @intCast(spartan_count); |
| 4 | _ = byte; |
| 5 | } |
| 6 | export fn entry2() void { |
| 7 | const spartan_count: u16 = 300; |
| 8 | const byte: u8 = spartan_count; |
| 9 | _ = byte; |
| 10 | } |
| 11 | export fn entry3() void { |
| 12 | var spartan_count: u16 = 300; |
| 13 | var byte: u8 = spartan_count; |
| 14 | _ = .{ &spartan_count, &byte }; |
| 15 | } |
| 16 | export fn entry4() void { |
| 17 | var signed: i8 = -1; |
| 18 | var unsigned: u64 = signed; |
| 19 | _ = .{ &signed, &unsigned }; |
| 20 | } |
| 21 | |
| 22 | // error |
| 23 | // |
| 24 | // :3:31: error: type 'u8' cannot represent integer value '300' |
| 25 | // :8:22: error: type 'u8' cannot represent integer value '300' |
| 26 | // :13:20: error: expected type 'u8', found 'u16' |
| 27 | // :13:20: note: unsigned 8-bit int cannot represent all possible unsigned 16-bit values |
| 28 | // :18:25: error: expected type 'u64', found 'i8' |
| 29 | // :18:25: note: unsigned 64-bit int cannot represent all possible signed 8-bit values |