change tests

This commit is contained in:
gluax 2022-04-05 09:36:22 -07:00
parent 16914e3ce8
commit a675b81c0a
19 changed files with 647 additions and 38 deletions

View File

@ -65,9 +65,9 @@ impl ParserContext<'_> {
/// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter.
/// ///
pub fn parse_function_parameters(&mut self) -> Result<FunctionInput> { pub fn parse_function_parameters(&mut self) -> Result<FunctionInput> {
let public = self.eat(Token::Public).is_some();
let const_ = self.eat(Token::Const); let const_ = self.eat(Token::Const);
let mutable = self.eat(Token::Mut); let mutable = self.eat(Token::Mut);
let public = self.eat(Token::Public).is_some();
let name = self.expect_ident()?; let name = self.expect_ident()?;

View File

@ -67,8 +67,8 @@ impl ParserContext<'_> {
/// `<identifier> : <type> = <expression>;` /// `<identifier> : <type> = <expression>;`
/// Returns [`Definition`]. /// Returns [`Definition`].
pub fn parse_input_definition(&mut self) -> Result<Definition> { pub fn parse_input_definition(&mut self) -> Result<Definition> {
let const_ = self.eat(Token::Const).is_some();
let public = self.eat(Token::Public).is_some(); let public = self.eat(Token::Public).is_some();
let const_ = self.eat(Token::Const).is_some();
let name = self.expect_ident()?; let name = self.expect_ident()?;
self.expect(Token::Colon)?; self.expect(Token::Colon)?;

View File

@ -11,7 +11,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}"
const_: true const_: true
private: false
public: false public: false
mutable: false mutable: false
type_: type_:
@ -132,7 +131,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: Boolean type_: Boolean

View File

@ -11,7 +11,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: type_:
@ -26,7 +25,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}"
const_: true const_: true
private: false
public: false public: false
mutable: false mutable: false
type_: type_:
@ -82,7 +80,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
const_: true const_: true
private: false
public: false public: false
mutable: false mutable: false
type_: type_:
@ -97,7 +94,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: type_:

View File

@ -0,0 +1,5 @@
---
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370009]: unexpected string: expected 'ident', got 'public'\n --> test:3:26\n |\n 3 | function x(x: u32, const public y: i32) {\n | ^^^^^^"

View File

@ -53,7 +53,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: Boolean type_: Boolean

View File

@ -11,7 +11,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: type_:
@ -26,7 +25,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: type_:

View File

@ -11,7 +11,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: type_:
@ -26,7 +25,6 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
const_: false const_: false
private: false
public: false public: false
mutable: true mutable: true
type_: type_:

View File

@ -0,0 +1,145 @@
---
namespace: Parse
expectation: Pass
outputs:
- name: ""
expected_input: []
functions:
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public const y: i32) {\\\"}\"}":
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public const y: i32) {\\\"}\"}"
input:
- Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public const y: i32) {\\\"}\"}"
const_: false
public: false
mutable: true
type_:
IntegerType: U32
span:
line_start: 3
line_stop: 3
col_start: 12
col_stop: 13
path: ""
content: "function x(x: u32, public const y: i32) {"
- Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public const y: i32) {\\\"}\"}"
const_: true
public: true
mutable: false
type_:
IntegerType: I32
span:
line_start: 3
line_stop: 3
col_start: 33
col_stop: 34
path: ""
content: "function x(x: u32, public const y: i32) {"
const_: false
output: ~
core_mapping: ~
block:
statements:
- Return:
expression:
Value:
Implicit:
- "0"
- span:
line_start: 4
line_stop: 4
col_start: 12
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 4
line_stop: 4
col_start: 5
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 3
line_stop: 5
col_start: 41
col_stop: 2
path: ""
content: "function x(x: u32, public const y: i32) {\n ...\n}"
span:
line_start: 3
line_stop: 5
col_start: 1
col_stop: 2
path: ""
content: "function x(x: u32, public const y: i32) {\n ...\n}"
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public const x: u32, y: i32) {\\\"}\"}":
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public const x: u32, y: i32) {\\\"}\"}"
input:
- Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":25,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public const x: u32, y: i32) {\\\"}\"}"
const_: true
public: true
mutable: false
type_:
IntegerType: U32
span:
line_start: 7
line_stop: 7
col_start: 25
col_stop: 26
path: ""
content: "function x(public const x: u32, y: i32) {"
- Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public const x: u32, y: i32) {\\\"}\"}"
const_: false
public: false
mutable: true
type_:
IntegerType: I32
span:
line_start: 7
line_stop: 7
col_start: 33
col_stop: 34
path: ""
content: "function x(public const x: u32, y: i32) {"
const_: false
output: ~
core_mapping: ~
block:
statements:
- Return:
expression:
Value:
Implicit:
- "0"
- span:
line_start: 8
line_stop: 8
col_start: 12
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 8
line_stop: 8
col_start: 5
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 7
line_stop: 9
col_start: 41
col_stop: 2
path: ""
content: "function x(public const x: u32, y: i32) {\n ...\n}"
span:
line_start: 7
line_stop: 9
col_start: 1
col_stop: 2
path: ""
content: "function x(public const x: u32, y: i32) {\n ...\n}"

View File

@ -0,0 +1,145 @@
---
namespace: Parse
expectation: Pass
outputs:
- name: ""
expected_input: []
functions:
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public y: i32) {\\\"}\"}":
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public y: i32) {\\\"}\"}"
input:
- Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public y: i32) {\\\"}\"}"
const_: false
public: false
mutable: true
type_:
IntegerType: U32
span:
line_start: 3
line_stop: 3
col_start: 12
col_stop: 13
path: ""
content: "function x(x: u32, public y: i32) {"
- Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":27,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, public y: i32) {\\\"}\"}"
const_: false
public: true
mutable: true
type_:
IntegerType: I32
span:
line_start: 3
line_stop: 3
col_start: 27
col_stop: 28
path: ""
content: "function x(x: u32, public y: i32) {"
const_: false
output: ~
core_mapping: ~
block:
statements:
- Return:
expression:
Value:
Implicit:
- "0"
- span:
line_start: 4
line_stop: 4
col_start: 12
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 4
line_stop: 4
col_start: 5
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 3
line_stop: 5
col_start: 35
col_stop: 2
path: ""
content: "function x(x: u32, public y: i32) {\n ...\n}"
span:
line_start: 3
line_stop: 5
col_start: 1
col_stop: 2
path: ""
content: "function x(x: u32, public y: i32) {\n ...\n}"
"{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}":
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}"
input:
- Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}"
const_: false
public: true
mutable: true
type_:
IntegerType: U32
span:
line_start: 7
line_stop: 7
col_start: 19
col_stop: 20
path: ""
content: "function x(public x: u32, y: i32) {"
- Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":27,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(public x: u32, y: i32) {\\\"}\"}"
const_: false
public: false
mutable: true
type_:
IntegerType: I32
span:
line_start: 7
line_stop: 7
col_start: 27
col_stop: 28
path: ""
content: "function x(public x: u32, y: i32) {"
const_: false
output: ~
core_mapping: ~
block:
statements:
- Return:
expression:
Value:
Implicit:
- "0"
- span:
line_start: 8
line_stop: 8
col_start: 12
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 8
line_stop: 8
col_start: 5
col_stop: 13
path: ""
content: " return 0;"
span:
line_start: 7
line_stop: 9
col_start: 35
col_stop: 2
path: ""
content: "function x(public x: u32, y: i32) {\n ...\n}"
span:
line_start: 7
line_stop: 9
col_start: 1
col_stop: 2
path: ""
content: "function x(public x: u32, y: i32) {\n ...\n}"

View File

@ -0,0 +1,5 @@
---
namespace: Input
expectation: Fail
outputs:
- "Error [EPAR0370009]: unexpected string: expected 'ident', got 'public'\n --> test:4:7\n |\n 4 | const public a: bool = true; \n | ^^^^^^"

View File

@ -6,7 +6,6 @@ outputs:
- name: main - name: main
definitions: definitions:
- const_: true - const_: true
private: false
public: false public: false
type_: Boolean type_: Boolean
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const a: bool = true; \\\"}\"}" name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const a: bool = true; \\\"}\"}"
@ -29,7 +28,6 @@ outputs:
path: "" path: ""
content: "const a: bool = true; " content: "const a: bool = true; "
- const_: true - const_: true
private: false
public: false public: false
type_: type_:
IntegerType: U8 IntegerType: U8
@ -53,7 +51,6 @@ outputs:
path: "" path: ""
content: "const b: u8 = 2; " content: "const b: u8 = 2; "
- const_: true - const_: true
private: false
public: false public: false
type_: Field type_: Field
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const c: field = 0; \\\"}\"}" name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const c: field = 0; \\\"}\"}"
@ -76,7 +73,6 @@ outputs:
path: "" path: ""
content: "const c: field = 0; " content: "const c: field = 0; "
- const_: true - const_: true
private: false
public: false public: false
type_: Group type_: Group
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const d: group = (0, 1)group; \\\"}\"}" name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const d: group = (0, 1)group; \\\"}\"}"
@ -119,7 +115,6 @@ outputs:
path: "" path: ""
content: "const d: group = (0, 1)group; " content: "const d: group = (0, 1)group; "
- const_: true - const_: true
private: false
public: false public: false
type_: Address type_: Address
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
@ -151,7 +146,6 @@ outputs:
- name: registers - name: registers
definitions: definitions:
- const_: false - const_: false
private: false
public: false public: false
type_: Boolean type_: Boolean
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
@ -174,7 +168,6 @@ outputs:
path: "" path: ""
content: "r0: bool = true; " content: "r0: bool = true; "
- const_: false - const_: false
private: false
public: false public: false
type_: type_:
IntegerType: U8 IntegerType: U8
@ -198,7 +191,6 @@ outputs:
path: "" path: ""
content: "r1: u8 = 2; " content: "r1: u8 = 2; "
- const_: false - const_: false
private: false
public: false public: false
type_: Field type_: Field
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
@ -221,7 +213,6 @@ outputs:
path: "" path: ""
content: "r2: field = 0; " content: "r2: field = 0; "
- const_: false - const_: false
private: false
public: false public: false
type_: Group type_: Group
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
@ -264,7 +255,6 @@ outputs:
path: "" path: ""
content: "r3: group = (0, 1)group; " content: "r3: group = (0, 1)group; "
- const_: false - const_: false
private: false
public: false public: false
type_: Address type_: Address
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"

View File

@ -0,0 +1,285 @@
---
namespace: Input
expectation: Pass
outputs:
- sections:
- name: main
definitions:
- const_: true
public: true
type_: Boolean
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const a: bool = true; \\\"}\"}"
value:
Value:
Boolean:
- "true"
- span:
line_start: 4
line_stop: 4
col_start: 25
col_stop: 29
path: ""
content: "public const a: bool = true; "
span:
line_start: 4
line_stop: 4
col_start: 17
col_stop: 21
path: ""
content: "public const a: bool = true; "
- const_: true
public: true
type_:
IntegerType: U8
name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const b: u8 = 2; \\\"}\"}"
value:
Value:
Implicit:
- "2"
- span:
line_start: 5
line_stop: 5
col_start: 25
col_stop: 26
path: ""
content: "public const b: u8 = 2; "
span:
line_start: 5
line_stop: 5
col_start: 17
col_stop: 19
path: ""
content: "public const b: u8 = 2; "
- const_: true
public: true
type_: Field
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const c: field = 0; \\\"}\"}"
value:
Value:
Implicit:
- "0"
- span:
line_start: 6
line_stop: 6
col_start: 25
col_stop: 26
path: ""
content: "public const c: field = 0; "
span:
line_start: 6
line_stop: 6
col_start: 17
col_stop: 22
path: ""
content: "public const c: field = 0; "
- const_: true
public: true
type_: Group
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const d: group = (0, 1)group; \\\"}\"}"
value:
Value:
Group:
Tuple:
x:
Number:
- "0"
- span:
line_start: 7
line_stop: 7
col_start: 26
col_stop: 27
path: ""
content: "public const d: group = (0, 1)group; "
y:
Number:
- "1"
- span:
line_start: 7
line_stop: 7
col_start: 29
col_stop: 30
path: ""
content: "public const d: group = (0, 1)group; "
span:
line_start: 7
line_stop: 7
col_start: 26
col_stop: 36
path: ""
content: "public const d: group = (0, 1)group; "
span:
line_start: 7
line_stop: 7
col_start: 17
col_stop: 22
path: ""
content: "public const d: group = (0, 1)group; "
- const_: true
public: true
type_: Address
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value:
Value:
Address:
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- span:
line_start: 8
line_stop: 8
col_start: 27
col_stop: 90
path: ""
content: "public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 8
line_stop: 8
col_start: 17
col_stop: 24
path: ""
content: "public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 3
line_stop: 3
col_start: 2
col_stop: 6
path: ""
content: "[main]"
- name: registers
definitions:
- const_: false
public: false
type_: Boolean
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
value:
Value:
Boolean:
- "true"
- span:
line_start: 11
line_stop: 11
col_start: 13
col_stop: 17
path: ""
content: "r0: bool = true; "
span:
line_start: 11
line_stop: 11
col_start: 5
col_stop: 9
path: ""
content: "r0: bool = true; "
- const_: false
public: false
type_:
IntegerType: U8
name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}"
value:
Value:
Implicit:
- "2"
- span:
line_start: 12
line_stop: 12
col_start: 13
col_stop: 14
path: ""
content: "r1: u8 = 2; "
span:
line_start: 12
line_stop: 12
col_start: 5
col_stop: 7
path: ""
content: "r1: u8 = 2; "
- const_: false
public: false
type_: Field
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
value:
Value:
Implicit:
- "0"
- span:
line_start: 13
line_stop: 13
col_start: 13
col_stop: 14
path: ""
content: "r2: field = 0; "
span:
line_start: 13
line_stop: 13
col_start: 5
col_stop: 10
path: ""
content: "r2: field = 0; "
- const_: false
public: false
type_: Group
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
value:
Value:
Group:
Tuple:
x:
Number:
- "0"
- span:
line_start: 14
line_stop: 14
col_start: 14
col_stop: 15
path: ""
content: "r3: group = (0, 1)group; "
y:
Number:
- "1"
- span:
line_start: 14
line_stop: 14
col_start: 17
col_stop: 18
path: ""
content: "r3: group = (0, 1)group; "
span:
line_start: 14
line_stop: 14
col_start: 14
col_stop: 24
path: ""
content: "r3: group = (0, 1)group; "
span:
line_start: 14
line_stop: 14
col_start: 5
col_stop: 10
path: ""
content: "r3: group = (0, 1)group; "
- const_: false
public: false
type_: Address
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value:
Value:
Address:
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- span:
line_start: 15
line_stop: 15
col_start: 15
col_stop: 78
path: ""
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 15
line_stop: 15
col_start: 5
col_stop: 12
path: ""
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 10
line_stop: 10
col_start: 2
col_stop: 11
path: ""
content: "[registers]"

View File

@ -6,7 +6,6 @@ outputs:
- name: main - name: main
definitions: definitions:
- const_: false - const_: false
private: false
public: true public: true
type_: Boolean type_: Boolean
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public a: bool = true; \\\"}\"}" name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public a: bool = true; \\\"}\"}"
@ -29,7 +28,6 @@ outputs:
path: "" path: ""
content: "public a: bool = true; " content: "public a: bool = true; "
- const_: false - const_: false
private: false
public: true public: true
type_: type_:
IntegerType: U8 IntegerType: U8
@ -53,7 +51,6 @@ outputs:
path: "" path: ""
content: "public b: u8 = 2; " content: "public b: u8 = 2; "
- const_: false - const_: false
private: false
public: true public: true
type_: Field type_: Field
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public c: field = 0; \\\"}\"}" name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public c: field = 0; \\\"}\"}"
@ -76,7 +73,6 @@ outputs:
path: "" path: ""
content: "public c: field = 0; " content: "public c: field = 0; "
- const_: false - const_: false
private: false
public: true public: true
type_: Group type_: Group
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public d: group = (0, 1)group; \\\"}\"}" name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public d: group = (0, 1)group; \\\"}\"}"
@ -119,7 +115,6 @@ outputs:
path: "" path: ""
content: "public d: group = (0, 1)group; " content: "public d: group = (0, 1)group; "
- const_: false - const_: false
private: false
public: true public: true
type_: Address type_: Address
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
@ -151,7 +146,6 @@ outputs:
- name: registers - name: registers
definitions: definitions:
- const_: false - const_: false
private: false
public: false public: false
type_: Boolean type_: Boolean
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
@ -174,7 +168,6 @@ outputs:
path: "" path: ""
content: "r0: bool = true; " content: "r0: bool = true; "
- const_: false - const_: false
private: false
public: false public: false
type_: type_:
IntegerType: U8 IntegerType: U8
@ -198,7 +191,6 @@ outputs:
path: "" path: ""
content: "r1: u8 = 2; " content: "r1: u8 = 2; "
- const_: false - const_: false
private: false
public: false public: false
type_: Field type_: Field
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
@ -221,7 +213,6 @@ outputs:
path: "" path: ""
content: "r2: field = 0; " content: "r2: field = 0; "
- const_: false - const_: false
private: false
public: false public: false
type_: Group type_: Group
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
@ -264,7 +255,6 @@ outputs:
path: "" path: ""
content: "r3: group = (0, 1)group; " content: "r3: group = (0, 1)group; "
- const_: false - const_: false
private: false
public: false public: false
type_: Address type_: Address
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"

View File

@ -0,0 +1,12 @@
/*
namespace: Parse
expectation: Fail
*/
function x(x: u32, const public y: i32) {
return 0;
}
function x(const public x: u32, y: i32) {
return 0;
}

View File

@ -0,0 +1,12 @@
/*
namespace: Parse
expectation: Pass
*/
function x(x: u32, public const y: i32) {
return 0;
}
function x(public const x: u32, y: i32) {
return 0;
}

View File

@ -0,0 +1,12 @@
/*
namespace: Parse
expectation: Pass
*/
function x(x: u32, public y: i32) {
return 0;
}
function x(public x: u32, y: i32) {
return 0;
}

View File

@ -0,0 +1,19 @@
/*
namespace: Input
expectation: Fail
*/
[main]
const public a: bool = true;
const public b: u8 = 2;
const public c: field = 0;
const public d: group = (0, 1)group;
const public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
[registers]
r0: bool = true;
r1: u8 = 2;
r2: field = 0;
r3: group = (0, 1)group;
r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;

View File

@ -4,11 +4,11 @@ expectation: Pass
*/ */
[main] [main]
private a: bool = true; public const a: bool = true;
private b: u8 = 2; public const b: u8 = 2;
private c: field = 0; public const c: field = 0;
private d: group = (0, 1)group; public const d: group = (0, 1)group;
private e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; public const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
[registers] [registers]
r0: bool = true; r0: bool = true;