From b7422d67e6493a5143b0fa7b41e81a14e90467d8 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Thu, 3 Aug 2023 00:51:53 -0400 Subject: [PATCH] Regen expectations --- .../compiler/signature/signature.out | 12 + .../signature_with_wrong_types_fail.out | 5 + .../parser/expression/cast_fail.out | 4 +- .../parser/statement/definition_fail.out | 14 +- tests/expectations/parser/type_/signature.out | 233 ++++++++++++++++++ .../signature_verify_bad_syntax_fail.out | 5 + 6 files changed, 264 insertions(+), 9 deletions(-) create mode 100644 tests/expectations/compiler/signature/signature.out create mode 100644 tests/expectations/compiler/signature/signature_with_wrong_types_fail.out create mode 100644 tests/expectations/parser/type_/signature.out create mode 100644 tests/expectations/parser/type_/signature_verify_bad_syntax_fail.out diff --git a/tests/expectations/compiler/signature/signature.out b/tests/expectations/compiler/signature/signature.out new file mode 100644 index 0000000000..5d444e31ae --- /dev/null +++ b/tests/expectations/compiler/signature/signature.out @@ -0,0 +1,12 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - - initial_ast: eac40643953d449007d2cdf25f5fbbaab2d795606069feea951a9ac640b5ea20 + unrolled_ast: eac40643953d449007d2cdf25f5fbbaab2d795606069feea951a9ac640b5ea20 + ssa_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 + flattened_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 + inlined_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 + dce_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 + bytecode: 87b34bffefde3c2b9e23ce08528737a4ef06a28ee9120c02d26ee41989f24cd2 + warnings: "" diff --git a/tests/expectations/compiler/signature/signature_with_wrong_types_fail.out b/tests/expectations/compiler/signature/signature_with_wrong_types_fail.out new file mode 100644 index 0000000000..cb241422f1 --- /dev/null +++ b/tests/expectations/compiler/signature/signature_with_wrong_types_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372007]: Expected one type from `signature`, but got `address`\n --> compiler-test:11:45\n |\n 11 | let first: bool = signature::verify(a, s, v);\n | ^\nError [ETYC0372007]: Expected one type from `address`, but got `signature`\n --> compiler-test:11:48\n |\n 11 | let first: bool = signature::verify(a, s, v);\n | ^\nError [ETYC0372007]: Expected one type from `address`, but got `u8`\n --> compiler-test:12:37\n |\n 12 | let second: bool = s.verify(1u8, v);\n | ^^^\nError [ETYC0372007]: Expected one type from `signature`, but got `address`\n --> compiler-test:17:45\n |\n 17 | let first: bool = signature::verify(a, v, s);\n | ^\nError [ETYC0372007]: Expected one type from `address`, but got `foo`\n --> compiler-test:17:48\n |\n 17 | let first: bool = signature::verify(a, v, s);\n | ^\nError [ETYC0372007]: Expected one type from `address`, but got `foo`\n --> compiler-test:18:37\n |\n 18 | let second: bool = s.verify(v, a);\n | ^\n" diff --git a/tests/expectations/parser/expression/cast_fail.out b/tests/expectations/parser/expression/cast_fail.out index c81c5f8f6b..dfa299f8f0 100644 --- a/tests/expectations/parser/expression/cast_fail.out +++ b/tests/expectations/parser/expression/cast_fail.out @@ -3,7 +3,7 @@ namespace: ParseExpression expectation: Fail outputs: - "did not consume all input: 'aas' @ 1:5-8\n'u8' @ 1:9-11\n" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '{'\n --> test:1:10\n |\n 1 | 1u128 as { foo: u8 }\n | ^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '{'\n --> test:1:10\n |\n 1 | 1u128 as { foo: u8 }\n | ^" - "did not consume all input: ';' @ 1:14-15\n" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found 'bar'\n --> test:1:8\n |\n 1 | 1u8 as bar;\n | ^^^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found 'bar'\n --> test:1:8\n |\n 1 | 1u8 as bar;\n | ^^^" - "did not consume all input: 'asu8' @ 1:5-9\n" diff --git a/tests/expectations/parser/statement/definition_fail.out b/tests/expectations/parser/statement/definition_fail.out index 355c35f790..02baab6b1c 100644 --- a/tests/expectations/parser/statement/definition_fail.out +++ b/tests/expectations/parser/statement/definition_fail.out @@ -25,22 +25,22 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', found ','\n --> test:1:10\n |\n 1 | let (x,y,,) = ();\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found ','\n --> test:1:6\n |\n 1 | let (,x,y) = ();\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found ','\n --> test:1:8\n |\n 1 | let (x,,y) = ();\n | ^" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found 'constant'\n --> test:1:8\n |\n 1 | let x: constant = expr;\n | ^^^^^^^^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found 'constant'\n --> test:1:8\n |\n 1 | let x: constant = expr;\n | ^^^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found 'constant'\n --> test:1:1\n |\n 1 | constant x: let = expr;\n | ^^^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found ''\n --> test:1:1\n |\n 1 | let\n | ^^^" - "Error [EPAR0370005]: expected : -- found ''\n --> test:1:5\n |\n 1 | let x\n | ^" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found ''\n --> test:1:6\n |\n 1 | let x:\n | ^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found ''\n --> test:1:6\n |\n 1 | let x:\n | ^" - "Error [EPAR0370005]: expected : -- found '='\n --> test:1:7\n |\n 1 | let x = (a, y]);\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found '='\n --> test:1:5\n |\n 1 | let = 1u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found ';'\n --> test:1:4\n |\n 1 | let;\n | ^" - "Error [EPAR0370005]: expected : -- found '1'\n --> test:1:7\n |\n 1 | let x 1u8;\n | ^" - "Error [EPAR0370005]: expected = -- found ';'\n --> test:1:10\n |\n 1 | let x: u8;\n | ^" - "Error [EPAR0370005]: expected = -- found ''\n --> test:1:8\n |\n 1 | let x: u8\n | ^^" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '='\n --> test:1:8\n |\n 1 | let x: = 1;\n | ^" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8] = 1;\n | ^" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8;\n | ^" - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8; 1u8] = [1,\n | ^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '='\n --> test:1:8\n |\n 1 | let x: = 1;\n | ^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8] = 1;\n | ^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8;\n | ^" + - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '['\n --> test:1:8\n |\n 1 | let x: [u8; 1u8] = [1,\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found ']'\n --> test:1:15\n |\n 1 | let dbg: u8 = ];\n | ^" - "Error [EPAR0370016]: Could not lex the following content: `🦀:`.\n" - "Error [EPAR0370005]: expected : -- found '='\n --> test:1:9\n |\n 1 | let (x) = ...;\n | ^" diff --git a/tests/expectations/parser/type_/signature.out b/tests/expectations/parser/type_/signature.out new file mode 100644 index 0000000000..a575ed56aa --- /dev/null +++ b/tests/expectations/parser/type_/signature.out @@ -0,0 +1,233 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - imports: {} + program_scopes: + "{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}": + program_id: "{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}" + structs: {} + mappings: {} + functions: + baz: + annotations: [] + variant: Transition + identifier: "{\"name\":\"baz\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":40}\"}" + input: + - Internal: + identifier: "{\"name\":\"s\",\"span\":\"{\\\"lo\\\":41,\\\"hi\\\":42}\"}" + mode: None + type_: Signature + span: + lo: 41 + hi: 42 + - Internal: + identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":55,\\\"hi\\\":56}\"}" + mode: None + type_: Address + span: + lo: 55 + hi: 56 + - Internal: + identifier: "{\"name\":\"v\",\"span\":\"{\\\"lo\\\":67,\\\"hi\\\":68}\"}" + mode: None + type_: + Identifier: "{\"name\":\"value\",\"span\":\"{\\\"lo\\\":70,\\\"hi\\\":75}\"}" + span: + lo: 67 + hi: 68 + output: [] + output_type: Unit + block: + statements: + - Definition: + declaration_type: Let + place: + Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":91,\\\"hi\\\":92}\"}" + type_: Boolean + value: + Access: + AssociatedFunction: + ty: + Identifier: "{\"name\":\"signature\",\"span\":\"{\\\"lo\\\":101,\\\"hi\\\":110}\"}" + name: "{\"name\":\"verify\",\"span\":\"{\\\"lo\\\":112,\\\"hi\\\":118}\"}" + arguments: + - Identifier: "{\"name\":\"s\",\"span\":\"{\\\"lo\\\":119,\\\"hi\\\":120}\"}" + - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":122,\\\"hi\\\":123}\"}" + - Identifier: "{\"name\":\"v\",\"span\":\"{\\\"lo\\\":125,\\\"hi\\\":126}\"}" + span: + lo: 101 + hi: 127 + span: + lo: 87 + hi: 127 + - Definition: + declaration_type: Let + place: + Identifier: "{\"name\":\"b\",\"span\":\"{\\\"lo\\\":141,\\\"hi\\\":142}\"}" + type_: Boolean + value: + Access: + AssociatedFunction: + ty: + Identifier: "{\"name\":\"signature\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":0}\"}" + name: "{\"name\":\"verify\",\"span\":\"{\\\"lo\\\":153,\\\"hi\\\":159}\"}" + arguments: + - Identifier: "{\"name\":\"s\",\"span\":\"{\\\"lo\\\":151,\\\"hi\\\":152}\"}" + - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":160,\\\"hi\\\":161}\"}" + - Identifier: "{\"name\":\"v\",\"span\":\"{\\\"lo\\\":163,\\\"hi\\\":164}\"}" + span: + lo: 151 + hi: 165 + span: + lo: 137 + hi: 165 + - Assert: + variant: + AssertEq: + - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":185,\\\"hi\\\":186}\"}" + - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"lo\\\":188,\\\"hi\\\":189}\"}" + span: + lo: 175 + hi: 184 + span: + lo: 77 + hi: 197 + finalize: ~ + span: + lo: 26 + hi: 197 + bar: + annotations: [] + variant: Transition + identifier: "{\"name\":\"bar\",\"span\":\"{\\\"lo\\\":214,\\\"hi\\\":217}\"}" + input: + - Internal: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":218,\\\"hi\\\":219}\"}" + mode: None + type_: + Integer: U8 + span: + lo: 218 + hi: 219 + output: + - Internal: + mode: None + type_: + Integer: U8 + span: + lo: 228 + hi: 230 + output_type: + Integer: U8 + block: + statements: + - Definition: + declaration_type: Let + place: + Identifier: "{\"name\":\"signature\",\"span\":\"{\\\"lo\\\":245,\\\"hi\\\":254}\"}" + type_: + Integer: U8 + value: + Binary: + left: + Literal: + Integer: + - U8 + - "1" + - span: + lo: 261 + hi: 264 + right: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":267,\\\"hi\\\":268}\"}" + op: Add + span: + lo: 261 + hi: 268 + span: + lo: 241 + hi: 268 + - Return: + expression: + Identifier: "{\"name\":\"signature\",\"span\":\"{\\\"lo\\\":285,\\\"hi\\\":294}\"}" + finalize_arguments: ~ + span: + lo: 278 + hi: 295 + span: + lo: 231 + hi: 301 + finalize: ~ + span: + lo: 203 + hi: 301 + bax: + annotations: [] + variant: Transition + identifier: "{\"name\":\"bax\",\"span\":\"{\\\"lo\\\":317,\\\"hi\\\":320}\"}" + input: + - Internal: + identifier: "{\"name\":\"s\",\"span\":\"{\\\"lo\\\":321,\\\"hi\\\":322}\"}" + mode: None + type_: Signature + span: + lo: 321 + hi: 322 + - Internal: + identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":335,\\\"hi\\\":336}\"}" + mode: None + type_: Address + span: + lo: 335 + hi: 336 + - Internal: + identifier: "{\"name\":\"v\",\"span\":\"{\\\"lo\\\":347,\\\"hi\\\":348}\"}" + mode: None + type_: + Identifier: "{\"name\":\"value\",\"span\":\"{\\\"lo\\\":350,\\\"hi\\\":355}\"}" + span: + lo: 347 + hi: 348 + output: [] + output_type: Unit + block: + statements: + - Definition: + declaration_type: Let + place: + Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":370,\\\"hi\\\":371}\"}" + type_: Boolean + value: + Access: + AssociatedFunction: + ty: + Identifier: "{\"name\":\"signature\",\"span\":\"{\\\"lo\\\":380,\\\"hi\\\":389}\"}" + name: "{\"name\":\"sign\",\"span\":\"{\\\"lo\\\":391,\\\"hi\\\":395}\"}" + arguments: + - Identifier: "{\"name\":\"s\",\"span\":\"{\\\"lo\\\":396,\\\"hi\\\":397}\"}" + - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":399,\\\"hi\\\":400}\"}" + - Identifier: "{\"name\":\"v\",\"span\":\"{\\\"lo\\\":402,\\\"hi\\\":403}\"}" + span: + lo: 380 + hi: 404 + span: + lo: 366 + hi: 404 + - Assert: + variant: + AssertEq: + - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":423,\\\"hi\\\":424}\"}" + - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"lo\\\":426,\\\"hi\\\":427}\"}" + span: + lo: 413 + hi: 422 + span: + lo: 357 + hi: 434 + finalize: ~ + span: + lo: 306 + hi: 434 + span: + lo: 2 + hi: 436 diff --git a/tests/expectations/parser/type_/signature_verify_bad_syntax_fail.out b/tests/expectations/parser/type_/signature_verify_bad_syntax_fail.out new file mode 100644 index 0000000000..0f9fdc8d0b --- /dev/null +++ b/tests/expectations/parser/type_/signature_verify_bad_syntax_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370021]: The type of `signature` has no associated function `verify` that takes 3 argument(s).\n --> test:5:23\n |\n 5 | let a: bool = signature.verify(s, a, v);\n | ^^^^^^^^^^^^^^^^^^^^^^^^^\nError [EPAR0370005]: expected ) -- found ','\n --> test:6:17\n |\n 6 | assert(a, b);\n | ^"