Add more test cases checking for member records

This commit is contained in:
Pranav Gaddamadugu 2022-08-11 08:55:07 -07:00
parent 8caafb78d5
commit 64cecda841
11 changed files with 108 additions and 8 deletions

View File

@ -3,13 +3,9 @@ namespace: Compile
expectation: Fail
*/
record Foo {
// The token owner.
owner: address,
// The Aleo balance (in gates).
gates: u64,
circuit Foo {
// The token amount.
amount: u64,
token: Token,
}
record Token {

View File

@ -0,0 +1,16 @@
/*
namespace: Compile
expectation: Fail
*/
record Foo {
owner: address,
gates: u64,
amount: u64,
}
record Token {
owner: address,
gates: u64,
foo: Foo,
}

View File

@ -0,0 +1,17 @@
/*
namespace: Compile
expectation: Fail
*/
record Token2 {
owner: address,
gates: u64,
foo: (Foo, Foo),
}
record Foo {
owner: address,
gates: u64,
amount: u64,
}

View File

@ -0,0 +1,21 @@
/*
namespace: Compile
expectation: Fail
*/
record Token {
owner: address,
gates: u64,
bar: Bar,
}
circuit Bar {
bar: Foo,
}
record Foo {
owner: address,
gates: u64,
amount: u64,
}

View File

@ -0,0 +1,25 @@
/*
namespace: Compile
expectation: Fail
*/
record Token3 {
owner: address,
gates: u64,
bar: (Bar, Bar),
}
circuit Bar {
bar: (Token, Token),
}
record Token {
owner: address,
gates: u64,
amount: u64,
}

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:5:5\n |\n 5 | token: Token,\n | ^^^^^\n |\n = Remove the record `Token` from `Foo`.\n"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:12:5\n |\n 12 | foo: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Token`.\n"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372025]: Tuples are only allowed as function return types.\n --> compiler-test:7:5\n |\n 7 | foo: (Foo, Foo),\n | ^^^\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:7:5\n |\n 7 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:7:5\n |\n 7 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\n"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:11:5\n |\n 11 | bar: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Bar`.\n"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372025]: Tuples are only allowed as function return types.\n --> compiler-test:6:5\n |\n 6 | bar: (Bar, Bar),\n | ^^^\nError [ETYC0372025]: Tuples are only allowed as function return types.\n --> compiler-test:10:5\n |\n 10 | bar: (Token, Token),\n | ^^^\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:10:5\n |\n 10 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:10:5\n |\n 10 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\n"

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372030]: A record cannot contain another record.\n --> compiler-test:12:1\n |\n 12 | record Token {\n 13 | // The token owner.\n 14 | owner: address,\n 15 | // The Aleo balance (in gates).\n 16 | gates: u64,\n 17 | // The token amount.\n 18 | foo: Foo,\n 19 | }\n | ^\n |\n = Remove the record `Foo from `Token`.\n"
- "Error [EPAR0370005]: expected 'function', 'circuit', 'test' -- found 'interface'\n --> compiler-test:21:1\n |\n 21 | interface Bar {\n | ^^^^^^^^^"