From 964c9617f9114baebc84029c4d38cb5c7015cae3 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Wed, 30 Aug 2023 14:23:46 -0400 Subject: [PATCH] Fix and regen expectations --- compiler/parser/src/parser/expression.rs | 3 +- .../compiler/signature/signature.out | 12 +- tests/expectations/parser/type_/signature.out | 104 +++++++++++------- 3 files changed, 73 insertions(+), 46 deletions(-) diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index c260d1fb3c..d452892a60 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -347,7 +347,7 @@ impl ParserContext<'_> { (args.len(), CoreFunction::from_symbols(sym::signature, method.name)) { Ok(Expression::Access(AccessExpression::AssociatedFunction(AssociatedFunction { - ty: Type::Identifier(Identifier::new(sym::signature)), + ty: Type::Identifier(Identifier::new(sym::signature, self.node_builder.next_id())), name: method, arguments: { let mut arguments = vec![receiver]; @@ -355,6 +355,7 @@ impl ParserContext<'_> { arguments }, span, + id: self.node_builder.next_id(), }))) } else { // Attempt to parse the method call as a mapping operation. diff --git a/tests/expectations/compiler/signature/signature.out b/tests/expectations/compiler/signature/signature.out index 5d444e31ae..33576512f1 100644 --- a/tests/expectations/compiler/signature/signature.out +++ b/tests/expectations/compiler/signature/signature.out @@ -2,11 +2,11 @@ namespace: Compile expectation: Pass outputs: - - - initial_ast: eac40643953d449007d2cdf25f5fbbaab2d795606069feea951a9ac640b5ea20 - unrolled_ast: eac40643953d449007d2cdf25f5fbbaab2d795606069feea951a9ac640b5ea20 - ssa_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 - flattened_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 - inlined_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 - dce_ast: 2f764529d50f04616be0da13eefd1be0fb7de523efa7bdf5813841e9e55e2e28 + - - initial_ast: 66326647c8591d4479e5622bc50d2fffb7fcc9791925a7ab7018617a59b693a4 + unrolled_ast: 66326647c8591d4479e5622bc50d2fffb7fcc9791925a7ab7018617a59b693a4 + ssa_ast: 76f4f34b1e014012ba3ecc136b58787ed41de71f5ff83565f825258b9e8ea76f + flattened_ast: b0658ac6a7f5033380851c648f130884de04fde4bef415fa015e4d664aabb427 + inlined_ast: b0658ac6a7f5033380851c648f130884de04fde4bef415fa015e4d664aabb427 + dce_ast: b0658ac6a7f5033380851c648f130884de04fde4bef415fa015e4d664aabb427 bytecode: 87b34bffefde3c2b9e23ce08528737a4ef06a28ee9120c02d26ee41989f24cd2 warnings: "" diff --git a/tests/expectations/parser/type_/signature.out b/tests/expectations/parser/type_/signature.out index a575ed56aa..0b979cf158 100644 --- a/tests/expectations/parser/type_/signature.out +++ b/tests/expectations/parser/type_/signature.out @@ -4,38 +4,41 @@ 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}\\\\\\\"}\\\"\"}" + "{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}": + program_id: "{\"name\":\"test\",\"network\":\"\\\"{\\\\\\\"id\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"aleo\\\\\\\",\\\\\\\"span\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"lo\\\\\\\\\\\\\\\":15,\\\\\\\\\\\\\\\"hi\\\\\\\\\\\\\\\":19}\\\\\\\"}\\\"\"}" structs: {} mappings: {} functions: baz: annotations: [] variant: Transition - identifier: "{\"name\":\"baz\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":40}\"}" + identifier: "{\"id\":\"2\",\"name\":\"baz\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":40}\"}" input: - Internal: - identifier: "{\"name\":\"s\",\"span\":\"{\\\"lo\\\":41,\\\"hi\\\":42}\"}" + identifier: "{\"id\":\"3\",\"name\":\"s\",\"span\":\"{\\\"lo\\\":41,\\\"hi\\\":42}\"}" mode: None type_: Signature span: lo: 41 hi: 42 + id: 4 - Internal: - identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":55,\\\"hi\\\":56}\"}" + identifier: "{\"id\":\"5\",\"name\":\"a\",\"span\":\"{\\\"lo\\\":55,\\\"hi\\\":56}\"}" mode: None type_: Address span: lo: 55 hi: 56 + id: 6 - Internal: - identifier: "{\"name\":\"v\",\"span\":\"{\\\"lo\\\":67,\\\"hi\\\":68}\"}" + identifier: "{\"id\":\"7\",\"name\":\"v\",\"span\":\"{\\\"lo\\\":67,\\\"hi\\\":68}\"}" mode: None type_: - Identifier: "{\"name\":\"value\",\"span\":\"{\\\"lo\\\":70,\\\"hi\\\":75}\"}" + Identifier: "{\"id\":\"8\",\"name\":\"value\",\"span\":\"{\\\"lo\\\":70,\\\"hi\\\":75}\"}" span: lo: 67 hi: 68 + id: 9 output: [] output_type: Unit block: @@ -43,73 +46,81 @@ outputs: - Definition: declaration_type: Let place: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":91,\\\"hi\\\":92}\"}" + Identifier: "{\"id\":\"10\",\"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}\"}" + Identifier: "{\"id\":\"11\",\"name\":\"signature\",\"span\":\"{\\\"lo\\\":101,\\\"hi\\\":110}\"}" + name: "{\"id\":\"12\",\"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}\"}" + - Identifier: "{\"id\":\"13\",\"name\":\"s\",\"span\":\"{\\\"lo\\\":119,\\\"hi\\\":120}\"}" + - Identifier: "{\"id\":\"14\",\"name\":\"a\",\"span\":\"{\\\"lo\\\":122,\\\"hi\\\":123}\"}" + - Identifier: "{\"id\":\"15\",\"name\":\"v\",\"span\":\"{\\\"lo\\\":125,\\\"hi\\\":126}\"}" span: lo: 101 hi: 127 + id: 16 span: lo: 87 hi: 127 + id: 17 - Definition: declaration_type: Let place: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"lo\\\":141,\\\"hi\\\":142}\"}" + Identifier: "{\"id\":\"18\",\"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}\"}" + Identifier: "{\"id\":\"23\",\"name\":\"signature\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":0}\"}" + name: "{\"id\":\"20\",\"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}\"}" + - Identifier: "{\"id\":\"19\",\"name\":\"s\",\"span\":\"{\\\"lo\\\":151,\\\"hi\\\":152}\"}" + - Identifier: "{\"id\":\"21\",\"name\":\"a\",\"span\":\"{\\\"lo\\\":160,\\\"hi\\\":161}\"}" + - Identifier: "{\"id\":\"22\",\"name\":\"v\",\"span\":\"{\\\"lo\\\":163,\\\"hi\\\":164}\"}" span: lo: 151 hi: 165 + id: 24 span: lo: 137 hi: 165 + id: 25 - Assert: variant: AssertEq: - - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":185,\\\"hi\\\":186}\"}" - - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"lo\\\":188,\\\"hi\\\":189}\"}" + - Identifier: "{\"id\":\"26\",\"name\":\"a\",\"span\":\"{\\\"lo\\\":185,\\\"hi\\\":186}\"}" + - Identifier: "{\"id\":\"27\",\"name\":\"b\",\"span\":\"{\\\"lo\\\":188,\\\"hi\\\":189}\"}" span: lo: 175 hi: 184 + id: 28 span: lo: 77 hi: 197 + id: 29 finalize: ~ span: lo: 26 hi: 197 + id: 30 bar: annotations: [] variant: Transition - identifier: "{\"name\":\"bar\",\"span\":\"{\\\"lo\\\":214,\\\"hi\\\":217}\"}" + identifier: "{\"id\":\"31\",\"name\":\"bar\",\"span\":\"{\\\"lo\\\":214,\\\"hi\\\":217}\"}" input: - Internal: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":218,\\\"hi\\\":219}\"}" + identifier: "{\"id\":\"32\",\"name\":\"x\",\"span\":\"{\\\"lo\\\":218,\\\"hi\\\":219}\"}" mode: None type_: Integer: U8 span: lo: 218 hi: 219 + id: 33 output: - Internal: mode: None @@ -118,6 +129,7 @@ outputs: span: lo: 228 hi: 230 + id: 34 output_type: Integer: U8 block: @@ -125,7 +137,7 @@ outputs: - Definition: declaration_type: Let place: - Identifier: "{\"name\":\"signature\",\"span\":\"{\\\"lo\\\":245,\\\"hi\\\":254}\"}" + Identifier: "{\"id\":\"35\",\"name\":\"signature\",\"span\":\"{\\\"lo\\\":245,\\\"hi\\\":254}\"}" type_: Integer: U8 value: @@ -138,56 +150,65 @@ outputs: - span: lo: 261 hi: 264 + - 36 right: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":267,\\\"hi\\\":268}\"}" + Identifier: "{\"id\":\"37\",\"name\":\"x\",\"span\":\"{\\\"lo\\\":267,\\\"hi\\\":268}\"}" op: Add span: lo: 261 hi: 268 + id: 38 span: lo: 241 hi: 268 + id: 39 - Return: expression: - Identifier: "{\"name\":\"signature\",\"span\":\"{\\\"lo\\\":285,\\\"hi\\\":294}\"}" + Identifier: "{\"id\":\"40\",\"name\":\"signature\",\"span\":\"{\\\"lo\\\":285,\\\"hi\\\":294}\"}" finalize_arguments: ~ span: lo: 278 hi: 295 + id: 41 span: lo: 231 hi: 301 + id: 42 finalize: ~ span: lo: 203 hi: 301 + id: 43 bax: annotations: [] variant: Transition - identifier: "{\"name\":\"bax\",\"span\":\"{\\\"lo\\\":317,\\\"hi\\\":320}\"}" + identifier: "{\"id\":\"44\",\"name\":\"bax\",\"span\":\"{\\\"lo\\\":317,\\\"hi\\\":320}\"}" input: - Internal: - identifier: "{\"name\":\"s\",\"span\":\"{\\\"lo\\\":321,\\\"hi\\\":322}\"}" + identifier: "{\"id\":\"45\",\"name\":\"s\",\"span\":\"{\\\"lo\\\":321,\\\"hi\\\":322}\"}" mode: None type_: Signature span: lo: 321 hi: 322 + id: 46 - Internal: - identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":335,\\\"hi\\\":336}\"}" + identifier: "{\"id\":\"47\",\"name\":\"a\",\"span\":\"{\\\"lo\\\":335,\\\"hi\\\":336}\"}" mode: None type_: Address span: lo: 335 hi: 336 + id: 48 - Internal: - identifier: "{\"name\":\"v\",\"span\":\"{\\\"lo\\\":347,\\\"hi\\\":348}\"}" + identifier: "{\"id\":\"49\",\"name\":\"v\",\"span\":\"{\\\"lo\\\":347,\\\"hi\\\":348}\"}" mode: None type_: - Identifier: "{\"name\":\"value\",\"span\":\"{\\\"lo\\\":350,\\\"hi\\\":355}\"}" + Identifier: "{\"id\":\"50\",\"name\":\"value\",\"span\":\"{\\\"lo\\\":350,\\\"hi\\\":355}\"}" span: lo: 347 hi: 348 + id: 51 output: [] output_type: Unit block: @@ -195,39 +216,44 @@ outputs: - Definition: declaration_type: Let place: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":370,\\\"hi\\\":371}\"}" + Identifier: "{\"id\":\"52\",\"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}\"}" + Identifier: "{\"id\":\"53\",\"name\":\"signature\",\"span\":\"{\\\"lo\\\":380,\\\"hi\\\":389}\"}" + name: "{\"id\":\"54\",\"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}\"}" + - Identifier: "{\"id\":\"55\",\"name\":\"s\",\"span\":\"{\\\"lo\\\":396,\\\"hi\\\":397}\"}" + - Identifier: "{\"id\":\"56\",\"name\":\"a\",\"span\":\"{\\\"lo\\\":399,\\\"hi\\\":400}\"}" + - Identifier: "{\"id\":\"57\",\"name\":\"v\",\"span\":\"{\\\"lo\\\":402,\\\"hi\\\":403}\"}" span: lo: 380 hi: 404 + id: 58 span: lo: 366 hi: 404 + id: 59 - Assert: variant: AssertEq: - - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"lo\\\":423,\\\"hi\\\":424}\"}" - - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"lo\\\":426,\\\"hi\\\":427}\"}" + - Identifier: "{\"id\":\"60\",\"name\":\"a\",\"span\":\"{\\\"lo\\\":423,\\\"hi\\\":424}\"}" + - Identifier: "{\"id\":\"61\",\"name\":\"b\",\"span\":\"{\\\"lo\\\":426,\\\"hi\\\":427}\"}" span: lo: 413 hi: 422 + id: 62 span: lo: 357 hi: 434 + id: 63 finalize: ~ span: lo: 306 hi: 434 + id: 64 span: lo: 2 hi: 436