leo/tests/compiler/array/spread.leo

15 lines
297 B
Plaintext
Raw Normal View History

2021-05-05 21:25:24 +03:00
/*
namespace: Compile
expectation: Pass
input_file: input/three_ones.in
*/
// A spread operator `...` copies the elements of one array into another
2021-05-05 21:25:24 +03:00
function main(a: [u8; 3]) -> bool {
const b = [1u8, 1u8];
const c = [1u8, ...b];
2021-06-23 17:08:32 +03:00
const d = [...b, 1u8];
2021-06-23 17:08:32 +03:00
return a == c && d == a;
2021-05-05 21:25:24 +03:00
}