-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
207 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
namespace: Compile | ||
expectation: Pass | ||
outputs: | ||
- - initial_symbol_table: 002a658ff3a2db38eb21e316458d2473313bbe50f2b4a7cd4aa6e04444c2ed3c | ||
type_checked_symbol_table: e6cbe752fa16e7a820685d02f654c97c2ccf509f7bb3287ea7060017bda0a139 | ||
unrolled_symbol_table: e6cbe752fa16e7a820685d02f654c97c2ccf509f7bb3287ea7060017bda0a139 | ||
initial_ast: 6eefbb8a62e5c5b798129574876dee19ee0e3b75de9337f539a3a005b18ea1f7 | ||
unrolled_ast: 6eefbb8a62e5c5b798129574876dee19ee0e3b75de9337f539a3a005b18ea1f7 | ||
ssa_ast: 6eefbb8a62e5c5b798129574876dee19ee0e3b75de9337f539a3a005b18ea1f7 | ||
flattened_ast: 2f4a5e927ab19fb770caabe0c4a3ceda8d765d4303c59ad1a0c8350cecd8a9fd | ||
destructured_ast: 1dc62a6fcfea66fe2a10e3a5584057ab22f8b737252efb2902778b1c651fcd8f | ||
inlined_ast: 1dc62a6fcfea66fe2a10e3a5584057ab22f8b737252efb2902778b1c651fcd8f | ||
dce_ast: 1dc62a6fcfea66fe2a10e3a5584057ab22f8b737252efb2902778b1c651fcd8f | ||
bytecode: b39b7b375dab7194cd24f4f2dde6f8c4c13e6a25b9107af52fddb45df9e3435f | ||
warnings: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
namespace: Compile | ||
expectation: Fail | ||
outputs: | ||
- "Error [ETYC0372000]: invalid assignment target\n --> compiler-test:5:9\n |\n 5 | a[0u32] = false;\n | ^^^^^^^\nError [ETYC0372000]: invalid assignment target\n --> compiler-test:6:9\n |\n 6 | a[1u32] = true;\n | ^^^^^^^\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
namespace: Compile | ||
expectation: Fail | ||
outputs: | ||
- "Error [ETYC0372007]: Expected one type from `array`, but got `u32`\n --> compiler-test:9:29\n |\n 9 | sum = sum + a[i][j];\n | ^^^^\nError [ETYC0372003]: Expected type `u32` but type `no type` was found\n --> compiler-test:9:23\n |\n 9 | sum = sum + a[i][j];\n | ^^^^^^^^^^^^^\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
namespace: Compile | ||
expectation: Pass | ||
outputs: | ||
- - initial_symbol_table: 03511070212594f877945470becbe3258d1dbc7c5673adb0d2fa56fc7b9d52ae | ||
type_checked_symbol_table: 9a9deaa022f73e57c24c8336dffa974f8cddb35e9b81c5b383571a37d2531bf2 | ||
unrolled_symbol_table: 9a9deaa022f73e57c24c8336dffa974f8cddb35e9b81c5b383571a37d2531bf2 | ||
initial_ast: 12e8c9a76387f6e9b54a59010089629f2f3c0736c56da880208280e86611e3fb | ||
unrolled_ast: 12e8c9a76387f6e9b54a59010089629f2f3c0736c56da880208280e86611e3fb | ||
ssa_ast: eb96cfc44c8d578ec0cf3172f2e794e36c0052aab90eeef12f8ec7c8f8922758 | ||
flattened_ast: 9f508e380ec0e1c97854f3101a18b33de757b26cb241c07995f7ad387544ea7c | ||
destructured_ast: 621c185f09c1cffc1ac757e55ced700b67068c08837c58dc9462dcdc5605faa7 | ||
inlined_ast: 621c185f09c1cffc1ac757e55ced700b67068c08837c58dc9462dcdc5605faa7 | ||
dce_ast: 621c185f09c1cffc1ac757e55ced700b67068c08837c58dc9462dcdc5605faa7 | ||
bytecode: 11706f359e35f6269b2f879e483f2e1dc1df99c710fc8476dfb1e3c6115d8268 | ||
warnings: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
namespace: Compile | ||
expectation: Pass | ||
outputs: | ||
- - initial_symbol_table: db965bbea0fe710347e590189a11c632e67356d6eb3dcff1ee3746f59abada67 | ||
type_checked_symbol_table: 7388f185d6d4bf6f50baf94b543d24759c53a72ebe46a730911eb7c13b429970 | ||
unrolled_symbol_table: 7388f185d6d4bf6f50baf94b543d24759c53a72ebe46a730911eb7c13b429970 | ||
initial_ast: 89e5ca97a429005c3b5c6fdd40756114ed302961d90fc8109c25218613dbe305 | ||
unrolled_ast: 89e5ca97a429005c3b5c6fdd40756114ed302961d90fc8109c25218613dbe305 | ||
ssa_ast: daa92399cb5b70a35693c15d2f3a59ae0f75a9203c7be55ddb12a083adeeb2c4 | ||
flattened_ast: cf3dd007fa44453a99893d32369678eaa8bdce11ebe676fd5383fe726f5b2f39 | ||
destructured_ast: 12970e30a633c72202544f4d9fcdd174a63d0cd52595a7cb499b92baf1da028f | ||
inlined_ast: 12970e30a633c72202544f4d9fcdd174a63d0cd52595a7cb499b92baf1da028f | ||
dce_ast: 12970e30a633c72202544f4d9fcdd174a63d0cd52595a7cb499b92baf1da028f | ||
bytecode: 789b22bc0c6e954ae7fed24a064342bf0729393fab7e8d8206b0923f53240dd1 | ||
warnings: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
namespace: Compile | ||
expectation: Pass | ||
*/ | ||
|
||
program test.aleo { | ||
mapping data: address => [bool; 8]; | ||
|
||
transition foo(a: [bool; 8]) { | ||
return then finalize(self.caller, a); | ||
} | ||
|
||
finalize foo(caller: address, a: [bool; 8]) { | ||
data.set(caller, a); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
namespace: Compile | ||
expectation: Fail | ||
*/ | ||
|
||
program test.aleo { | ||
transition foo(a: [bool; 8]) -> [bool; 8] { | ||
a[0u32] = false; | ||
a[1u32] = true; | ||
return a; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
namespace: Compile | ||
expectation: Fail | ||
*/ | ||
|
||
|
||
program test.aleo { | ||
transition foo(a: [u32; 4]) { | ||
let sum: u32 = 0u32; | ||
for i: u32 in 0u32..4u32 { | ||
for j: u32 in 0u32..4u32 { | ||
sum = sum + a[i][j]; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
namespace: Compile | ||
expectation: Pass | ||
*/ | ||
|
||
program test.aleo { | ||
transition main( | ||
a: address, b: bool, c: field, d: i8, e: i16, f: i64, g: i128, h: u8, i: u16, j: u32, k: u64, l: u128, m: scalar, n: i32 | ||
) -> ( | ||
address, bool, field, i8, i16, i64, i128, u8, u16, u32, u64, u128, scalar, i32 | ||
) { | ||
let one: address = b ? a : a; | ||
let two: bool = b ? b : b; | ||
let three: field = b ? c : c; | ||
let four: i8 = b ? d : d; | ||
let five: i16 = b ? e : e; | ||
let six: i64 = b ? f : f; | ||
let seven: i128 = b ? g : g; | ||
let eight: u8 = b ? h : h; | ||
let nine: u16 = b ? i : i; | ||
let ten: u32 = b ? j : j; | ||
let eleven: u64 = b ? k : k; | ||
let twelve: u128 = b ? l : l; | ||
let thirteen: scalar = b ? m : m; | ||
let fourteen: i32 = b ? n : n; | ||
return (one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
namespace: Compile | ||
expectation: Pass | ||
*/ | ||
|
||
program test.aleo { | ||
|
||
struct Data { | ||
data: [u8; 2], | ||
} | ||
|
||
function foo(a: u8, b: u8) -> [Data; 2] { | ||
let data_1: Data = Data { data: [a, b] }; | ||
let data_2: Data = Data { data: [b, a] }; | ||
if (a == b) { | ||
return [data_1, data_2]; | ||
} | ||
|
||
let data_3: Data = Data { data: [2u8 * data_1.data[0u8], 4u8 * data_2.data[1u8]] }; | ||
|
||
return [data_2, data_3]; | ||
} | ||
|
||
transition bar(flag1: bool, flag2: bool, a: u8, b: u8) -> [Data; 2] { | ||
let start: [Data; 2] = foo(a, b); | ||
if flag1 { | ||
start = foo(start[0u8].data[0u8], start[1u8].data[1u8]); | ||
} else { | ||
if flag2 { | ||
start = foo(start[1u8].data[0u8], start[0u8].data[1u8]); | ||
} else { | ||
start = foo(start[0u8].data[1u8], start[1u8].data[0u8]); | ||
} | ||
} | ||
return start; | ||
} | ||
} |