leo/tests/compiler/integers/i16/negate_min_fail.leo

15 lines
327 B
Plaintext
Raw Normal View History

2021-05-10 20:19:19 +03:00
/*
namespace: Compile
2022-08-06 19:32:01 +03:00
expectation: Pass
input_file: ../inputs/dummy.in
2021-05-10 20:19:19 +03:00
*/
2022-08-06 19:32:01 +03:00
// TODO: This test passes, but constant propogation should detect an overflow.
@program
function main(y: bool) -> i16 {
2022-08-10 19:27:50 +03:00
let a: i16 = -32768i16;
2022-07-29 02:23:16 +03:00
2022-08-10 19:27:50 +03:00
return -a; // This line attempts to return 32768i16 however, the largest i16 value is 32767i16.
2021-05-10 20:19:19 +03:00
}