This commit is contained in:
damirka 2021-05-06 14:01:42 +03:00
parent 91c9969ff9
commit e3983bfa90
40 changed files with 371 additions and 43 deletions

View File

@ -3,7 +3,6 @@ namespace: Compile
expectation: Fail
*/
function main() {
const a: [u8; -2] = [0u32; 2];
}

View File

@ -1,5 +1,11 @@
function main(a: [[u8; 2]; 3]) {
/*
namespace: Compile
expectation: Pass
input_file: input/input_tuple_3x2.in
*/
function main(a: [[u8; 2]; 3]) -> bool {
const b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
console.assert(a == b);
}
return a == b;
}

View File

@ -1,8 +1,14 @@
function main(a: [[[u8; 2]; 3]; 4]) {
/*
namespace: Compile
expectation: Pass
input_file: input/type_tuple_value_nested_4x3x2.in
*/
function main(a: [[[u8; 2]; 3]; 4]) -> bool {
const b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
console.assert(a == b);
}
return a == b;
}

View File

@ -1,7 +1,12 @@
function main() {
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
/*
namespace: Compile
expectation: Pass
input_file: input/type_nested_value_nested_3x2.in
*/
function main() -> bool {
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
const b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer
console.assert(a == b);
}
return a == b;
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
}
}

View File

@ -1,4 +1,10 @@
function main() {
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main(y: bool) -> bool {
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
@ -6,5 +12,5 @@ function main() {
const b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer
console.assert(a == b);
}
return a == b == y;
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
}
}

View File

@ -1,7 +1,12 @@
function main() {
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main(y: bool) -> bool {
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
const b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer
console.assert(a == b);
}
return a == b == y;
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
}
}

View File

@ -1,4 +1,10 @@
function main() {
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main(y: bool) -> bool {
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
@ -6,5 +12,5 @@ function main() {
const b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer
console.assert(a == b);
}
return a == b == y;
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)
}
}

View File

@ -1,7 +1,13 @@
function main() {
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main(y: bool) -> bool {
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
const b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer
console.assert(a == b);
}
return a == b == y;
}

View File

@ -1,3 +1,9 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
function main() {
const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)
}
}

View File

@ -1,4 +1,10 @@
function main() {
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main(y: bool) -> bool {
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
@ -6,5 +12,5 @@ function main() {
const b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer
console.assert(a == b);
}
return a == b == y;
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
}
}

View File

@ -1,7 +1,13 @@
function main() {
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main(y: bool) -> bool {
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
const b: [u8; (3, 2)] = [0; (3, 2)]; // initializer
console.assert(a == b);
}
return a == b == y;
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)
}
}

View File

@ -1,4 +1,10 @@
function main() {
/*
namespace: Compile
expectation: Pass
input_file: input/dummy.in
*/
function main(y: bool) -> bool{
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
@ -6,5 +12,5 @@ function main() {
const b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer
console.assert(a == b);
}
return a == b == y;
}

View File

@ -1,3 +1,8 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)
}
}

View File

@ -1,7 +1,12 @@
/*
namespace: Compile
expectation: Fail
*/
function main() {
const a = [1u8; 10];
for i in 0..10 {
const x = a[i..10];
console.debug("{}", x);
}
}
}

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_fail.leo:5:19\n |\n 5 | const a: [u8; -2] = [0u32; 2];\n | ^\n |\n = expected '(' -- got '-'"
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_fail.leo:4:19\n |\n 4 | const a: [u8; -2] = [0u32; 2];\n | ^\n |\n = expected '(' -- got '-'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 95
num_constraints: 95
at: 5884e806c47756fa1d12f47e5cc5249843d8de4e2fafcb373c5a0d67dfe22d69
bt: 983c734b40e342144d6b4d52e315da9ff9f97580f019f606403924bb977a5be7
ct: 49f0db71bd29b80dbe5f2f96573a5959b1df339c92350e16f111bade214037aa
output:
- input_file: input/input_tuple_3x2.in
output:
registers:
x:
type: bool
value: "true"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 383
num_constraints: 383
at: ec8cf3ea9e586d3c504b8b467b4404d213dd375aa2691f2b9a8670c879ffa24d
bt: 9b5ba17ea683af827718f9062b3102faa0be01b9f67022e2322db989bf90f057
ct: 6fe90b4e46834afeb215a4702281504d676eae391588e5b576f6e406f6ddd504
output:
- input_file: input/type_tuple_value_nested_4x3x2.in
output:
registers:
x:
type: bool
value: "true"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 0
num_constraints: 0
at: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
bt: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
ct: 4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945
output:
- input_file: input/type_nested_value_nested_3x2.in
output:
registers:
x:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_nested_value_nested_3x2_fail.leo:4:29\n |\n 4 | const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_nested_value_nested_4x3x2_fail.leo:4:34\n |\n 4 | const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 4', received: 'array of length 2'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_nested_value_tuple_3x2_fail.leo:4:29\n |\n 4 | const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 3', received: 'array of length 2'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_nested_value_tuple_4x3x2_fail.leo:4:34\n |\n 4 | const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 4', received: 'array of length 2'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_tuple_value_nested_3x2_fail.leo:4:29\n |\n 4 | const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 2', received: 'array of length 3'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_tuple_value_nested_4x3x2_fail.leo:4:32\n |\n 4 | const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 4', received: 'array of length 2'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_tuple_value_tuple_3x2_fail.leo:4:29\n |\n 4 | const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 2', received: 'array of length 3'"

View File

@ -0,0 +1,18 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/type_tuple_value_tuple_4x3x2_fail.leo:4:32\n |\n 4 | const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)\n | ^^^^^^^^^^^^^^\n |\n = unexpected type, expected: 'array of length 4', received: 'array of length 2'"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> /Users/dam/projects/aleo/leo/test-framework/../tests/compiler/array/variable_slice_fail.leo:6:19\n |\n 6 | const x = a[i..10];\n | ^^^^^^^^\n |\n = array size cannot be inferred, add explicit types"