diff --git a/Cargo.lock b/Cargo.lock index 1b22247a39..b1e0915a83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -368,9 +368,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.74" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" +checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" dependencies = [ "jobserver", ] @@ -1107,12 +1107,13 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfddc9561e8baf264e0e45e197fd7696320026eb10a8180340debc27b18f535b" +checksum = "4295cbb7573c16d310e99e713cf9e75101eb190ab31fccd35f2d2691b4352b19" dependencies = [ "console", "number_prefix", + "portable-atomic", "unicode-width", ] @@ -1172,7 +1173,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leo-abnf" -version = "1.5.3" +version = "1.6.0" dependencies = [ "abnf", "anyhow", @@ -1180,10 +1181,11 @@ dependencies = [ [[package]] name = "leo-ast" -version = "1.5.3" +version = "1.6.0" dependencies = [ "criterion", "indexmap", + "itertools", "leo-errors", "leo-span", "serde", @@ -1193,7 +1195,7 @@ dependencies = [ [[package]] name = "leo-compiler" -version = "1.5.3" +version = "1.6.0" dependencies = [ "leo-ast", "leo-errors", @@ -1210,7 +1212,7 @@ dependencies = [ [[package]] name = "leo-core" -version = "1.5.3" +version = "1.6.0" dependencies = [ "leo-ast", "leo-errors", @@ -1219,7 +1221,7 @@ dependencies = [ [[package]] name = "leo-errors" -version = "1.5.3" +version = "1.6.0" dependencies = [ "anyhow", "backtrace", @@ -1233,7 +1235,7 @@ dependencies = [ [[package]] name = "leo-lang" -version = "1.5.3" +version = "1.6.0" dependencies = [ "aleo", "ansi_term", @@ -1271,7 +1273,7 @@ dependencies = [ [[package]] name = "leo-package" -version = "1.5.3" +version = "1.6.0" dependencies = [ "indexmap", "lazy_static", @@ -1283,7 +1285,7 @@ dependencies = [ [[package]] name = "leo-parser" -version = "1.5.3" +version = "1.6.0" dependencies = [ "clap", "indexmap", @@ -1302,7 +1304,7 @@ dependencies = [ [[package]] name = "leo-passes" -version = "1.5.3" +version = "1.6.0" dependencies = [ "indexmap", "itertools", @@ -1316,7 +1318,7 @@ dependencies = [ [[package]] name = "leo-span" -version = "1.5.3" +version = "1.6.0" dependencies = [ "fxhash", "indexmap", @@ -1326,7 +1328,7 @@ dependencies = [ [[package]] name = "leo-test-framework" -version = "1.5.3" +version = "1.6.0" dependencies = [ "backtrace", "clap", @@ -1769,6 +1771,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "portable-atomic" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15eb2c6e362923af47e13c23ca5afb859e83d54452c55b0b9ac763b8f7c1ac16" + [[package]] name = "ppv-lite86" version = "0.2.17" diff --git a/compiler/ast/Cargo.toml b/compiler/ast/Cargo.toml index d539bffc1e..4043c74f2d 100644 --- a/compiler/ast/Cargo.toml +++ b/compiler/ast/Cargo.toml @@ -30,6 +30,9 @@ version = "1.6.0" version = "1.9" features = [ "serde-1" ] +[dependencies.itertools] +version = "0.10.5" + [dependencies.serde] version = "1.0" features = [ "derive", "rc" ] diff --git a/compiler/ast/src/expressions/mod.rs b/compiler/ast/src/expressions/mod.rs index 5a665a9d3b..0fb9400fa7 100644 --- a/compiler/ast/src/expressions/mod.rs +++ b/compiler/ast/src/expressions/mod.rs @@ -38,12 +38,15 @@ pub use err::*; mod ternary; pub use ternary::*; -mod tuple_init; -pub use tuple_init::*; +mod tuple; +pub use tuple::*; mod unary; pub use unary::*; +mod unit; +pub use unit::*; + mod literal; pub use literal::*; @@ -71,6 +74,8 @@ pub enum Expression { Tuple(TupleExpression), /// An unary expression. Unary(UnaryExpression), + /// A unit expression e.g. `()` + Unit(UnitExpression), } impl Node for Expression { @@ -87,6 +92,7 @@ impl Node for Expression { Ternary(n) => n.span(), Tuple(n) => n.span(), Unary(n) => n.span(), + Unit(n) => n.span(), } } @@ -103,6 +109,7 @@ impl Node for Expression { Ternary(n) => n.set_span(span), Tuple(n) => n.set_span(span), Unary(n) => n.set_span(span), + Unit(n) => n.set_span(span), } } } @@ -121,6 +128,7 @@ impl fmt::Display for Expression { Ternary(n) => n.fmt(f), Tuple(n) => n.fmt(f), Unary(n) => n.fmt(f), + Unit(n) => n.fmt(f), } } } diff --git a/compiler/ast/src/expressions/tuple_init.rs b/compiler/ast/src/expressions/tuple.rs similarity index 91% rename from compiler/ast/src/expressions/tuple_init.rs rename to compiler/ast/src/expressions/tuple.rs index 7be5a38a97..ccda5e4101 100644 --- a/compiler/ast/src/expressions/tuple_init.rs +++ b/compiler/ast/src/expressions/tuple.rs @@ -16,7 +16,9 @@ use super::*; -/// A tuple construction expression, e.g., `(foo, false, 42)`. +// TODO: Consider a restricted interface for constructing a tuple expression. + +/// A tuple expression, e.g., `(foo, false, 42)`. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct TupleExpression { /// The elements of the tuple. diff --git a/compiler/ast/src/expressions/unit.rs b/compiler/ast/src/expressions/unit.rs new file mode 100644 index 0000000000..238c72b623 --- /dev/null +++ b/compiler/ast/src/expressions/unit.rs @@ -0,0 +1,32 @@ +// Copyright (C) 2019-2022 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use super::*; + +/// Represents a unit expression. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct UnitExpression { + /// The span of the unit expression. + pub span: Span, +} + +impl fmt::Display for UnitExpression { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("()") + } +} + +crate::simple_node_impl!(UnitExpression); diff --git a/compiler/ast/src/passes/consumer.rs b/compiler/ast/src/passes/consumer.rs index df380d3a81..ae5d5230b2 100644 --- a/compiler/ast/src/passes/consumer.rs +++ b/compiler/ast/src/passes/consumer.rs @@ -35,6 +35,7 @@ pub trait ExpressionConsumer { Expression::Ternary(ternary) => self.consume_ternary(ternary), Expression::Tuple(tuple) => self.consume_tuple(tuple), Expression::Unary(unary) => self.consume_unary(unary), + Expression::Unit(unit) => self.consume_unit(unit), } } @@ -59,6 +60,8 @@ pub trait ExpressionConsumer { fn consume_tuple(&mut self, _input: TupleExpression) -> Self::Output; fn consume_unary(&mut self, _input: UnaryExpression) -> Self::Output; + + fn consume_unit(&mut self, _input: UnitExpression) -> Self::Output; } /// A Consumer trait for statements in the AST. @@ -73,6 +76,7 @@ pub trait StatementConsumer { Statement::Console(stmt) => self.consume_console(stmt), Statement::Decrement(stmt) => self.consume_decrement(stmt), Statement::Definition(stmt) => self.consume_definition(stmt), + Statement::Expression(stmt) => self.consume_expression_statement(stmt), Statement::Finalize(stmt) => self.consume_finalize(stmt), Statement::Increment(stmt) => self.consume_increment(stmt), Statement::Iteration(stmt) => self.consume_iteration(*stmt), @@ -92,6 +96,8 @@ pub trait StatementConsumer { fn consume_definition(&mut self, input: DefinitionStatement) -> Self::Output; + fn consume_expression_statement(&mut self, input: ExpressionStatement) -> Self::Output; + fn consume_finalize(&mut self, input: FinalizeStatement) -> Self::Output; fn consume_increment(&mut self, input: IncrementStatement) -> Self::Output; diff --git a/compiler/ast/src/passes/reconstructor.rs b/compiler/ast/src/passes/reconstructor.rs index 60515c5786..123c0510ae 100644 --- a/compiler/ast/src/passes/reconstructor.rs +++ b/compiler/ast/src/passes/reconstructor.rs @@ -36,6 +36,7 @@ pub trait ExpressionReconstructor { Expression::Ternary(ternary) => self.reconstruct_ternary(ternary), Expression::Tuple(tuple) => self.reconstruct_tuple(tuple), Expression::Unary(unary) => self.reconstruct_unary(unary), + Expression::Unit(unit) => self.reconstruct_unit(unit), } } @@ -150,6 +151,10 @@ pub trait ExpressionReconstructor { Default::default(), ) } + + fn reconstruct_unit(&mut self, input: UnitExpression) -> (Expression, Self::AdditionalOutput) { + (Expression::Unit(input), Default::default()) + } } /// A Reconstructor trait for statements in the AST. @@ -165,6 +170,7 @@ pub trait StatementReconstructor: ExpressionReconstructor { Statement::Console(stmt) => self.reconstruct_console(stmt), Statement::Decrement(stmt) => self.reconstruct_decrement(stmt), Statement::Definition(stmt) => self.reconstruct_definition(stmt), + Statement::Expression(stmt) => self.reconstruct_expression_statement(stmt), Statement::Finalize(stmt) => self.reconstruct_finalize(stmt), Statement::Increment(stmt) => self.reconstruct_increment(stmt), Statement::Iteration(stmt) => self.reconstruct_iteration(*stmt), @@ -245,7 +251,7 @@ pub trait StatementReconstructor: ExpressionReconstructor { ( Statement::Definition(DefinitionStatement { declaration_type: input.declaration_type, - variable_name: input.variable_name, + place: input.place, type_: input.type_, value: self.reconstruct_expression(input.value).0, span: input.span, @@ -254,6 +260,16 @@ pub trait StatementReconstructor: ExpressionReconstructor { ) } + fn reconstruct_expression_statement(&mut self, input: ExpressionStatement) -> (Statement, Self::AdditionalOutput) { + ( + Statement::Expression(ExpressionStatement { + expression: self.reconstruct_expression(input.expression).0, + span: input.span, + }), + Default::default(), + ) + } + fn reconstruct_finalize(&mut self, input: FinalizeStatement) -> (Statement, Self::AdditionalOutput) { ( Statement::Finalize(FinalizeStatement { diff --git a/compiler/ast/src/passes/visitor.rs b/compiler/ast/src/passes/visitor.rs index 73de6e5c2a..1262bb311e 100644 --- a/compiler/ast/src/passes/visitor.rs +++ b/compiler/ast/src/passes/visitor.rs @@ -37,6 +37,7 @@ pub trait ExpressionVisitor<'a> { Expression::Ternary(ternary) => self.visit_ternary(ternary, additional), Expression::Tuple(tuple) => self.visit_tuple(tuple, additional), Expression::Unary(unary) => self.visit_unary(unary, additional), + Expression::Unit(unit) => self.visit_unit(unit, additional), } } @@ -106,6 +107,10 @@ pub trait ExpressionVisitor<'a> { self.visit_expression(&input.receiver, additional); Default::default() } + + fn visit_unit(&mut self, _input: &'a UnitExpression, _additional: &Self::AdditionalInput) -> Self::Output { + Default::default() + } } /// A Visitor trait for statements in the AST. @@ -118,6 +123,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> { Statement::Console(stmt) => self.visit_console(stmt), Statement::Decrement(stmt) => self.visit_decrement(stmt), Statement::Definition(stmt) => self.visit_definition(stmt), + Statement::Expression(stmt) => self.visit_expression_statement(stmt), Statement::Finalize(stmt) => self.visit_finalize(stmt), Statement::Increment(stmt) => self.visit_increment(stmt), Statement::Iteration(stmt) => self.visit_iteration(stmt), @@ -167,6 +173,10 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> { self.visit_expression(&input.value, &Default::default()); } + fn visit_expression_statement(&mut self, input: &'a ExpressionStatement) { + self.visit_expression(&input.expression, &Default::default()); + } + fn visit_finalize(&mut self, input: &'a FinalizeStatement) { input.arguments.iter().for_each(|expr| { self.visit_expression(expr, &Default::default()); diff --git a/compiler/ast/src/statement/definition/mod.rs b/compiler/ast/src/statement/definition/mod.rs index a1bb31e4cc..e9063887ae 100644 --- a/compiler/ast/src/statement/definition/mod.rs +++ b/compiler/ast/src/statement/definition/mod.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, Identifier, Node, Type}; +use crate::{Expression, Node, Type}; use leo_span::Span; use serde::{Deserialize, Serialize}; @@ -29,7 +29,7 @@ pub struct DefinitionStatement { /// What sort of declaration is this? `let` or `const`?. pub declaration_type: DeclarationType, /// The bindings / variable names to declare. - pub variable_name: Identifier, + pub place: Expression, /// The types of the bindings, if specified, or inferred otherwise. pub type_: Type, /// An initializer value for the bindings. @@ -41,7 +41,7 @@ pub struct DefinitionStatement { impl fmt::Display for DefinitionStatement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{} ", self.declaration_type)?; - write!(f, "{}", self.variable_name)?; + write!(f, "{}", self.place)?; write!(f, ": {}", self.type_)?; write!(f, " = {};", self.value) } diff --git a/compiler/ast/src/statement/expression.rs b/compiler/ast/src/statement/expression.rs new file mode 100644 index 0000000000..e62916eda8 --- /dev/null +++ b/compiler/ast/src/statement/expression.rs @@ -0,0 +1,38 @@ +// Copyright (C) 2019-2022 Aleo Systems Inc. +// This file is part of the Leo library. + +// The Leo library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// The Leo library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with the Leo library. If not, see . + +use crate::{Expression, Node}; +use leo_span::Span; + +use serde::{Deserialize, Serialize}; +use std::fmt; + +/// An expression statement, `foo(a);`. +#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] +pub struct ExpressionStatement { + /// The expression associated with the statement. + pub expression: Expression, + /// The span. + pub span: Span, +} + +impl fmt::Display for ExpressionStatement { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{};", self.expression) + } +} + +crate::simple_node_impl!(ExpressionStatement); diff --git a/compiler/ast/src/statement/mod.rs b/compiler/ast/src/statement/mod.rs index 4226f23d14..db7ef4772d 100644 --- a/compiler/ast/src/statement/mod.rs +++ b/compiler/ast/src/statement/mod.rs @@ -32,6 +32,9 @@ pub use decrement::*; pub mod definition; pub use definition::*; +pub mod expression; +pub use expression::*; + pub mod finalize; pub use finalize::*; @@ -66,6 +69,8 @@ pub enum Statement { Decrement(DecrementStatement), /// A binding or set of bindings / variables to declare. Definition(DefinitionStatement), + /// An expression statement + Expression(ExpressionStatement), /// A finalize statement. Finalize(FinalizeStatement), /// An increment statement. @@ -95,6 +100,7 @@ impl fmt::Display for Statement { Statement::Console(x) => x.fmt(f), Statement::Decrement(x) => x.fmt(f), Statement::Definition(x) => x.fmt(f), + Statement::Expression(x) => x.fmt(f), Statement::Finalize(x) => x.fmt(f), Statement::Increment(x) => x.fmt(f), Statement::Iteration(x) => x.fmt(f), @@ -113,6 +119,7 @@ impl Node for Statement { Console(n) => n.span(), Decrement(n) => n.span(), Definition(n) => n.span(), + Expression(n) => n.span(), Finalize(n) => n.span(), Increment(n) => n.span(), Iteration(n) => n.span(), @@ -129,6 +136,7 @@ impl Node for Statement { Console(n) => n.set_span(span), Decrement(n) => n.set_span(span), Definition(n) => n.set_span(span), + Expression(n) => n.set_span(span), Finalize(n) => n.set_span(span), Increment(n) => n.set_span(span), Iteration(n) => n.set_span(span), diff --git a/compiler/ast/src/types/tuple.rs b/compiler/ast/src/types/tuple.rs index 1887659eae..25fcfffd8b 100644 --- a/compiler/ast/src/types/tuple.rs +++ b/compiler/ast/src/types/tuple.rs @@ -15,27 +15,16 @@ // along with the Leo library. If not, see . use crate::Type; -use leo_errors::{AstError, Result}; -use leo_span::Span; use serde::{Deserialize, Serialize}; use std::{fmt, ops::Deref}; +// TODO: Consider defining a safe interface for constructing a tuple type. + /// A type list of at least two types. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Tuple(pub Vec); -impl Tuple { - /// Returns a new `Type::Tuple` enumeration. - pub fn try_new(elements: Vec, span: Span) -> Result { - match elements.len() { - 0 => Err(AstError::empty_tuple(span).into()), - 1 => Err(AstError::one_element_tuple(span).into()), - _ => Ok(Type::Tuple(Tuple(elements))), - } - } -} - impl Deref for Tuple { type Target = Vec; diff --git a/compiler/ast/src/types/type_.rs b/compiler/ast/src/types/type_.rs index ea1ba808cb..dadb3848a7 100644 --- a/compiler/ast/src/types/type_.rs +++ b/compiler/ast/src/types/type_.rs @@ -16,6 +16,7 @@ use crate::{Identifier, IntegerType, MappingType, Tuple}; +use itertools::Itertools; use serde::{Deserialize, Serialize}; use std::fmt; @@ -69,9 +70,9 @@ impl Type { (Type::Mapping(left), Type::Mapping(right)) => { left.key.eq_flat(&right.key) && left.value.eq_flat(&right.value) } - (Type::Tuple(left), Type::Tuple(right)) => left + (Type::Tuple(left), Type::Tuple(right)) if left.len() == right.len() => left .iter() - .zip(right.iter()) + .zip_eq(right.iter()) .all(|(left_type, right_type)| left_type.eq_flat(right_type)), (Type::Identifier(left), Type::Identifier(right)) => left.matches(right), _ => false, diff --git a/compiler/compiler/src/compiler.rs b/compiler/compiler/src/compiler.rs index c4977d827b..e712d32fa3 100644 --- a/compiler/compiler/src/compiler.rs +++ b/compiler/compiler/src/compiler.rs @@ -224,7 +224,7 @@ impl<'a> Compiler<'a> { self.parse_program()?; let symbol_table = self.compiler_stages()?; - let bytecode = CodeGenerator::do_pass((&self.ast, self.handler))?; + let bytecode = CodeGenerator::do_pass((&self.ast, &symbol_table))?; Ok((symbol_table, bytecode)) } diff --git a/compiler/compiler/src/test.rs b/compiler/compiler/src/test.rs index 7fafb51c15..8bd78b1375 100644 --- a/compiler/compiler/src/test.rs +++ b/compiler/compiler/src/test.rs @@ -192,7 +192,7 @@ fn temp_dir() -> PathBuf { .into_path() } -fn compile_and_process<'a>(parsed: &'a mut Compiler<'a>, handler: &Handler) -> Result { +fn compile_and_process<'a>(parsed: &'a mut Compiler<'a>) -> Result { let st = parsed.symbol_table_pass()?; let st = parsed.type_checker_pass(st)?; let st = parsed.loop_unrolling_pass(st)?; @@ -201,7 +201,7 @@ fn compile_and_process<'a>(parsed: &'a mut Compiler<'a>, handler: &Handler) -> R parsed.flattening_pass(&st, assigner)?; // Compile Leo program to bytecode. - let bytecode = CodeGenerator::do_pass((&parsed.ast, handler))?; + let bytecode = CodeGenerator::do_pass((&parsed.ast, &st))?; Ok(bytecode) } @@ -241,7 +241,7 @@ fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result { return Ok(Expression::Literal(Literal::Group(Box::new(GroupLiteral::Tuple(gt))))); } - let (mut tuple, trailing, span) = self.parse_expr_tuple()?; + let (mut elements, trailing, span) = self.parse_expr_tuple()?; - if !trailing && tuple.len() == 1 { - Ok(tuple.swap_remove(0)) - } else { - Ok(Expression::Tuple(TupleExpression { elements: tuple, span })) + match elements.len() { + // If the tuple expression is empty, return a `UnitExpression`. + 0 => Ok(Expression::Unit(UnitExpression { span })), + 1 => match trailing { + // If there is one element in the tuple but no trailing comma, e.g `(foo)`, return the element. + false => Ok(elements.swap_remove(0)), + // If there is one element in the tuple and a trailing comma, e.g `(foo,)`, emit an error since tuples must have at least two elements. + true => Err(ParserError::tuple_must_have_at_least_two_elements("expression", span).into()), + }, + // Otherwise, return a tuple expression. + // Note: This is the only place where `TupleExpression` is constructed in the parser. + _ => Ok(Expression::Tuple(TupleExpression { elements, span })), } } diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index bed03fcd72..0a0beb2600 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -99,11 +99,12 @@ impl ParserContext<'_> { Ok(Statement::Assign(Box::new(AssignStatement { span, place, value }))) } else { - // Error on `expr;` but recover as an empty block `{}`. - self.expect(&Token::Semicolon)?; - let span = place.span() + self.prev_token.span; - self.emit_err(ParserError::expr_stmts_disallowed(span)); - Ok(Statement::dummy(span)) + // Parse the expression as a statement. + let end = self.expect(&Token::Semicolon)?; + Ok(Statement::Expression(ExpressionStatement { + span: place.span() + end, + expression: place, + })) } } @@ -116,7 +117,12 @@ impl ParserContext<'_> { /// Returns a [`ReturnStatement`] AST node if the next tokens represent a return statement. fn parse_return_statement(&mut self) -> Result { let start = self.expect(&Token::Return)?; - let expression = self.parse_expression()?; + let expression = match self.token.token { + // If the next token is a semicolon, implicitly return a unit expression, `()`. + Token::Semicolon => Expression::Unit(UnitExpression { span: self.token.span }), + // Otherwise, attempt to parse an expression. + _ => self.parse_expression()?, + }; self.expect(&Token::Semicolon)?; let span = start + expression.span(); Ok(ReturnStatement { span, expression }) @@ -291,7 +297,9 @@ impl ParserContext<'_> { }; // Parse variable name and type. - let (variable_name, type_) = self.parse_typed_ident()?; + let place = self.parse_expression()?; + self.expect(&Token::Colon)?; + let type_ = self.parse_type()?.0; self.expect(&Token::Assign)?; let value = self.parse_expression()?; @@ -300,7 +308,7 @@ impl ParserContext<'_> { Ok(DefinitionStatement { span: decl_span + value.span(), declaration_type: decl_type, - variable_name, + place, type_, value, }) diff --git a/compiler/parser/src/parser/type_.rs b/compiler/parser/src/parser/type_.rs index e6f285a115..9192beabc7 100644 --- a/compiler/parser/src/parser/type_.rs +++ b/compiler/parser/src/parser/type_.rs @@ -16,7 +16,7 @@ use super::*; -use leo_errors::Result; +use leo_errors::{ParserError, Result}; pub(super) const TYPE_TOKENS: &[Token] = &[ Token::Address, @@ -78,6 +78,17 @@ impl ParserContext<'_> { pub fn parse_type(&mut self) -> Result<(Type, Span)> { if let Some(ident) = self.eat_identifier() { Ok((Type::Identifier(ident), ident.span)) + } else if self.token.token == Token::LeftParen { + let (types, _, span) = self.parse_paren_comma_list(|p| p.parse_type().map(Some))?; + match types.len() { + // If the parenthetical block is empty, e.g. `()` or `( )`, it should be parsed into `Unit` types. + 0 => Ok((Type::Unit, span)), + // If the parenthetical block contains a single type, e.g. `(u8)`, emit an error, since tuples must have at least two elements. + 1 => Err(ParserError::tuple_must_have_at_least_two_elements("type", span).into()), + // Otherwise, parse it into a `Tuple` type. + // Note: This is the only place where `Tuple` type is constructed in the parser. + _ => Ok((Type::Tuple(Tuple(types.into_iter().map(|t| t.0).collect())), span)), + } } else { self.parse_primitive_type() } diff --git a/compiler/passes/src/code_generation/generator.rs b/compiler/passes/src/code_generation/generator.rs index bc49e41a50..781cb1f1b0 100644 --- a/compiler/passes/src/code_generation/generator.rs +++ b/compiler/passes/src/code_generation/generator.rs @@ -14,14 +14,16 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +use crate::SymbolTable; + use leo_ast::Function; -use leo_errors::emitter::Handler; use leo_span::Symbol; use indexmap::IndexMap; pub struct CodeGenerator<'a> { - _handler: &'a Handler, + /// The symbol table for the program. + pub(crate) symbol_table: &'a SymbolTable, /// A counter to track the next available register. pub(crate) next_register: u64, /// Reference to the current function. @@ -40,10 +42,10 @@ pub struct CodeGenerator<'a> { impl<'a> CodeGenerator<'a> { /// Initializes a new `CodeGenerator`. - pub fn new(handler: &'a Handler) -> Self { + pub fn new(symbol_table: &'a SymbolTable) -> Self { // Initialize variable mapping. Self { - _handler: handler, + symbol_table, next_register: 0, current_function: None, variable_mapping: IndexMap::new(), diff --git a/compiler/passes/src/code_generation/mod.rs b/compiler/passes/src/code_generation/mod.rs index e6fd42fb2b..d60a8cec37 100644 --- a/compiler/passes/src/code_generation/mod.rs +++ b/compiler/passes/src/code_generation/mod.rs @@ -25,20 +25,18 @@ mod visit_statements; mod visit_type; -use crate::Pass; +use crate::{Pass, SymbolTable}; use leo_ast::Ast; -use leo_errors::emitter::Handler; use leo_errors::Result; impl<'a> Pass for CodeGenerator<'a> { - type Input = (&'a Ast, &'a Handler); + type Input = (&'a Ast, &'a SymbolTable); type Output = Result; - fn do_pass((ast, handler): Self::Input) -> Self::Output { - let mut generator = Self::new(handler); + fn do_pass((ast, symbol_table): Self::Input) -> Self::Output { + let mut generator = Self::new(symbol_table); let bytecode = generator.visit_program(ast.as_repr()); - handler.last_err()?; Ok(bytecode) } diff --git a/compiler/passes/src/code_generation/visit_expressions.rs b/compiler/passes/src/code_generation/visit_expressions.rs index 42f867f68b..052d6b0235 100644 --- a/compiler/passes/src/code_generation/visit_expressions.rs +++ b/compiler/passes/src/code_generation/visit_expressions.rs @@ -18,9 +18,10 @@ use crate::CodeGenerator; use leo_ast::{ AccessExpression, AssociatedFunction, BinaryExpression, BinaryOperation, CallExpression, ErrExpression, Expression, Identifier, Literal, MemberAccess, StructExpression, TernaryExpression, TupleExpression, Type, UnaryExpression, - UnaryOperation, + UnaryOperation, UnitExpression, }; use leo_span::sym; +use std::borrow::Borrow; use std::fmt::Write as _; @@ -41,6 +42,7 @@ impl<'a> CodeGenerator<'a> { Expression::Ternary(expr) => self.visit_ternary(expr), Expression::Tuple(expr) => self.visit_tuple(expr), Expression::Unary(expr) => self.visit_unary(expr), + Expression::Unit(expr) => self.visit_unit(expr), } } @@ -275,6 +277,7 @@ impl<'a> CodeGenerator<'a> { } } + // TODO: Cleanup fn visit_call(&mut self, input: &'a CallExpression) -> (String, String) { let mut call_instruction = match &input.external { Some(external) => format!(" call {external}.aleo/{} ", input.function), @@ -288,19 +291,53 @@ impl<'a> CodeGenerator<'a> { instructions.push_str(&argument_instructions); } - // Push destination register to call instruction. - let destination_register = format!("r{}", self.next_register); - writeln!(call_instruction, "into {destination_register};").expect("failed to write to string"); - instructions.push_str(&call_instruction); + // Lookup the function return type. + let function_name = match input.function.borrow() { + Expression::Identifier(identifier) => identifier.name, + _ => unreachable!("Parsing guarantees that all `input.function` is always an identifier."), + }; + let return_type = &self + .symbol_table + .borrow() + .functions + .get(&function_name) + .unwrap() + .output_type; + match return_type { + Type::Unit => (String::new(), instructions), // Do nothing + Type::Tuple(tuple) => match tuple.len() { + 0 | 1 => unreachable!("Parsing guarantees that a tuple type has at least two elements"), + len => { + let mut destinations = Vec::new(); + for _ in 0..len { + let destination_register = format!("r{}", self.next_register); + destinations.push(destination_register); + self.next_register += 1; + } + let destinations = destinations.join(" "); + writeln!(call_instruction, "into {destinations};", destinations = destinations) + .expect("failed to write to string"); + instructions.push_str(&call_instruction); - // Increment the register counter. - self.next_register += 1; + (destinations, call_instruction) + } + }, + _ => { + // Push destination register to call instruction. + let destination_register = format!("r{}", self.next_register); + writeln!(call_instruction, "into {destination_register};").expect("failed to write to string"); + instructions.push_str(&call_instruction); - (destination_register, instructions) + // Increment the register counter. + self.next_register += 1; + + (destination_register, instructions) + } + } } fn visit_tuple(&mut self, input: &'a TupleExpression) -> (String, String) { - // Need to return a single string here so we will join the tuple elements with '\n' + // Need to return a single string here so we will join the tuple elements with ' ' // and split them after this method is called. let mut tuple_elements = Vec::with_capacity(input.elements.len()); let mut instructions = String::new(); @@ -313,6 +350,10 @@ impl<'a> CodeGenerator<'a> { } // CAUTION: does not return the destination_register. - (tuple_elements.join("\n"), instructions) + (tuple_elements.join(" "), instructions) + } + + fn visit_unit(&mut self, _input: &'a UnitExpression) -> (String, String) { + unreachable!("`UnitExpression`s should not be visited during code generation.") } } diff --git a/compiler/passes/src/code_generation/visit_statements.rs b/compiler/passes/src/code_generation/visit_statements.rs index 30e49b2ea8..15e7b18ecc 100644 --- a/compiler/passes/src/code_generation/visit_statements.rs +++ b/compiler/passes/src/code_generation/visit_statements.rs @@ -18,8 +18,8 @@ use crate::CodeGenerator; use leo_ast::{ AssignStatement, Block, ConditionalStatement, ConsoleFunction, ConsoleStatement, DecrementStatement, - DefinitionStatement, Expression, FinalizeStatement, IncrementStatement, IterationStatement, Mode, Output, - ReturnStatement, Statement, + DefinitionStatement, Expression, ExpressionStatement, FinalizeStatement, IncrementStatement, IterationStatement, + Mode, Output, ReturnStatement, Statement, }; use itertools::Itertools; @@ -34,6 +34,7 @@ impl<'a> CodeGenerator<'a> { Statement::Console(stmt) => self.visit_console(stmt), Statement::Decrement(stmt) => self.visit_decrement(stmt), Statement::Definition(stmt) => self.visit_definition(stmt), + Statement::Expression(stmt) => self.visit_expression_statement(stmt), Statement::Finalize(stmt) => self.visit_finalize(stmt), Statement::Increment(stmt) => self.visit_increment(stmt), Statement::Iteration(stmt) => self.visit_iteration(stmt), @@ -44,7 +45,7 @@ impl<'a> CodeGenerator<'a> { fn visit_return(&mut self, input: &'a ReturnStatement) -> String { match input.expression { // Skip empty return statements. - Expression::Tuple(ref tuple) if tuple.elements.is_empty() => String::new(), + Expression::Unit(_) => String::new(), _ => { let (operand, mut expression_instructions) = self.visit_expression(&input.expression); // Get the output type of the function. @@ -56,7 +57,7 @@ impl<'a> CodeGenerator<'a> { self.current_function.unwrap().output.iter() }; let instructions = operand - .split('\n') + .split(' ') .into_iter() .zip_eq(output) .map(|(operand, output)| { @@ -110,6 +111,14 @@ impl<'a> CodeGenerator<'a> { unreachable!("DefinitionStatement's should not exist in SSA form.") } + fn visit_expression_statement(&mut self, input: &'a ExpressionStatement) -> String { + println!("ExpressionStatement: {:?}", input); + match input.expression { + Expression::Call(_) => self.visit_expression(&input.expression).1, + _ => unreachable!("ExpressionStatement's can only contain CallExpression's."), + } + } + fn visit_increment(&mut self, input: &'a IncrementStatement) -> String { let (index, mut instructions) = self.visit_expression(&input.index); let (amount, amount_instructions) = self.visit_expression(&input.amount); @@ -143,12 +152,29 @@ impl<'a> CodeGenerator<'a> { } fn visit_assign(&mut self, input: &'a AssignStatement) -> String { - match &input.place { - Expression::Identifier(identifier) => { + match (&input.place, &input.value) { + (Expression::Identifier(identifier), _) => { let (operand, expression_instructions) = self.visit_expression(&input.value); self.variable_mapping.insert(&identifier.name, operand); expression_instructions } + (Expression::Tuple(tuple), Expression::Call(_)) => { + let (operand, expression_instructions) = self.visit_expression(&input.value); + // Split out the destinations from the tuple. + let operands = operand.split(' ').collect::>(); + // Add the destinations to the variable mapping. + tuple.elements.iter().zip_eq(operands).for_each(|(element, operand)| { + match element { + Expression::Identifier(identifier) => { + self.variable_mapping.insert(&identifier.name, operand.to_string()) + } + _ => { + unreachable!("Type checking ensures that tuple elements on the lhs are always identifiers.") + } + }; + }); + expression_instructions + } _ => unimplemented!( "Code generation for the left-hand side of an assignment is only implemented for `Identifier`s." ), diff --git a/compiler/passes/src/code_generation/visit_type.rs b/compiler/passes/src/code_generation/visit_type.rs index 9c4e04ed52..9ffa43b04d 100644 --- a/compiler/passes/src/code_generation/visit_type.rs +++ b/compiler/passes/src/code_generation/visit_type.rs @@ -33,7 +33,7 @@ impl<'a> CodeGenerator<'a> { unreachable!("Mapping types are not supported at this phase of compilation") } Type::Tuple(_) => { - unreachable!("Tuple types are not supported at this phase of compilation") + unreachable!("Tuple types should not be visited at this phase of compilation") } Type::Err => unreachable!("Error types should not exist at this phase of compilation"), Type::Unit => unreachable!("Unit types are not supported at this phase of compilation"), diff --git a/compiler/passes/src/flattening/flatten_expression.rs b/compiler/passes/src/flattening/flatten_expression.rs index df287aba6d..1b9af6b786 100644 --- a/compiler/passes/src/flattening/flatten_expression.rs +++ b/compiler/passes/src/flattening/flatten_expression.rs @@ -18,8 +18,8 @@ use crate::Flattener; use itertools::Itertools; use leo_ast::{ - AccessExpression, Expression, ExpressionReconstructor, Member, MemberAccess, Statement, StructExpression, - StructVariableInitializer, TernaryExpression, TupleExpression, + AccessExpression, AssociatedFunction, Expression, ExpressionReconstructor, Member, MemberAccess, Statement, + StructExpression, StructVariableInitializer, TernaryExpression, TupleExpression, }; // TODO: Clean up logic. To be done in a follow-up PR (feat/tuples) @@ -27,6 +27,78 @@ use leo_ast::{ impl ExpressionReconstructor for Flattener<'_> { type AdditionalOutput = Vec; + /// Replaces a tuple access expression with the appropriate expression. + fn reconstruct_access(&mut self, input: AccessExpression) -> (Expression, Self::AdditionalOutput) { + let mut statements = Vec::new(); + ( + match input { + AccessExpression::AssociatedFunction(function) => { + Expression::Access(AccessExpression::AssociatedFunction(AssociatedFunction { + ty: function.ty, + name: function.name, + args: function + .args + .into_iter() + .map(|arg| self.reconstruct_expression(arg).0) + .collect(), + span: function.span, + })) + } + AccessExpression::Member(member) => Expression::Access(AccessExpression::Member(MemberAccess { + inner: Box::new(self.reconstruct_expression(*member.inner).0), + name: member.name, + span: member.span, + })), + AccessExpression::Tuple(tuple) => { + // Reconstruct the tuple expression. + let (expr, stmts) = self.reconstruct_expression(*tuple.tuple); + + // Accumulate any statements produced. + statements.extend(stmts); + + // Lookup the expression in the tuple map. + match expr { + Expression::Identifier(identifier) => { + // Note that this unwrap is safe since TYC guarantees that all tuples are declared and indices are valid. + self.tuples.get(&identifier.name).unwrap().elements[tuple.index.to_usize()].clone() + } + _ => unreachable!("SSA guarantees that subexpressions are identifiers or literals."), + } + } + expr => Expression::Access(expr), + }, + statements, + ) + } + + /// Reconstructs a struct init expression, flattening any tuples in the expression. + fn reconstruct_struct_init(&mut self, input: StructExpression) -> (Expression, Self::AdditionalOutput) { + let mut statements = Vec::new(); + let mut members = Vec::with_capacity(input.members.len()); + + // Reconstruct and flatten the argument expressions. + for member in input.members.into_iter() { + // Note that this unwrap is safe since SSA guarantees that all struct variable initializers are of the form `: `. + let (expr, stmts) = self.reconstruct_expression(member.expression.unwrap()); + // Accumulate any statements produced. + statements.extend(stmts); + // Accumulate the struct members. + members.push(StructVariableInitializer { + identifier: member.identifier, + expression: Some(expr), + }); + } + + ( + Expression::Struct(StructExpression { + name: input.name, + members, + span: input.span, + }), + statements, + ) + } + /// Reconstructs ternary expressions over tuples and structs, accumulating any statements that are generated. /// This is necessary because Aleo instructions does not support ternary expressions over composite data types. /// For example, the ternary expression `cond ? (a, b) : (c, d)` is flattened into the following: @@ -254,6 +326,22 @@ impl ExpressionReconstructor for Flattener<'_> { (Expression::Identifier(identifier), statements) } + // If both expressions are identifiers which map to tuples, construct ternary expression over the tuples. + (Expression::Identifier(first), Expression::Identifier(second)) + if self.tuples.contains_key(&first.name) && self.tuples.contains_key(&second.name) => + { + // Note that this unwrap is safe since we check that `self.tuples` contains the key. + let first_tuple = self.tuples.get(&first.name).unwrap(); + // Note that this unwrap is safe since we check that `self.tuples` contains the key. + let second_tuple = self.tuples.get(&second.name).unwrap(); + // Note that type checking guarantees that both expressions have the same same type. + self.reconstruct_ternary(TernaryExpression { + condition: input.condition, + if_true: Box::new(Expression::Tuple(first_tuple.clone())), + if_false: Box::new(Expression::Tuple(second_tuple.clone())), + span: input.span, + }) + } // Otherwise, create a new intermediate assignment for the ternary expression are return the assigned variable. // Note that a new assignment must be created to flattened nested ternary expressions. (if_true, if_false) => { diff --git a/compiler/passes/src/flattening/flatten_program.rs b/compiler/passes/src/flattening/flatten_program.rs index 15d305e920..ca7aa035d9 100644 --- a/compiler/passes/src/flattening/flatten_program.rs +++ b/compiler/passes/src/flattening/flatten_program.rs @@ -16,10 +16,7 @@ use crate::Flattener; -use leo_ast::{ - Finalize, FinalizeStatement, Function, ProgramReconstructor, ReturnStatement, Statement, StatementReconstructor, - Type, -}; +use leo_ast::{Finalize, FinalizeStatement, Function, ProgramReconstructor, Statement, StatementReconstructor, Type}; impl ProgramReconstructor for Flattener<'_> { /// Flattens a function's body and finalize block, if it exists. @@ -34,7 +31,6 @@ impl ProgramReconstructor for Flattener<'_> { self.structs.insert(input.identifier().name, struct_name.name); } } - // Flatten the finalize block. let mut block = self.reconstruct_block(finalize.block).0; @@ -42,18 +38,7 @@ impl ProgramReconstructor for Flattener<'_> { let returns = self.clear_early_returns(); // If the finalize block contains return statements, then we fold them into a single return statement. - if !returns.is_empty() { - let (expression, stmts) = self.fold_guards("ret$", returns); - - // Add all of the accumulated statements to the end of the block. - block.statements.extend(stmts); - - // Add the `ReturnStatement` to the end of the block. - block.statements.push(Statement::Return(ReturnStatement { - expression, - span: Default::default(), - })); - } + self.fold_returns(&mut block, returns); // Initialize `self.finalizes` with the appropriate number of vectors. self.finalizes = vec![vec![]; finalize.input.len()]; @@ -83,18 +68,7 @@ impl ProgramReconstructor for Flattener<'_> { let returns = self.clear_early_returns(); // If the function contains return statements, then we fold them into a single return statement. - if !returns.is_empty() { - let (expression, stmts) = self.fold_guards("ret$", returns); - - // Add all of the accumulated statements to the end of the block. - block.statements.extend(stmts); - - // Add the `ReturnStatement` to the end of the block. - block.statements.push(Statement::Return(ReturnStatement { - expression, - span: Default::default(), - })); - } + self.fold_returns(&mut block, returns); // If the function has a finalize block, then type checking guarantees that it has at least one finalize statement. if finalize.is_some() { diff --git a/compiler/passes/src/flattening/flatten_statement.rs b/compiler/passes/src/flattening/flatten_statement.rs index f31b136409..cdcf5ad142 100644 --- a/compiler/passes/src/flattening/flatten_statement.rs +++ b/compiler/passes/src/flattening/flatten_statement.rs @@ -15,11 +15,13 @@ // along with the Leo library. If not, see . use crate::Flattener; +use itertools::Itertools; +use std::borrow::Borrow; use leo_ast::{ AssignStatement, BinaryExpression, BinaryOperation, Block, ConditionalStatement, ConsoleFunction, ConsoleStatement, - DefinitionStatement, Expression, ExpressionReconstructor, FinalizeStatement, IterationStatement, Node, - ReturnStatement, Statement, StatementReconstructor, UnaryExpression, UnaryOperation, + DefinitionStatement, Expression, ExpressionReconstructor, FinalizeStatement, Identifier, IterationStatement, Node, + ReturnStatement, Statement, StatementReconstructor, TupleExpression, Type, UnaryExpression, UnaryOperation, }; impl StatementReconstructor for Flattener<'_> { @@ -28,29 +30,189 @@ impl StatementReconstructor for Flattener<'_> { /// Note that new statements are only produced if the right hand side is a ternary expression over structs. /// Otherwise, the statement is returned as is. fn reconstruct_assign(&mut self, assign: AssignStatement) -> (Statement, Self::AdditionalOutput) { - let lhs = match assign.place { - Expression::Identifier(identifier) => identifier, - _ => unreachable!("`AssignStatement`s can only have `Identifier`s on the left hand side."), - }; + // Flatten the rhs of the assignment. + let (value, mut statements) = self.reconstruct_expression(assign.value); + match (assign.place, value) { + // If the lhs is an identifier and the rhs is a tuple, then add the tuple to `self.tuples`. + (Expression::Identifier(identifier), Expression::Tuple(tuple)) => { + self.tuples.insert(identifier.name, tuple); + // Note that tuple assignments are removed from the AST. + (Statement::dummy(Default::default()), statements) + } + // If the lhs is an identifier and the rhs is an identifier that is a tuple, then add it to `self.tuples`. + (Expression::Identifier(lhs_identifier), Expression::Identifier(rhs_identifier)) + if self.tuples.contains_key(&rhs_identifier.name) => + { + // Lookup the entry in `self.tuples` and add it for the lhs of the assignment. + // Note that the `unwrap` is safe since the match arm checks that the entry exists. + self.tuples.insert( + lhs_identifier.name, + self.tuples.get(&rhs_identifier.name).unwrap().clone(), + ); + // Note that tuple assignments are removed from the AST. + (Statement::dummy(Default::default()), statements) + } + // If the lhs is an identifier and the rhs is a function call that produces a tuple, then add it to `self.tuples`. + (Expression::Identifier(lhs_identifier), Expression::Call(call)) => { + // Retrieve the entry in the symbol table for the function call. + // Note that this unwrap is safe since type checking ensures that the function exists. + let function_name = match call.function.borrow() { + Expression::Identifier(rhs_identifier) => rhs_identifier.name, + _ => unreachable!("Parsing guarantees that `function` is an identifier."), + }; - let (value, statements) = match assign.value { - // If the rhs of the assignment is ternary expression, reconstruct it. - Expression::Ternary(ternary) => self.reconstruct_ternary(ternary), - // Otherwise return the original statement. - value => (value, Default::default()), - }; + let function = self.symbol_table.borrow().functions.get(&function_name).unwrap(); + match &function.output_type { + // If the function returns a tuple, reconstruct the assignment and add an entry to `self.tuples`. + Type::Tuple(tuple) => { + // Create a new tuple expression with unique identifiers for each index of the lhs. + let tuple_expression = TupleExpression { + elements: (0..tuple.len()) + .zip_eq(tuple.0.iter()) + .map(|(i, type_)| { + let identifier = Identifier::new( + self.assigner.unique_symbol(lhs_identifier.name, format!("$index${i}$")), + ); - // Update the `self.structs` if the rhs is a struct. - self.update_structs(&lhs, &value); + // If the output type is a struct, add it to `self.structs`. + if let Type::Identifier(struct_name) = type_ { + self.structs.insert(identifier.name, struct_name.name); + } - ( - Statement::Assign(Box::new(AssignStatement { - place: Expression::Identifier(lhs), - value, - span: assign.span, - })), - statements, - ) + Expression::Identifier(identifier) + }) + .collect(), + span: Default::default(), + }; + // Add the `tuple_expression` to `self.tuples`. + self.tuples.insert(lhs_identifier.name, tuple_expression.clone()); + // Construct a new assignment statement with a tuple expression on the lhs. + ( + Statement::Assign(Box::new(AssignStatement { + place: Expression::Tuple(tuple_expression), + value: Expression::Call(call), + span: Default::default(), + })), + statements, + ) + } + // Otherwise, reconstruct the assignment as is. + type_ => { + // If the function returns a struct, add it to `self.structs`. + if let Type::Identifier(struct_name) = type_ { + self.structs.insert(lhs_identifier.name, struct_name.name); + }; + ( + Statement::Assign(Box::new(AssignStatement { + place: Expression::Identifier(lhs_identifier), + value: Expression::Call(call), + span: Default::default(), + })), + statements, + ) + } + } + } + (Expression::Identifier(identifier), expression) => { + self.update_structs(&identifier, &expression); + ( + self.assigner.simple_assign_statement(identifier, expression), + statements, + ) + } + // If the lhs is a tuple and the rhs is a function call, then return the reconstructed statement. + (Expression::Tuple(tuple), Expression::Call(call)) => { + // Retrieve the entry in the symbol table for the function call. + // Note that this unwrap is safe since type checking ensures that the function exists. + let function_name = match call.function.borrow() { + Expression::Identifier(rhs_identifier) => rhs_identifier.name, + _ => unreachable!("Parsing guarantees that `function` is an identifier."), + }; + + let function = self.symbol_table.borrow().functions.get(&function_name).unwrap(); + + let output_type = match &function.output_type { + Type::Tuple(tuple) => tuple.clone(), + _ => unreachable!("Type checking guarantees that the output type is a tuple."), + }; + + tuple + .elements + .iter() + .zip_eq(output_type.0.iter()) + .for_each(|(identifier, type_)| { + let identifier = match identifier { + Expression::Identifier(identifier) => identifier, + _ => unreachable!( + "Type checking guarantees that a tuple element on the lhs is an identifier." + ), + }; + // If the output type is a struct, add it to `self.structs`. + if let Type::Identifier(struct_name) = type_ { + self.structs.insert(identifier.name, struct_name.name); + } + }); + + ( + Statement::Assign(Box::new(AssignStatement { + place: Expression::Tuple(tuple), + value: Expression::Call(call), + span: Default::default(), + })), + statements, + ) + } + // If the lhs is a tuple and the rhs is a tuple, create a new assign statement for each tuple element. + (Expression::Tuple(lhs_tuple), Expression::Tuple(rhs_tuple)) => { + statements.extend(lhs_tuple.elements.into_iter().zip(rhs_tuple.elements.into_iter()).map( + |(lhs, rhs)| { + let identifier = match &lhs { + Expression::Identifier(identifier) => identifier, + _ => unreachable!("Type checking guarantees that `lhs` is an identifier."), + }; + self.update_structs(identifier, &rhs); + Statement::Assign(Box::new(AssignStatement { + place: lhs, + value: rhs, + span: Default::default(), + })) + }, + )); + (Statement::dummy(Default::default()), statements) + } + // If the lhs is a tuple and the rhs is an identifier that is a tuple, create a new assign statement for each tuple element. + (Expression::Tuple(lhs_tuple), Expression::Identifier(identifier)) + if self.tuples.contains_key(&identifier.name) => + { + // Lookup the entry in `self.tuples`. + // Note that the `unwrap` is safe since the match arm checks that the entry exists. + let rhs_tuple = self.tuples.get(&identifier.name).unwrap().clone(); + // Create a new assign statement for each tuple element. + for (lhs, rhs) in lhs_tuple.elements.into_iter().zip(rhs_tuple.elements.into_iter()) { + let identifier = match &lhs { + Expression::Identifier(identifier) => identifier, + _ => unreachable!("Type checking guarantees that `lhs` is an identifier."), + }; + self.update_structs(identifier, &rhs); + + statements.push(Statement::Assign(Box::new(AssignStatement { + place: lhs, + value: rhs, + span: Default::default(), + }))); + } + (Statement::dummy(Default::default()), statements) + } + // If the lhs of an assignment is a tuple, then the rhs can be one of the following: + // - A function call that produces a tuple. (handled above) + // - A tuple. (handled above) + // - An identifier that is a tuple. (handled above) + // - A ternary expression that produces a tuple. (handled when the rhs is flattened above) + (Expression::Tuple(_), _) => { + unreachable!("`Type checking guarantees that the rhs of an assignment to a tuple is a tuple.`") + } + _ => unreachable!("`AssignStatement`s can only have `Identifier`s or `Tuple`s on the left hand side."), + } } // TODO: Do we want to flatten nested blocks? They do not affect code generation but it would regularize the AST structure. @@ -214,6 +376,7 @@ impl StatementReconstructor for Flattener<'_> { // For each finalize argument, add it and its associated guard to the appropriate list of finalize arguments. // Note that type checking guarantees that the number of arguments in a finalize statement is equal to the number of arguments in to the finalize block. for (i, argument) in input.arguments.into_iter().enumerate() { + // Note that the argument is not reconstructed. // Note that this unwrap is safe since we initialize `self.finalizes` with a number of vectors equal to the number of finalize arguments. self.finalizes.get_mut(i).unwrap().push((guard.clone(), argument)); } @@ -232,8 +395,18 @@ impl StatementReconstructor for Flattener<'_> { // Construct the associated guard. let guard = self.construct_guard(); - // Add it to the list of return statements. - self.returns.push((guard, input.expression)); + // Add it to `self.returns`. + // Note that SSA guarantees that `input.expression` is either a literal or identifier. + match input.expression { + // If the input is an identifier that maps to a tuple, add the corresponding tuple to `self.returns` + Expression::Identifier(identifier) if self.tuples.contains_key(&identifier.name) => { + // Note that the `unwrap` is safe since the match arm checks that the entry exists in `self.tuples`. + let tuple = self.tuples.get(&identifier.name).unwrap().clone(); + self.returns.push((guard, Expression::Tuple(tuple))) + } + // Otherwise, add the expression directly. + _ => self.returns.push((guard, input.expression)), + }; (Statement::dummy(Default::default()), Default::default()) } diff --git a/compiler/passes/src/flattening/flattener.rs b/compiler/passes/src/flattening/flattener.rs index e80092012d..af008b045a 100644 --- a/compiler/passes/src/flattening/flattener.rs +++ b/compiler/passes/src/flattening/flattener.rs @@ -17,8 +17,8 @@ use crate::{Assigner, SymbolTable}; use leo_ast::{ - AccessExpression, BinaryExpression, BinaryOperation, Expression, ExpressionReconstructor, Identifier, Member, - Statement, TernaryExpression, Type, + AccessExpression, BinaryExpression, BinaryOperation, Block, Expression, ExpressionReconstructor, Identifier, + Member, ReturnStatement, Statement, TernaryExpression, TupleExpression, Type, }; use leo_span::Symbol; @@ -26,7 +26,6 @@ use indexmap::IndexMap; pub struct Flattener<'a> { /// The symbol table associated with the program. - /// This table is used to lookup struct definitions, when they are folded. pub(crate) symbol_table: &'a SymbolTable, /// An struct used to construct (unique) assignment statements. pub(crate) assigner: Assigner, @@ -44,6 +43,8 @@ pub struct Flattener<'a> { /// Note that finalizes are inserted in the order they are encountered during a pre-order traversal of the AST. /// Note that type checking guarantees that there is at most one finalize in a basic block. pub(crate) finalizes: Vec, Expression)>>, + /// A mapping between variables and flattened tuple expressions. + pub(crate) tuples: IndexMap, } impl<'a> Flattener<'a> { @@ -55,6 +56,7 @@ impl<'a> Flattener<'a> { condition_stack: Vec::new(), returns: Vec::new(), finalizes: Vec::new(), + tuples: IndexMap::new(), } } @@ -68,6 +70,24 @@ impl<'a> Flattener<'a> { core::mem::take(&mut self.finalizes) } + /// Constructs a guard from the current state of the condition stack. + pub(crate) fn construct_guard(&mut self) -> Option { + match self.condition_stack.is_empty() { + true => None, + false => { + let (first, rest) = self.condition_stack.split_first().unwrap(); + Some(rest.iter().cloned().fold(first.clone(), |acc, condition| { + Expression::Binary(BinaryExpression { + op: BinaryOperation::And, + left: Box::new(acc), + right: Box::new(condition), + span: Default::default(), + }) + })) + } + } + } + /// Fold guards and expressions into a single expression. /// Note that this function assumes that at least one guard is present. pub(crate) fn fold_guards( @@ -84,7 +104,7 @@ impl<'a> Flattener<'a> { // Helper to construct and store ternary assignments. e.g `$ret$0 = $var$0 ? $var$1 : $var$2` let mut construct_ternary_assignment = |guard: Expression, if_true: Expression, if_false: Expression| { let place = Identifier { - name: self.assigner.unique_symbol(prefix), + name: self.assigner.unique_symbol(prefix, "$"), span: Default::default(), }; let (value, stmts) = self.reconstruct_ternary(TernaryExpression { @@ -176,21 +196,21 @@ impl<'a> Flattener<'a> { self.assigner.simple_assign_statement(lhs, rhs) } - /// Constructs a conjunction of all the conditions in the stack. - pub(crate) fn construct_guard(&self) -> Option { - match self.condition_stack.is_empty() { - true => None, - false => { - let (first, rest) = self.condition_stack.split_first().unwrap(); - Some(rest.iter().cloned().fold(first.clone(), |acc, condition| { - Expression::Binary(BinaryExpression { - op: BinaryOperation::And, - left: Box::new(acc), - right: Box::new(condition), - span: Default::default(), - }) - })) - } + /// Folds a list of return statements into a single return statement and adds the produced statements to the block. + pub(crate) fn fold_returns(&mut self, block: &mut Block, returns: Vec<(Option, Expression)>) { + if !returns.is_empty() { + let (expression, stmts) = self.fold_guards("ret$", returns); + + // TODO: Flatten tuples in the return statements. + + // Add all of the accumulated statements to the end of the block. + block.statements.extend(stmts); + + // Add the `ReturnStatement` to the end of the block. + block.statements.push(Statement::Return(ReturnStatement { + expression, + span: Default::default(), + })); } } } diff --git a/compiler/passes/src/loop_unrolling/unroll_statement.rs b/compiler/passes/src/loop_unrolling/unroll_statement.rs index ab4e8728cd..22a831df51 100644 --- a/compiler/passes/src/loop_unrolling/unroll_statement.rs +++ b/compiler/passes/src/loop_unrolling/unroll_statement.rs @@ -14,7 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +use itertools::Itertools; use leo_ast::*; +use leo_span::{Span, Symbol}; use crate::unroller::Unroller; use crate::{VariableSymbol, VariableType}; @@ -50,15 +52,37 @@ impl StatementReconstructor for Unroller<'_> { VariableType::Mut }; - if let Err(err) = self.symbol_table.borrow_mut().insert_variable( - input.variable_name.name, - VariableSymbol { - type_: input.type_.clone(), - span: input.span(), - declaration, + let insert_variable = |symbol: Symbol, type_: Type, span: Span, declaration: VariableType| { + if let Err(err) = self.symbol_table.borrow_mut().insert_variable( + symbol, + VariableSymbol { + type_, + span, + declaration, + }, + ) { + self.handler.emit_err(err); + } + }; + + // Insert the variables in the into the symbol table. + match &input.place { + Expression::Identifier(identifier) => insert_variable(identifier.name, input.type_.clone(), identifier.span, declaration), + Expression::Tuple(tuple_expression) => { + let tuple_type = match input.type_ { + Type::Tuple(ref tuple_type) => tuple_type, + _ => unreachable!("Type checking guarantees that if the lhs is a tuple, its associated type is also a tuple.") + }; + tuple_expression.elements.iter().zip_eq(tuple_type.0.iter()).for_each(|(expression, type_)| { + let identifier = match expression { + Expression::Identifier(identifier) => identifier, + _ => unreachable!("Type checking guarantees that if the lhs is a tuple, all of its elements are identifiers.") + }; + insert_variable(identifier.name, type_.clone(), identifier.span, declaration) + }); }, - ) { - self.handler.emit_err(err); + _ => unreachable!("Type checking guarantees that the lhs of a `DefinitionStatement` is either an identifier or tuple.") + } } (Statement::Definition(input), Default::default()) diff --git a/compiler/passes/src/loop_unrolling/unroller.rs b/compiler/passes/src/loop_unrolling/unroller.rs index e02d5d2baa..76e2b2740b 100644 --- a/compiler/passes/src/loop_unrolling/unroller.rs +++ b/compiler/passes/src/loop_unrolling/unroller.rs @@ -191,7 +191,7 @@ impl<'a> Unroller<'a> { type_: input.type_.clone(), value: Expression::Literal(value), span: Default::default(), - variable_name: input.variable, + place: Expression::Identifier(input.variable), }) .0, ]; diff --git a/compiler/passes/src/static_single_assignment/assigner.rs b/compiler/passes/src/static_single_assignment/assigner.rs index 655ee5d5f8..777478398d 100644 --- a/compiler/passes/src/static_single_assignment/assigner.rs +++ b/compiler/passes/src/static_single_assignment/assigner.rs @@ -27,9 +27,9 @@ pub struct Assigner { impl Assigner { /// Return a new unique `Symbol` from a `&str`. - pub(crate) fn unique_symbol(&mut self, arg: impl Display) -> Symbol { + pub(crate) fn unique_symbol(&mut self, arg: impl Display, separator: impl Display) -> Symbol { self.counter += 1; - Symbol::intern(&format!("{arg}${}", self.counter - 1)) + Symbol::intern(&format!("{}{}{}", arg, separator, self.counter - 1)) } /// Constructs the assignment statement `place = expr;`. @@ -46,7 +46,7 @@ impl Assigner { /// For example, `expr` is transformed into `$var$0 = expr;`. pub(crate) fn unique_simple_assign_statement(&mut self, expr: Expression) -> (Identifier, Statement) { // Create a new variable for the expression. - let name = self.unique_symbol("$var"); + let name = self.unique_symbol("$var", "$"); let place = Identifier { name, diff --git a/compiler/passes/src/static_single_assignment/rename_expression.rs b/compiler/passes/src/static_single_assignment/rename_expression.rs index bdbafd6c91..912f31f3c3 100644 --- a/compiler/passes/src/static_single_assignment/rename_expression.rs +++ b/compiler/passes/src/static_single_assignment/rename_expression.rs @@ -15,16 +15,17 @@ // along with the Leo library. If not, see . use crate::StaticSingleAssigner; -use indexmap::IndexMap; -use std::borrow::Borrow; use leo_ast::{ AccessExpression, AssociatedFunction, BinaryExpression, CallExpression, Expression, ExpressionConsumer, Identifier, Literal, MemberAccess, Statement, Struct, StructExpression, StructVariableInitializer, TernaryExpression, - TupleAccess, TupleExpression, UnaryExpression, + TupleAccess, TupleExpression, UnaryExpression, UnitExpression, }; use leo_span::{sym, Symbol}; +use indexmap::IndexMap; +use std::borrow::Borrow; + impl ExpressionConsumer for StaticSingleAssigner<'_> { type Output = (Expression, Vec); @@ -225,7 +226,7 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> { let name = match self.is_lhs { // If consuming the left-hand side of a definition or assignment, a new unique name is introduced. true => { - let new_name = self.assigner.unique_symbol(identifier.name); + let new_name = self.assigner.unique_symbol(identifier.name, "$"); self.rename_table.update(identifier.name, new_name); new_name } @@ -292,15 +293,16 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> { }) .collect(); - // Note that we do not construct a new assignment statement for the tuple expression. - // This is because tuple expressions are restricted to use in a return statement. - ( - Expression::Tuple(TupleExpression { + // Construct and accumulate a new assignment statement for the tuple expression. + let (place, statement) = self + .assigner + .unique_simple_assign_statement(Expression::Tuple(TupleExpression { elements, span: input.span, - }), - statements, - ) + })); + statements.push(statement); + + (Expression::Identifier(place), statements) } /// Consumes a unary expression, accumulating any statements that are generated. @@ -320,4 +322,8 @@ impl ExpressionConsumer for StaticSingleAssigner<'_> { (Expression::Identifier(place), statements) } + + fn consume_unit(&mut self, input: UnitExpression) -> Self::Output { + (Expression::Unit(input), Default::default()) + } } diff --git a/compiler/passes/src/static_single_assignment/rename_statement.rs b/compiler/passes/src/static_single_assignment/rename_statement.rs index abce1b8cff..7f5d59aec7 100644 --- a/compiler/passes/src/static_single_assignment/rename_statement.rs +++ b/compiler/passes/src/static_single_assignment/rename_statement.rs @@ -17,9 +17,10 @@ use crate::{RenameTable, StaticSingleAssigner}; use leo_ast::{ - AssignStatement, Block, ConditionalStatement, ConsoleFunction, ConsoleStatement, DecrementStatement, - DefinitionStatement, Expression, ExpressionConsumer, FinalizeStatement, Identifier, IncrementStatement, - IterationStatement, ReturnStatement, Statement, StatementConsumer, TernaryExpression, + AssignStatement, Block, CallExpression, ConditionalStatement, ConsoleFunction, ConsoleStatement, + DecrementStatement, DefinitionStatement, Expression, ExpressionConsumer, ExpressionStatement, FinalizeStatement, + Identifier, IncrementStatement, IterationStatement, ReturnStatement, Statement, StatementConsumer, + TernaryExpression, TupleExpression, }; use leo_span::Symbol; @@ -127,7 +128,7 @@ impl StatementConsumer for StaticSingleAssigner<'_> { }; // Create a new name for the variable written to in the `ConditionalStatement`. - let new_name = self.assigner.unique_symbol(symbol); + let new_name = self.assigner.unique_symbol(symbol, "$"); let (value, stmts) = self.consume_ternary(TernaryExpression { condition: Box::new(condition.clone()), @@ -223,13 +224,75 @@ impl StatementConsumer for StaticSingleAssigner<'_> { // Then assign a new unique name to the left-hand-side of the definition. // Note that this order is necessary to ensure that the right-hand-side uses the correct name when consuming a complex assignment. self.is_lhs = true; - let identifier = match self.consume_identifier(definition.variable_name).0 { - Expression::Identifier(identifier) => identifier, - _ => unreachable!("`self.consume_identifier` will always return an `Identifier`."), - }; + match definition.place { + Expression::Identifier(identifier) => { + let identifier = match self.consume_identifier(identifier).0 { + Expression::Identifier(identifier) => identifier, + _ => unreachable!("`self.consume_identifier` will always return an `Identifier`."), + }; + statements.push(self.assigner.simple_assign_statement(identifier, value)); + } + Expression::Tuple(tuple) => { + let elements = tuple.elements.into_iter().map(|element| { + match element { + Expression::Identifier(identifier) => { + let identifier = match self.consume_identifier(identifier).0 { + Expression::Identifier(identifier) => identifier, + _ => unreachable!("`self.consume_identifier` will always return an `Identifier`."), + }; + Expression::Identifier(identifier) + } + _ => unreachable!("Type checking guarantees that the tuple elements on the lhs of a `DefinitionStatement` are always be identifiers."), + } + }).collect(); + statements.push(Statement::Assign(Box::new(AssignStatement { + place: Expression::Tuple(TupleExpression { + elements, + span: Default::default() + }), + value, + span: Default::default() + }))); + } + _ => unreachable!("Type checking guarantees that the left-hand-side of a `DefinitionStatement` is an identifier or tuple."), + } self.is_lhs = false; - statements.push(self.assigner.simple_assign_statement(identifier, value)); + statements + } + + /// Consumes the expressions associated with `ExpressionStatement`, returning the simplified `ExpressionStatement`. + fn consume_expression_statement(&mut self, input: ExpressionStatement) -> Self::Output { + let mut statements = Vec::new(); + + // Extract the call expression. + let call = match input.expression { + Expression::Call(call) => call, + _ => unreachable!("Type checking guarantees that expression statements are always function calls."), + }; + + // Process the arguments, accumulating any statements produced. + let arguments = call + .arguments + .into_iter() + .map(|argument| { + let (argument, mut stmts) = self.consume_expression(argument); + statements.append(&mut stmts); + argument + }) + .collect(); + + // Create and accumulate the new expression statement. + // Note that we do not create a new assignment for the call expression; this is necessary for correct code generation. + statements.push(Statement::Expression(ExpressionStatement { + expression: Expression::Call(CallExpression { + function: call.function, + arguments, + external: call.external, + span: call.span, + }), + span: input.span, + })); statements } diff --git a/compiler/passes/src/symbol_table/variable_symbol.rs b/compiler/passes/src/symbol_table/variable_symbol.rs index 50f3343f65..7255ddeeb0 100644 --- a/compiler/passes/src/symbol_table/variable_symbol.rs +++ b/compiler/passes/src/symbol_table/variable_symbol.rs @@ -20,7 +20,7 @@ use leo_ast::{Mode, Type}; use leo_span::Span; /// An enumeration of the different types of variable type. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VariableType { Const, Input(Mode), diff --git a/compiler/passes/src/type_checking/check_expressions.rs b/compiler/passes/src/type_checking/check_expressions.rs index aa03326e81..c9d94e0e98 100644 --- a/compiler/passes/src/type_checking/check_expressions.rs +++ b/compiler/passes/src/type_checking/check_expressions.rs @@ -627,11 +627,9 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> { fn visit_tuple(&mut self, input: &'a TupleExpression, expected: &Self::AdditionalInput) -> Self::Output { match input.elements.len() { - 0 => Some(self.assert_and_return_type(Type::Unit, expected, input.span())), - 1 => self.visit_expression(&input.elements[0], expected), + 0 | 1 => unreachable!("Parsing guarantees that tuple expressions have at least two elements."), _ => { // Check the expected tuple types if they are known. - if let Some(Type::Tuple(expected_types)) = expected { // Check actual length is equal to expected length. if expected_types.len() != input.elements.len() { @@ -646,6 +644,10 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> { .iter() .zip(input.elements.iter()) .for_each(|(expected, expr)| { + // Check that the component expression is not a tuple. + if matches!(expr, Expression::Tuple(_)) { + self.emit_err(TypeCheckerError::nested_tuple_expression(expr.span())) + } self.visit_expression(expr, &Some(expected.clone())); }); @@ -706,4 +708,14 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> { } } } + + fn visit_unit(&mut self, input: &'a UnitExpression, _additional: &Self::AdditionalInput) -> Self::Output { + // Unit expression are only allowed inside a return statement. + if !self.is_return { + self.emit_err(TypeCheckerError::unit_expression_only_in_return_statements( + input.span(), + )); + } + Some(Type::Unit) + } } diff --git a/compiler/passes/src/type_checking/check_program.rs b/compiler/passes/src/type_checking/check_program.rs index f8a092acbd..ae4fcc4f76 100644 --- a/compiler/passes/src/type_checking/check_program.rs +++ b/compiler/passes/src/type_checking/check_program.rs @@ -24,6 +24,7 @@ use leo_span::sym; use std::collections::HashSet; // TODO: Generally, cleanup tyc logic. +// TODO: Cleanup logic for tuples. impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { fn visit_program(&mut self, input: &'a Program) { @@ -83,10 +84,10 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { fn visit_struct(&mut self, input: &'a Struct) { // Check for conflicting struct/record member names. let mut used = HashSet::new(); + // TODO: Better span to target duplicate member. if !input.members.iter().all(|Member { identifier, type_ }| { - // TODO: Better spans. - // Check that the member types are valid. - self.assert_type_is_valid(input.span, type_); + // Check that the member types are defined. + self.assert_type_is_defined(type_, identifier.span); used.insert(identifier.name) }) { self.emit_err(if input.is_record { @@ -124,8 +125,13 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { } for Member { identifier, type_ } in input.members.iter() { - // Ensure there are no tuple typed members. - self.assert_not_tuple(identifier.span, type_); + // Check that the member type is not a tuple. + if matches!(type_, Type::Tuple(_)) { + self.emit_err(TypeCheckerError::composite_data_type_cannot_contain_tuple( + if input.is_record { "record" } else { "struct" }, + identifier.span, + )); + } // Ensure that there are no record members. self.assert_member_is_not_record(identifier.span, input.identifier.name, type_); } @@ -133,7 +139,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { fn visit_mapping(&mut self, input: &'a Mapping) { // Check that a mapping's key type is valid. - self.assert_type_is_valid(input.span, &input.key_type); + self.assert_type_is_defined(&input.key_type, input.span); // Check that a mapping's key type is not tuple types or mapping types. match input.key_type { Type::Tuple(_) => self.emit_err(TypeCheckerError::invalid_mapping_type("key", "tuple", input.span)), @@ -143,7 +149,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { } // Check that a mapping's value type is valid. - self.assert_type_is_valid(input.span, &input.value_type); + self.assert_type_is_defined(&input.value_type, input.span); // Check that a mapping's value type is not tuple types or mapping types. match input.value_type { Type::Tuple(_) => self.emit_err(TypeCheckerError::invalid_mapping_type("value", "tuple", input.span)), @@ -157,6 +163,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { // Check that the function's annotations are valid. // Note that Leo does not natively support any specific annotations. for annotation in function.annotations.iter() { + // TODO: Change to compiler warning. self.emit_err(TypeCheckerError::unknown_annotation(annotation, annotation.span)) } @@ -188,9 +195,12 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { // Type check the function's parameters. function.input.iter().for_each(|input_var| { - // Check that the type of input parameter is valid. - self.assert_type_is_valid(input_var.span(), &input_var.type_()); - self.assert_not_tuple(input_var.span(), &input_var.type_()); + // Check that the type of input parameter is defined. + self.assert_type_is_defined(&input_var.type_(), input_var.span()); + // Check that the type of the input parameter is not a tuple. + if matches!(input_var.type_(), Type::Tuple(_)) { + self.emit_err(TypeCheckerError::function_cannot_take_tuple_as_input(input_var.span())) + } match self.is_transition_function { // If the function is a transition function, then check that the parameter mode is not a constant. @@ -218,14 +228,20 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { }); // Type check the function's return type. + // Note that checking that each of the component types are defined is sufficient to check that `output_type` is defined. function.output.iter().for_each(|output_type| { match output_type { + // TODO: Verify that this is not needed when the import system is updated. Output::External(_) => {} // Do not type check external record function outputs. Output::Internal(output_type) => { - // Check that the type of output is valid. - self.assert_type_is_valid(output_type.span, &output_type.type_); - + // Check that the type of output is defined. + self.assert_type_is_defined(&output_type.type_, output_type.span); + // Check that the type of the output is not a tuple. This is necessary to forbid nested tuples. + if matches!(&output_type.type_, Type::Tuple(_)) { + self.emit_err(TypeCheckerError::nested_tuple_type(output_type.span)) + } // Check that the mode of the output is valid. + // For functions, only public and private outputs are allowed if output_type.mode == Mode::Const { self.emit_err(TypeCheckerError::cannot_have_constant_output_mode(output_type.span)); } @@ -235,9 +251,6 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { self.visit_block(&function.block); - // Check that the return type is valid. - self.assert_type_is_valid(function.span, &function.output_type); - // If the function has a return type, then check that it has a return. if function.output_type != Type::Unit && !self.has_return { self.emit_err(TypeCheckerError::missing_return(function.span)); @@ -279,15 +292,16 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { let scope_index = self.create_child_scope(); finalize.input.iter().for_each(|input_var| { - // Check that the type of input parameter is valid. - self.assert_type_is_valid(input_var.span(), &input_var.type_()); - self.assert_not_tuple(input_var.span(), &input_var.type_()); - + // Check that the type of input parameter is defined. + self.assert_type_is_defined(&input_var.type_(), input_var.span()); + // Check that the type of input parameter is not a tuple. + if matches!(input_var.type_(), Type::Tuple(_)) { + self.emit_err(TypeCheckerError::finalize_cannot_take_tuple_as_input(input_var.span())) + } // Check that the input parameter is not constant or private. if input_var.mode() == Mode::Const || input_var.mode() == Mode::Private { self.emit_err(TypeCheckerError::finalize_input_mode_must_be_public(input_var.span())); } - // Check for conflicting variable names. if let Err(err) = self.symbol_table.borrow_mut().insert_variable( input_var.identifier().name, @@ -302,17 +316,24 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { }); // Type check the function's return type. + // Note that checking that each of the component types are defined is sufficient to guarantee that the `output_type` is defined. finalize.output.iter().for_each(|output_type| { - // Check that the type of output is valid. - self.assert_type_is_valid(output_type.span(), &output_type.type_()); - + // Check that the type of output is defined. + self.assert_type_is_defined(&output_type.type_(), output_type.span()); + // Check that the type of the output is not a tuple. This is necessary to forbid nested tuples. + if matches!(&output_type.type_(), Type::Tuple(_)) { + self.emit_err(TypeCheckerError::nested_tuple_type(output_type.span())) + } // Check that the mode of the output is valid. - if output_type.mode() == Mode::Const { - self.emit_err(TypeCheckerError::finalize_input_mode_must_be_public(output_type.span())); + // Note that a finalize block can have only public outputs. + if matches!(output_type.mode(), Mode::Const | Mode::Private) { + self.emit_err(TypeCheckerError::finalize_output_mode_must_be_public( + output_type.span(), + )); } }); - // TODO: Remove when this restriction is removed. + // TODO: Remove if this restriction is relaxed at Aleo instructions level. // Check that the finalize block is not empty. if finalize.block.statements.is_empty() { self.emit_err(TypeCheckerError::finalize_block_must_not_be_empty(finalize.span)); @@ -321,8 +342,8 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { // Type check the finalize block. self.visit_block(&finalize.block); - // Check that the return type is valid. - self.assert_type_is_valid(finalize.span, &finalize.output_type); + // Check that the return type is defined. Note that the component types are already checked. + self.assert_type_is_defined(&finalize.output_type, finalize.span); // If the function has a return type, then check that it has a return. if finalize.output_type != Type::Unit && !self.has_return { diff --git a/compiler/passes/src/type_checking/check_statements.rs b/compiler/passes/src/type_checking/check_statements.rs index e5eba82cc3..f5c429b279 100644 --- a/compiler/passes/src/type_checking/check_statements.rs +++ b/compiler/passes/src/type_checking/check_statements.rs @@ -15,9 +15,11 @@ // along with the Leo library. If not, see . use crate::{TypeChecker, VariableSymbol, VariableType}; +use itertools::Itertools; use leo_ast::*; use leo_errors::TypeCheckerError; +use leo_span::{Span, Symbol}; impl<'a> StatementVisitor<'a> for TypeChecker<'a> { fn visit_statement(&mut self, input: &'a Statement) { @@ -34,6 +36,7 @@ impl<'a> StatementVisitor<'a> for TypeChecker<'a> { Statement::Console(stmt) => self.visit_console(stmt), Statement::Decrement(stmt) => self.visit_decrement(stmt), Statement::Definition(stmt) => self.visit_definition(stmt), + Statement::Expression(stmt) => self.visit_expression_statement(stmt), Statement::Finalize(stmt) => self.visit_finalize(stmt), Statement::Increment(stmt) => self.visit_increment(stmt), Statement::Iteration(stmt) => self.visit_iteration(stmt), @@ -186,20 +189,87 @@ impl<'a> StatementVisitor<'a> for TypeChecker<'a> { VariableType::Mut }; - // Check that the type of the definition is valid. - self.assert_type_is_valid(input.span, &input.type_); + // Check that the type of the definition is defined. + self.assert_type_is_defined(&input.type_, input.span); + // Check that the type of the definition is not a unit type, singleton tuple type, or nested tuple type. + match &input.type_ { + // If the type is an empty tuple, return an error. + Type::Unit => self.emit_err(TypeCheckerError::lhs_must_be_identifier_or_tuple(input.span)), + // If the type is a singleton tuple, return an error. + Type::Tuple(tuple) => match tuple.len() { + 0 | 1 => unreachable!("Parsing guarantees that tuple types have at least two elements."), + _ => { + if tuple.iter().any(|type_| matches!(type_, Type::Tuple(_))) { + self.emit_err(TypeCheckerError::nested_tuple_type(input.span)) + } + } + }, + Type::Mapping(_) | Type::Err => unreachable!(), + // Otherwise, the type is valid. + _ => (), // Do nothing + } + + // Check the expression on the left-hand side. self.visit_expression(&input.value, &Some(input.type_.clone())); - if let Err(err) = self.symbol_table.borrow_mut().insert_variable( - input.variable_name.name, - VariableSymbol { - type_: input.type_.clone(), - span: input.span(), - declaration, - }, - ) { - self.handler.emit_err(err); + // TODO: Dedup with unrolling pass. + // Helper to insert the variables into the symbol table. + let insert_variable = |symbol: Symbol, type_: Type, span: Span, declaration: VariableType| { + if let Err(err) = self.symbol_table.borrow_mut().insert_variable( + symbol, + VariableSymbol { + type_, + span, + declaration, + }, + ) { + self.handler.emit_err(err); + } + }; + + // Insert the variables in the into the symbol table. + match &input.place { + Expression::Identifier(identifier) => { + insert_variable(identifier.name, input.type_.clone(), identifier.span, declaration) + } + Expression::Tuple(tuple_expression) => { + let tuple_type = match &input.type_ { + Type::Tuple(tuple_type) => tuple_type, + _ => unreachable!( + "Type checking guarantees that if the lhs is a tuple, its associated type is also a tuple." + ), + }; + tuple_expression + .elements + .iter() + .zip_eq(tuple_type.0.iter()) + .for_each(|(expression, type_)| { + let identifier = match expression { + Expression::Identifier(identifier) => identifier, + _ => { + return self.emit_err(TypeCheckerError::lhs_tuple_element_must_be_an_identifier( + expression.span(), + )) + } + }; + insert_variable(identifier.name, type_.clone(), identifier.span, declaration) + }); + } + _ => self.emit_err(TypeCheckerError::lhs_must_be_identifier_or_tuple(input.place.span())), + } + } + + fn visit_expression_statement(&mut self, input: &'a ExpressionStatement) { + // Expression statements can only be function calls. + if !matches!(input.expression, Expression::Call(_)) { + self.emit_err(TypeCheckerError::expression_statement_must_be_function_call( + input.span(), + )); + } else { + // Check the expression. + // TODO: Should the output type be restricted to unit types? + self.visit_expression(&input.expression, &None); } } @@ -239,6 +309,12 @@ impl<'a> StatementVisitor<'a> for TypeChecker<'a> { .iter() .zip(input.arguments.iter()) .for_each(|(expected, argument)| { + // Check that none of the arguments are tuple expressions. + if matches!(argument, Expression::Tuple(_)) { + self.emit_err(TypeCheckerError::finalize_statement_cannot_contain_tuples( + argument.span(), + )); + } self.visit_expression(argument, &Some(expected.type_())); }); } @@ -351,8 +427,23 @@ impl<'a> StatementVisitor<'a> for TypeChecker<'a> { false => f.output_type.clone(), }); + // Set the `has_return` flag. self.has_return = true; + // Check that the return expression is not a nested tuple. + if let Expression::Tuple(TupleExpression { elements, .. }) = &input.expression { + for element in elements { + if matches!(element, Expression::Tuple(_)) { + self.emit_err(TypeCheckerError::nested_tuple_expression(element.span())); + } + } + } + + // Set the `is_return` flag. + self.is_return = true; + // Type check the associated expression. self.visit_expression(&input.expression, return_type); + // Unset the `is_return` flag. + self.is_return = false; } } diff --git a/compiler/passes/src/type_checking/checker.rs b/compiler/passes/src/type_checking/checker.rs index 2ebda3353f..9aeadc05e2 100644 --- a/compiler/passes/src/type_checking/checker.rs +++ b/compiler/passes/src/type_checking/checker.rs @@ -41,6 +41,8 @@ pub struct TypeChecker<'a> { pub(crate) is_finalize: bool, /// Whether or not we are currently traversing an imported program. pub(crate) is_imported: bool, + /// Whether or not we are currently traversing a return statement. + pub(crate) is_return: bool, } const BOOLEAN_TYPE: Type = Type::Boolean; @@ -98,6 +100,7 @@ impl<'a> TypeChecker<'a> { has_finalize: false, is_finalize: false, is_imported: false, + is_return: false, } } @@ -355,13 +358,6 @@ impl<'a> TypeChecker<'a> { Type::Identifier(struct_) } - /// Emits an error if the type is a tuple. - pub(crate) fn assert_not_tuple(&self, span: Span, type_: &Type) { - if matches!(type_, Type::Tuple(_)) { - self.emit_err(TypeCheckerError::tuple_not_allowed(span)) - } - } - /// Emits an error if the struct member is a record type. pub(crate) fn assert_member_is_not_record(&self, span: Span, parent: Symbol, type_: &Type) { match type_ { @@ -387,8 +383,8 @@ impl<'a> TypeChecker<'a> { } } - /// Emits an error if the type is not valid. - pub(crate) fn assert_type_is_valid(&self, span: Span, type_: &Type) { + /// Emits an error if the type or its constituent types are not defined. + pub(crate) fn assert_type_is_defined(&self, type_: &Type, span: Span) { match type_ { // String types are temporarily disabled. Type::String => { @@ -401,13 +397,13 @@ impl<'a> TypeChecker<'a> { // Check that the constituent types of the tuple are valid. Type::Tuple(tuple_type) => { for type_ in tuple_type.iter() { - self.assert_type_is_valid(span, type_) + self.assert_type_is_defined(type_, span) } } // Check that the constituent types of mapping are valid. Type::Mapping(mapping_type) => { - self.assert_type_is_valid(span, &mapping_type.key); - self.assert_type_is_valid(span, &mapping_type.value); + self.assert_type_is_defined(&mapping_type.key, span); + self.assert_type_is_defined(&mapping_type.value, span); } _ => {} // Do nothing. } diff --git a/compiler/span/src/source_map.rs b/compiler/span/src/source_map.rs index 289bd65f75..31d6098437 100644 --- a/compiler/span/src/source_map.rs +++ b/compiler/span/src/source_map.rs @@ -412,8 +412,7 @@ fn analyze_source_file(src: &str, source_file_start_pos: BytePos) -> (Vec (u8, u8, Data) { + let extra: Extra = Extra { c: a }; + let data: Data = Data { a: a, b: b, c: extra }; + if (a == b) { + return (a, b, data); + } + let c: u8 = a + b; + let d: u8 = a - b; + + return (c, d, data); + } + + transition bar(flag1: bool, flag2: bool, a: u8, b: u8) -> (u8, u8, Data) { + let start: (u8, u8, Data) = foo(a, b); + if flag1 { + start = foo(start.0, start.2.c.c); + } else { + + if flag2 { + start = foo(start.1, start.2.b); + } else { + start = foo(start.2.a, start.1); + } + + } + return start; + } +} diff --git a/tests/compiler/statements/expr_statement.leo b/tests/compiler/statements/expr_statement.leo new file mode 100644 index 0000000000..1ddc97354a --- /dev/null +++ b/tests/compiler/statements/expr_statement.leo @@ -0,0 +1,16 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + + function foo(a: u8, b: u8) -> () { + console.assert_eq(a, b); + } + + transition main(a: u8, b: u8) -> u8 { + foo(a, b); + return a + b; + } +} diff --git a/tests/compiler/statements/expr_statement_fail.leo b/tests/compiler/statements/expr_statement_fail.leo new file mode 100644 index 0000000000..6368d01f27 --- /dev/null +++ b/tests/compiler/statements/expr_statement_fail.leo @@ -0,0 +1,26 @@ +/* +namespace: Compile +expectation: Fail +*/ + +program test.aleo { + + struct Foo { + a: u8, + } + + transition foo(flag: bool, a: u8, b: u8, foo: Foo, i: i8) -> u8 { + a + b; + flag ? a : b; + foo.a; + Foo { + a: a, + }; + a; + 1u8; + -i8; + (); + return a + b; + } + +} diff --git a/tests/compiler/tuple/access_negative_fail.leo b/tests/compiler/tuple/access_negative_fail.leo index f93669fdc1..8260143db4 100644 --- a/tests/compiler/tuple/access_negative_fail.leo +++ b/tests/compiler/tuple/access_negative_fail.leo @@ -10,4 +10,5 @@ program test.aleo { let t: (bool, bool) = (a, b); return (t.0, t.-1); // Index `t.-1` is invalid. - }} + } +} diff --git a/tests/compiler/tuple/access_out_of_bounds_fail.leo b/tests/compiler/tuple/access_out_of_bounds_fail.leo index c98beda8d5..a18b575822 100644 --- a/tests/compiler/tuple/access_out_of_bounds_fail.leo +++ b/tests/compiler/tuple/access_out_of_bounds_fail.leo @@ -10,4 +10,5 @@ program test.aleo { let t: (bool, bool) = (a, b); return (t.0, t.2); // Index `t.2` is out of bounds. - }} + } +} diff --git a/tests/compiler/tuple/assign_unit_fail.leo b/tests/compiler/tuple/assign_unit_fail.leo new file mode 100644 index 0000000000..0409a4dfc5 --- /dev/null +++ b/tests/compiler/tuple/assign_unit_fail.leo @@ -0,0 +1,20 @@ +/* +namespace: Compile +expectation: Fail +*/ + +program test.aleo { + + transition foo(a: u8) -> u8 { + let b: () = (); + return a + a; + } + + transition baz(a: u8) -> u8 { + let b: () = bar(); + return a + a; + } + + transition bar(a: u8) -> () {} +} + diff --git a/tests/compiler/tuple/declare_fail.leo b/tests/compiler/tuple/declare_fail.leo index 5bc012a322..34c32dcc21 100644 --- a/tests/compiler/tuple/declare_fail.leo +++ b/tests/compiler/tuple/declare_fail.leo @@ -6,8 +6,9 @@ input_file: */ program test.aleo { - function main(a: bool, b: bool) -> (bool, bool) { + transition main(a: bool, b: bool) -> (bool, bool) { let t: (bool, bool) = (a, 1u64); // We should be declaring to a boolean, not a u64. return (t.0, t.1); - }} + } +} diff --git a/tests/compiler/tuple/function_call_returns_tuple.leo b/tests/compiler/tuple/function_call_returns_tuple.leo new file mode 100644 index 0000000000..782e6b721a --- /dev/null +++ b/tests/compiler/tuple/function_call_returns_tuple.leo @@ -0,0 +1,26 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + function foo(a: u8, b: u8) -> (u8, u8) { + if (a == b) { + return (a, b); + } + let c: u8 = a + b; + let d: u8 = a - b; + return (c, d); + } + + transition bar(flag: bool, a: u8, b: u8) -> (u8, u8) { + let start: (u8, u8) = foo(a, b); + if flag { + start = foo(start.0, start.1); + } else { + + start = foo(start.1, start.0); + } + return start; + } +} diff --git a/tests/compiler/tuple/function_early_return.leo b/tests/compiler/tuple/function_early_return.leo index d7fbee7dfd..841549e788 100644 --- a/tests/compiler/tuple/function_early_return.leo +++ b/tests/compiler/tuple/function_early_return.leo @@ -13,4 +13,5 @@ program test.aleo { let c: u8 = a + b; let d: u8 = a - b; return (c, d); - }} + } +} diff --git a/tests/compiler/tuple/function_return.leo b/tests/compiler/tuple/function_return.leo index 17793170b1..e45dad1c1e 100644 --- a/tests/compiler/tuple/function_return.leo +++ b/tests/compiler/tuple/function_return.leo @@ -8,4 +8,5 @@ input_file: program test.aleo { transition main(a: u8, b: u8) -> (u8, u8) { return (a + b, b + a); - }} + } +} diff --git a/tests/compiler/tuple/function_return_nothing.leo b/tests/compiler/tuple/function_return_nothing.leo new file mode 100644 index 0000000000..cb92529803 --- /dev/null +++ b/tests/compiler/tuple/function_return_nothing.leo @@ -0,0 +1,12 @@ +/* +namespace: Compile +expectation: Pass +input_file: + - inputs/bool_bool.in +*/ + +program test.aleo { + transition main(a: bool, b: bool) -> () { + return; + } +} diff --git a/tests/compiler/tuple/function_return_single_fail.leo b/tests/compiler/tuple/function_return_single_fail.leo index 84973c071e..5d4b45ca92 100644 --- a/tests/compiler/tuple/function_return_single_fail.leo +++ b/tests/compiler/tuple/function_return_single_fail.leo @@ -6,6 +6,11 @@ input_file: */ program test.aleo { - function main(a: bool, b: bool) -> (bool) { + transition main(a: bool, b: bool) -> (bool) { return (a); - }} + } + + transition foo(a: bool, b: bool) -> (bool) { + return (b,); + } +} diff --git a/tests/compiler/tuple/function_return_unit.leo b/tests/compiler/tuple/function_return_unit.leo new file mode 100644 index 0000000000..4369e13fb8 --- /dev/null +++ b/tests/compiler/tuple/function_return_unit.leo @@ -0,0 +1,12 @@ +/* +namespace: Compile +expectation: Pass +input_file: + - inputs/bool_bool.in +*/ + +program test.aleo { + transition main(a: bool, b: bool) -> () { + return (); + } +} diff --git a/tests/compiler/tuple/function_return_varying_modes.leo b/tests/compiler/tuple/function_return_varying_modes.leo new file mode 100644 index 0000000000..c1dbdaff18 --- /dev/null +++ b/tests/compiler/tuple/function_return_varying_modes.leo @@ -0,0 +1,10 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + transition main(a: u8, b: u8) -> (public u8, u8) { + return (a + b, b + a); + } +} diff --git a/tests/compiler/tuple/function_return_zero_fail.leo b/tests/compiler/tuple/function_return_zero_fail.leo deleted file mode 100644 index 5b1a2acef4..0000000000 --- a/tests/compiler/tuple/function_return_zero_fail.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: Compile -expectation: Fail -input_file: - - inputs/bool_bool.in -*/ - -program test.aleo { - function main(a: bool, b: bool) -> () { - return (); - }} diff --git a/tests/compiler/tuple/function_unit_input_fail.leo b/tests/compiler/tuple/function_unit_input_fail.leo new file mode 100644 index 0000000000..a3a86678e2 --- /dev/null +++ b/tests/compiler/tuple/function_unit_input_fail.leo @@ -0,0 +1,17 @@ +/* +namespace: Compile +expectation: Fail +*/ + +program test.aleo { + function foo(a: ()) -> u8 { + console.assert_eq(1u8, 2u8); + return 3u8; + } + + transition bar(a: u8, b: u8) -> u8 { + foo(()); + return a + b; + } + +} diff --git a/tests/compiler/tuple/return_statement_fail.leo b/tests/compiler/tuple/return_statement_fail.leo index e4aa267853..60d6c40941 100644 --- a/tests/compiler/tuple/return_statement_fail.leo +++ b/tests/compiler/tuple/return_statement_fail.leo @@ -6,8 +6,9 @@ input_file: */ program test.aleo { - function main(a: bool, b: bool) -> (bool, u64) { + transition main(a: bool, b: bool) -> (bool, u64) { let t: (bool, bool) = (a, b); return (t.0, t.1); // The second element should be type u64 as in the function declaration. - }} + } +} diff --git a/tests/compiler/tuple/return_with_different_modes.leo b/tests/compiler/tuple/return_with_different_modes.leo new file mode 100644 index 0000000000..afc14bac32 --- /dev/null +++ b/tests/compiler/tuple/return_with_different_modes.leo @@ -0,0 +1,10 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + transition main(a: u8, b: u8) -> (public u8, u8) { + return (a + b, b + a); + } +} diff --git a/tests/compiler/tuple/singleton_tuple_fail.leo b/tests/compiler/tuple/singleton_tuple_fail.leo new file mode 100644 index 0000000000..6f12b5700c --- /dev/null +++ b/tests/compiler/tuple/singleton_tuple_fail.leo @@ -0,0 +1,15 @@ +/* +namespace: Compile +expectation: Fail +*/ + +// TODO: Compilation should pass, but warnings should be emitted. + +program test.aleo { + transition foo(a: u8, b: u8) -> u8 { + let c: (u8) = (a); + let d: (u8) = (3u8 + 4u8); + return a + b; + } +} + diff --git a/tests/compiler/tuple/tuple_access.leo b/tests/compiler/tuple/tuple_access.leo new file mode 100644 index 0000000000..988ac705a9 --- /dev/null +++ b/tests/compiler/tuple/tuple_access.leo @@ -0,0 +1,14 @@ +/* +namespace: Compile +expectation: Pass +*/ + + +program test.aleo { + transition baz(foo: u8, bar: u8) -> u8 { + let a: (u8, u8) = (foo, bar); + let result: u8 = a.0 + a.1; + return result; + } +} + diff --git a/tests/compiler/tuple/tuple_destructure.leo b/tests/compiler/tuple/tuple_destructure.leo new file mode 100644 index 0000000000..f79b182281 --- /dev/null +++ b/tests/compiler/tuple/tuple_destructure.leo @@ -0,0 +1,18 @@ +/* +namespace: Compile +expectation: Pass +*/ + + +program test.aleo { + function bax(baq: u8) -> (u8, u8) { + return (baq + baq, baq * baq); + } + + transition baz(foo: u8, bar: u8) -> u8 { + let (a, b): (u8, u8) = (foo, bar); + let (c, d): (u8, u8) = bax(bar); + let result: u8 = a + b + c + d; + return result; + } +} diff --git a/tests/compiler/tuple/tuple_in_assignment.leo b/tests/compiler/tuple/tuple_in_assignment.leo new file mode 100644 index 0000000000..91565a8d34 --- /dev/null +++ b/tests/compiler/tuple/tuple_in_assignment.leo @@ -0,0 +1,13 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + transition baz(foo: u8, bar: u16) -> u8 { + let a: (u8, u16) = (foo, bar); + a = (3u8, 4u16); + return 1u8 + 1u8; + } +} + diff --git a/tests/compiler/tuple/tuple_in_definition.leo b/tests/compiler/tuple/tuple_in_definition.leo new file mode 100644 index 0000000000..056ada89a1 --- /dev/null +++ b/tests/compiler/tuple/tuple_in_definition.leo @@ -0,0 +1,12 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + transition baz() -> u8 { + let a: (u8, u16) = (1u8, 2u16); + return 1u8 + 1u8; + } +} + diff --git a/tests/compiler/tuple/tuple_in_function_param.leo b/tests/compiler/tuple/tuple_in_function_param.leo new file mode 100644 index 0000000000..b6a0ca5a7a --- /dev/null +++ b/tests/compiler/tuple/tuple_in_function_param.leo @@ -0,0 +1,11 @@ +/* +namespace: Compile +expectation: Fail +*/ + +program test.aleo { + transition foo(a: (u8, u16)) -> (u8, u16) { + return a; + } +} + diff --git a/tests/compiler/tuple/tuple_in_loop.leo b/tests/compiler/tuple/tuple_in_loop.leo new file mode 100644 index 0000000000..c82ff6d68b --- /dev/null +++ b/tests/compiler/tuple/tuple_in_loop.leo @@ -0,0 +1,17 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + transition foo(a: u8, b: u8, flag: bool) -> u8 { + let start: (u8, u8) = (a, b); + for i: u8 in 0u8..16u8 { + start = (start.0 + start.1, start.1 + 1u8); + if flag { + start = (start.1, start.0 + start.0); + } + } + return start.0 + start.1; + } +} diff --git a/tests/compiler/tuple/tuple_in_record_fail.leo b/tests/compiler/tuple/tuple_in_record_fail.leo new file mode 100644 index 0000000000..befebdff66 --- /dev/null +++ b/tests/compiler/tuple/tuple_in_record_fail.leo @@ -0,0 +1,13 @@ +/* +namespace: Compile +expectation: Fail +*/ + +program test.aleo { + record Token { + owner: address, + gates: u64, + amounts: (u64, u64), + } +} + diff --git a/tests/compiler/tuple/tuple_in_return_type.leo b/tests/compiler/tuple/tuple_in_return_type.leo new file mode 100644 index 0000000000..c560bed85f --- /dev/null +++ b/tests/compiler/tuple/tuple_in_return_type.leo @@ -0,0 +1,11 @@ +/* +namespace: Compile +expectation: Fail +*/ + +program test.aleo { + transition bar(a: u8) -> (u8, (u8, u8)) { + return (a, (a + a, a * a)); + } +} + diff --git a/tests/compiler/tuple/tuple_in_struct_fail.leo b/tests/compiler/tuple/tuple_in_struct_fail.leo new file mode 100644 index 0000000000..f6367efb7a --- /dev/null +++ b/tests/compiler/tuple/tuple_in_struct_fail.leo @@ -0,0 +1,15 @@ +/* +namespace: Compile +expectation: Fail +*/ + +program test.aleo { + struct A { + mem: (u8, u16) + } + + struct B { + mems: (A, A) + } +} + diff --git a/tests/compiler/tuple/tuple_not_allowed.leo b/tests/compiler/tuple/tuple_not_allowed_fail.leo similarity index 100% rename from tests/compiler/tuple/tuple_not_allowed.leo rename to tests/compiler/tuple/tuple_not_allowed_fail.leo diff --git a/tests/compiler/tuple/type_fail.leo b/tests/compiler/tuple/type_fail.leo index 3d16c23043..6c13134b6b 100644 --- a/tests/compiler/tuple/type_fail.leo +++ b/tests/compiler/tuple/type_fail.leo @@ -6,8 +6,9 @@ input_file: */ program test.aleo { - function main(a: bool, b: bool) -> (bool, bool) { + transition main(a: bool, b: bool) -> (bool, bool) { let t: (bool, u64) = (a, b); // We should expect a boolean, not a u64. return (t.0, t.1); - }} + } +} diff --git a/tests/compiler/tuple/unit.leo b/tests/compiler/tuple/unit.leo new file mode 100644 index 0000000000..d902f64743 --- /dev/null +++ b/tests/compiler/tuple/unit.leo @@ -0,0 +1,41 @@ +/* +namespace: Compile +expectation: Pass +*/ + +program test.aleo { + + transition foo(a: u8, b: u8) -> () { + console.assert_eq(a, b); + console.assert_eq(b, a); + return (); + } + + transition bar(a: u8, b: u8) -> () { + console.assert_eq(a, b); + console.assert_eq(b, a); + return; + } + + transition baz(a: u8, b: u8) -> () { + console.assert_eq(a, b); + console.assert_eq(b, a); + } + + transition floo(a: u8, b: u8) { + console.assert_eq(a, b); + console.assert_eq(b, a); + return (); + } + + transition blar(a: u8, b: u8) { + console.assert_eq(a, b); + console.assert_eq(b, a); + return; + } + + transition blaz(a: u8, b: u8) { + console.assert_eq(a, b); + console.assert_eq(b, a); + } +} diff --git a/tests/expectations/compiler/address/binary.out b/tests/expectations/compiler/address/binary.out index bace0d89f4..ccb32eca9e 100644 --- a/tests/expectations/compiler/address/binary.out +++ b/tests/expectations/compiler/address/binary.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 30ff54da2da7a73c10f6cc96ea951755d57840fe3bcd0c9d6c68b8ed6c4024e2 - initial_ast: a4bcf661e9661a1d9981c74efaca0886dd31270a9b1a505afd9a0353d3fbef86 - unrolled_ast: a4bcf661e9661a1d9981c74efaca0886dd31270a9b1a505afd9a0353d3fbef86 + initial_ast: 328cfc8f311133cb9f2622be2f93a1b624ff7f290dae03c0c4fedd6a139770ff + unrolled_ast: 328cfc8f311133cb9f2622be2f93a1b624ff7f290dae03c0c4fedd6a139770ff ssa_ast: 798b6c449008ed6a38d603593dd3edf53aa30827e4ad2e0db6ef754999d1d807 flattened_ast: 305593c39dc0c26ccccb1ed5f1e4fdb932af847cab04990449c0193bc7a2c20f diff --git a/tests/expectations/compiler/address/branch.out b/tests/expectations/compiler/address/branch.out index e5939f7420..ebc6291572 100644 --- a/tests/expectations/compiler/address/branch.out +++ b/tests/expectations/compiler/address/branch.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 613969730f6ac4ff47e6975f79edf83ac2d5398d029657cbe28d53dd74847d1c - initial_ast: b781ab4e896a31f33b4c80137639326117147b9499f3e6d086ac5d9c495a2ac0 - unrolled_ast: b781ab4e896a31f33b4c80137639326117147b9499f3e6d086ac5d9c495a2ac0 + initial_ast: 002375784372b4d6b83e0e181998cebd7e25dca957d1c935a08f9227d21ba373 + unrolled_ast: 002375784372b4d6b83e0e181998cebd7e25dca957d1c935a08f9227d21ba373 ssa_ast: f128dc2ee3b1a636526c27b196e0b755b244cd9d8e52067541214b7909f38cf0 flattened_ast: 1675206b4e0435049515729daa4468b6d4aab041812bf20758f74b79c40259aa diff --git a/tests/expectations/compiler/address/equal.out b/tests/expectations/compiler/address/equal.out index 63029a6610..dfb799fd6c 100644 --- a/tests/expectations/compiler/address/equal.out +++ b/tests/expectations/compiler/address/equal.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 508ac917fe0d0779f2d43ae7695945dbe1fd00c457f08716dc51bbb2fe14e452 - initial_ast: f85497aee759dfa93d5e40be89ce95a3011523e2fa2ffa8c6ba23ffe50476fdc - unrolled_ast: f85497aee759dfa93d5e40be89ce95a3011523e2fa2ffa8c6ba23ffe50476fdc + initial_ast: f3e09111dcb009c66349bd98ad3ff8bebf753a184e2dafff711a521a43b3b2fc + unrolled_ast: f3e09111dcb009c66349bd98ad3ff8bebf753a184e2dafff711a521a43b3b2fc ssa_ast: fda8333d6142536467e05fb5129198882eb028e6a2c0c6ed1d2339b9a716aba1 flattened_ast: ab7783ad36c7540c555836b66e7c6b07f7681824dfcb58d5bbd3f0ea5fbf6bbd diff --git a/tests/expectations/compiler/address/ternary.out b/tests/expectations/compiler/address/ternary.out index 0fbcf51cce..5434640c76 100644 --- a/tests/expectations/compiler/address/ternary.out +++ b/tests/expectations/compiler/address/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 64247a73944a1639b17e3fd8ae0777b6725a754160afb476f9b0b6b8495d9884 - initial_input_ast: 9546ede7c01cbe3a4cbedf2296fbc6605f657c2e1843e8f50ef683bc3eedd18a - initial_ast: c21c646c2e7f7b776a057934e4893c2411259c7cd94061dd8006a0ed284ba669 - unrolled_ast: c21c646c2e7f7b776a057934e4893c2411259c7cd94061dd8006a0ed284ba669 + initial_ast: 1baa54d7c29ab84a48f3d52359d0a7c64a3929fd6c3975afe375d8c7c8420da7 + unrolled_ast: 1baa54d7c29ab84a48f3d52359d0a7c64a3929fd6c3975afe375d8c7c8420da7 ssa_ast: 38d2140f8bc0308859260c927be943d2671ce80eb9ef4c22b42a4090ffab9728 flattened_ast: a0e0a2c74ebd61346d568368f55cacaa7417070467925dbfc10754b5c1fa4437 diff --git a/tests/expectations/compiler/boolean/operator_methods.out b/tests/expectations/compiler/boolean/operator_methods.out index 7d2bc2b3cf..d50929c603 100644 --- a/tests/expectations/compiler/boolean/operator_methods.out +++ b/tests/expectations/compiler/boolean/operator_methods.out @@ -7,7 +7,7 @@ outputs: - initial_input_ast: 0451346a1d2b8c41fd8d6e016a3fc18a61229489550227f58f359ff06332e7b7 - initial_input_ast: 5ccafdeac9624b759f4fd6897adbec48d73986d63247fbbadbffa3cf84470674 - initial_input_ast: ff196123ef62fc63cd552315d870c2407c085734c28fd440be7a1a0bb0dc114e - initial_ast: 5c952bb0bbe8a3847db42d4e4f5f4d7aac86ad3cbc48f6899971d5b3dea7d8cb - unrolled_ast: 5c952bb0bbe8a3847db42d4e4f5f4d7aac86ad3cbc48f6899971d5b3dea7d8cb + initial_ast: 1c81e28b5e127045508de4847ae63f322bbe7099d259e517dca07468873a19e3 + unrolled_ast: 1c81e28b5e127045508de4847ae63f322bbe7099d259e517dca07468873a19e3 ssa_ast: 8d96cba8107bd0d1a71cd355a9b1aa46f18b5ed45ee874315ef97e29e305bb2d flattened_ast: 4dce24b3f5f0df6010c894eda15c02dcef029a04bd0048b30ff70e6647b986d1 diff --git a/tests/expectations/compiler/core/algorithms/bhp1024_commit.out b/tests/expectations/compiler/core/algorithms/bhp1024_commit.out index d22a3ae554..87d86ded52 100644 --- a/tests/expectations/compiler/core/algorithms/bhp1024_commit.out +++ b/tests/expectations/compiler/core/algorithms/bhp1024_commit.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: a30505e4422e13fcbf395f44b70bfd5fbe3a59c5328814405df5cfeaab639d55 - initial_ast: 81312b812ffd99514218a2b97a285a071355acd771dd73da553716d4a6088a24 - unrolled_ast: 81312b812ffd99514218a2b97a285a071355acd771dd73da553716d4a6088a24 + initial_ast: a7d914dc1bcd9c5db46a6c8eca1210a5fbe19634f5d753aceac23d498679d3d2 + unrolled_ast: a7d914dc1bcd9c5db46a6c8eca1210a5fbe19634f5d753aceac23d498679d3d2 ssa_ast: 3bf4465fa7037bae8c4ddf07fd4a1a67e72558865b22fe4e1108a6d00d11fa75 flattened_ast: efd6c65caf99fb00467b08626d3aaa8bc93186e8424fc5c23610ecf6a9c7dae2 diff --git a/tests/expectations/compiler/core/algorithms/bhp1024_hash.out b/tests/expectations/compiler/core/algorithms/bhp1024_hash.out index 561d39de75..d7d1135862 100644 --- a/tests/expectations/compiler/core/algorithms/bhp1024_hash.out +++ b/tests/expectations/compiler/core/algorithms/bhp1024_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9df63ce5d0366e8ba31fb07e696dc2e67f64371f629c66d3a9ddb715c923692e - initial_ast: b8769ff525e6f258bb27fe13eb1c0828f5ceaee62f2bc0a5537dbd6e26dbf5a3 - unrolled_ast: b8769ff525e6f258bb27fe13eb1c0828f5ceaee62f2bc0a5537dbd6e26dbf5a3 + initial_ast: 69b992df47acf68e90bd8b613e60212d16172e8edeedb0f4b4b39353c38adc61 + unrolled_ast: 69b992df47acf68e90bd8b613e60212d16172e8edeedb0f4b4b39353c38adc61 ssa_ast: 04ed79c5f4a1faf52032b353d8f8297a467d8e02ed447f7f81e393b3ddf24ed3 flattened_ast: 0c95bcbb644f61776a20fb9b885b6cb48f9adb552192d7acf5a80670ccde21e0 diff --git a/tests/expectations/compiler/core/algorithms/bhp256_commit.out b/tests/expectations/compiler/core/algorithms/bhp256_commit.out index 8e3ac4db53..39a86e46d6 100644 --- a/tests/expectations/compiler/core/algorithms/bhp256_commit.out +++ b/tests/expectations/compiler/core/algorithms/bhp256_commit.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 81e7b4b48e21c631f656aa65b6d19ebb7d784b43229356b918f908a046734261 - initial_ast: 8e87f090c0609b94b233cfb06a5e04668522a1d64ee3df7690da3626dd7de722 - unrolled_ast: 8e87f090c0609b94b233cfb06a5e04668522a1d64ee3df7690da3626dd7de722 + initial_ast: 953d5e9d7689faeea239ad13c6653805e1a13281f3ac3f37dbea106449d23a5f + unrolled_ast: 953d5e9d7689faeea239ad13c6653805e1a13281f3ac3f37dbea106449d23a5f ssa_ast: 232eaa57f15cacf6dc99d9a0599915b1adee632e5de070dfa6c5aa9e117e5d61 flattened_ast: 0e223b52044c42ab29c340998ee76946a5ebcab27b7311c19b26b2072276b3c5 diff --git a/tests/expectations/compiler/core/algorithms/bhp256_hash.out b/tests/expectations/compiler/core/algorithms/bhp256_hash.out index 1f1e611263..5580b1c13c 100644 --- a/tests/expectations/compiler/core/algorithms/bhp256_hash.out +++ b/tests/expectations/compiler/core/algorithms/bhp256_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 3cb982a5d4144e548fca897ceb686ad1f638971bb22fff7b935363eacc1b3473 - initial_ast: 0409d264a9e7132f14f312781b404b0a4ba7a9835af7145bd82e74e90f20dba7 - unrolled_ast: 0409d264a9e7132f14f312781b404b0a4ba7a9835af7145bd82e74e90f20dba7 + initial_ast: 4407c172fe97be9aa387a6fd94549386e803dfd7b8a83ca0936279b853fd1312 + unrolled_ast: 4407c172fe97be9aa387a6fd94549386e803dfd7b8a83ca0936279b853fd1312 ssa_ast: 7801e83d9bc93fa26a769c94cc7a08b8676f761869da8e6ca4523e5d144cb5e6 flattened_ast: 2bbafd8b601c9475cb180e254dabbf08a2d9da07c63cadd6b21252a38e4129c5 diff --git a/tests/expectations/compiler/core/algorithms/bhp512_commit.out b/tests/expectations/compiler/core/algorithms/bhp512_commit.out index a9ae3be727..cdf462ae38 100644 --- a/tests/expectations/compiler/core/algorithms/bhp512_commit.out +++ b/tests/expectations/compiler/core/algorithms/bhp512_commit.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 81e7b4b48e21c631f656aa65b6d19ebb7d784b43229356b918f908a046734261 - initial_ast: f6dd9e4cab9891cb96d73505558bb9294dcff1756ebee57fb6c44c3424bce63d - unrolled_ast: f6dd9e4cab9891cb96d73505558bb9294dcff1756ebee57fb6c44c3424bce63d + initial_ast: ad1967ac1c839fae18c5c7a46a3f1a038d7f6379662ce73b5ff81838e9fecb06 + unrolled_ast: ad1967ac1c839fae18c5c7a46a3f1a038d7f6379662ce73b5ff81838e9fecb06 ssa_ast: 3d812d01adde60b0a3201ecea2ac6e3b8589ed5b9a00994522835a579c11af55 flattened_ast: 2ad8be7ffefae31b19fbb3cddc9f7c3615225185b54d2c20e6456fe9d8502614 diff --git a/tests/expectations/compiler/core/algorithms/bhp512_hash.out b/tests/expectations/compiler/core/algorithms/bhp512_hash.out index 8fd390fa02..d5b8761b42 100644 --- a/tests/expectations/compiler/core/algorithms/bhp512_hash.out +++ b/tests/expectations/compiler/core/algorithms/bhp512_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 3cb982a5d4144e548fca897ceb686ad1f638971bb22fff7b935363eacc1b3473 - initial_ast: 302d16dc5e96221e8a683499eb9535d643ab076d99e0cd8a4b7eccff7f1d89b6 - unrolled_ast: 302d16dc5e96221e8a683499eb9535d643ab076d99e0cd8a4b7eccff7f1d89b6 + initial_ast: d2dc132a022976ed2e21401d332b4ea766426097eb1be7e33082473ade6e4d95 + unrolled_ast: d2dc132a022976ed2e21401d332b4ea766426097eb1be7e33082473ade6e4d95 ssa_ast: fd34527ae5871a81df9dc16df2e5030f0195cffdf6dea4f78ed19aedea6da621 flattened_ast: 151a5163d81bdd8d15ad4af804e3a8b6e8ed6e5c97fd7470a13c83b68f979d6c diff --git a/tests/expectations/compiler/core/algorithms/bhp768_commit.out b/tests/expectations/compiler/core/algorithms/bhp768_commit.out index b6781919c8..efb6075f58 100644 --- a/tests/expectations/compiler/core/algorithms/bhp768_commit.out +++ b/tests/expectations/compiler/core/algorithms/bhp768_commit.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 81e7b4b48e21c631f656aa65b6d19ebb7d784b43229356b918f908a046734261 - initial_ast: c7837681390498ab152504151a8aca4b46618e4c035b9b265bc6937ef55224e8 - unrolled_ast: c7837681390498ab152504151a8aca4b46618e4c035b9b265bc6937ef55224e8 + initial_ast: b8c180b1cead8f5d3aa420e03dc135e2c82220c31e3d46cb31a3a3377d8322ab + unrolled_ast: b8c180b1cead8f5d3aa420e03dc135e2c82220c31e3d46cb31a3a3377d8322ab ssa_ast: 70f05a3e659eb20d8e605e1c9b91338ee90c123f7453a240bf1a3950e5815042 flattened_ast: d54cbd75ce1a0d7e6dd679659ccd4307f77bffc19f6234415225df9bcef09879 diff --git a/tests/expectations/compiler/core/algorithms/bhp768_hash.out b/tests/expectations/compiler/core/algorithms/bhp768_hash.out index 37d4a3e6e2..30ec27f7e5 100644 --- a/tests/expectations/compiler/core/algorithms/bhp768_hash.out +++ b/tests/expectations/compiler/core/algorithms/bhp768_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 3cb982a5d4144e548fca897ceb686ad1f638971bb22fff7b935363eacc1b3473 - initial_ast: 1aabdddc327e544526ccdeba2f44080b544ee07f2374eca4fea4dad7ff6b54ad - unrolled_ast: 1aabdddc327e544526ccdeba2f44080b544ee07f2374eca4fea4dad7ff6b54ad + initial_ast: aaa2271be04607379f94fb121c50c8990d4a0b68ba5257220102db26b91a0f14 + unrolled_ast: aaa2271be04607379f94fb121c50c8990d4a0b68ba5257220102db26b91a0f14 ssa_ast: de05aeb7675088006960519444a10897077b9080ebe1ce5e6e3f2439536101c5 flattened_ast: ba2389349ba5155169389732da800d08def0aa26882c6a0a93e8fab257dc9a2b diff --git a/tests/expectations/compiler/core/algorithms/pedersen128_commit.out b/tests/expectations/compiler/core/algorithms/pedersen128_commit.out index 13bf885651..ae99cb9259 100644 --- a/tests/expectations/compiler/core/algorithms/pedersen128_commit.out +++ b/tests/expectations/compiler/core/algorithms/pedersen128_commit.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 46d3cef7b6dd6e951fe93d550206bdd658d6d435f71c776a39ae3b443770d33d - initial_ast: 54cff476c6e46b52a00015597c70c32f23cecae6e3086d167c26ef26820f6577 - unrolled_ast: 54cff476c6e46b52a00015597c70c32f23cecae6e3086d167c26ef26820f6577 + initial_ast: cad5c306b9b28181bd6b0c6b2eed216219ebcb60b96554c11bdd241b226aaf73 + unrolled_ast: cad5c306b9b28181bd6b0c6b2eed216219ebcb60b96554c11bdd241b226aaf73 ssa_ast: 1b2af30d0034ea32bd630884142157796f6c8f8f9e2ef7e9701ed62a2f92424b flattened_ast: c100fdd0403a9d8d6a38609d37f4e36ce54e3d6257db1d19d1e973274326906b diff --git a/tests/expectations/compiler/core/algorithms/pedersen128_hash.out b/tests/expectations/compiler/core/algorithms/pedersen128_hash.out index 7ac3b03221..78d83df6d6 100644 --- a/tests/expectations/compiler/core/algorithms/pedersen128_hash.out +++ b/tests/expectations/compiler/core/algorithms/pedersen128_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 7155146c3f0887e6298bfabe9cad16d78c150419e8d0d584616d5dd76c5c3bac - initial_ast: 8c9dfdb9055c528b1656ae95fc7763c79d3399127c49c22be15c716ad8b80b88 - unrolled_ast: 8c9dfdb9055c528b1656ae95fc7763c79d3399127c49c22be15c716ad8b80b88 + initial_ast: 9a4877e6514d54a55c8a76dbd4de9e27d43d137477c7d93470d45a61f6017861 + unrolled_ast: 9a4877e6514d54a55c8a76dbd4de9e27d43d137477c7d93470d45a61f6017861 ssa_ast: 44237ce1986b38c34c5d2a624676e64c53257648436d82b9d333d6ab0c37102d flattened_ast: c5d401aa71f99eabd1db84264069cb3a904019b93282296020a4e2db537cbcba diff --git a/tests/expectations/compiler/core/algorithms/pedersen64_commit.out b/tests/expectations/compiler/core/algorithms/pedersen64_commit.out index 1372cdfdd5..90ba70eb3a 100644 --- a/tests/expectations/compiler/core/algorithms/pedersen64_commit.out +++ b/tests/expectations/compiler/core/algorithms/pedersen64_commit.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 591fe9942b59bad76b636a1c9e6ebe93ad85df562b09b7a900acfe12a9caffe2 - initial_ast: c1a7388455ac3e97ca3a063ad7812ff3ee27be822768d35a03ab608b1648c2d1 - unrolled_ast: c1a7388455ac3e97ca3a063ad7812ff3ee27be822768d35a03ab608b1648c2d1 + initial_ast: 3c9a4fde69b75a022863bb1f29026bc4fdac5eca0ad0ec5e3ecb7364e7a17499 + unrolled_ast: 3c9a4fde69b75a022863bb1f29026bc4fdac5eca0ad0ec5e3ecb7364e7a17499 ssa_ast: 4f51f745379cb8078a6512104b27f778d6a36cd4bc92e6e06b74f95d8204ba37 flattened_ast: 1fd5c458c8f61a818f6409f20e430c37d7a9d4a1aceae7a96b370fa9dca03c94 diff --git a/tests/expectations/compiler/core/algorithms/pedersen64_hash.out b/tests/expectations/compiler/core/algorithms/pedersen64_hash.out index 37bb5b58c8..18b0472ae2 100644 --- a/tests/expectations/compiler/core/algorithms/pedersen64_hash.out +++ b/tests/expectations/compiler/core/algorithms/pedersen64_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 6b64b3a4fd7cafc2ead15efb8a91f8fc102947ccf4c091e4b6e54df82811fe82 - initial_ast: 784374ed8ef0e9feae88329064908c5dab22ee9c7f5828e09f4980ca862e372a - unrolled_ast: 784374ed8ef0e9feae88329064908c5dab22ee9c7f5828e09f4980ca862e372a + initial_ast: 2ef0225f6f5b08bec4cbac785f486c667251c285c2e3e221c63cd2d9d8c4d240 + unrolled_ast: 2ef0225f6f5b08bec4cbac785f486c667251c285c2e3e221c63cd2d9d8c4d240 ssa_ast: 406dfc7b88282780532453da30e06d04fb6398fbb5f8934aa6951bc57e785af2 flattened_ast: 0ab17f84c7bb560a48f49bce7e29384f3439028f2fcb55f93649fa7e615a66fa diff --git a/tests/expectations/compiler/core/algorithms/poseidon2_hash.out b/tests/expectations/compiler/core/algorithms/poseidon2_hash.out index dcdf676394..7ea6c28f01 100644 --- a/tests/expectations/compiler/core/algorithms/poseidon2_hash.out +++ b/tests/expectations/compiler/core/algorithms/poseidon2_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 1e9c68e82f6c0dc9eaa4babbc5cb9e46d79f8f0661607b48efd2e9870a636f33 - initial_ast: afc9c5673e33e40261e666fb353fcb5632f4b2fec015be8689d4e55efca47907 - unrolled_ast: afc9c5673e33e40261e666fb353fcb5632f4b2fec015be8689d4e55efca47907 + initial_ast: a5f32b136e224ace47e695dacb7d481975a343cdcd5b822652b8ce4bace9bdc4 + unrolled_ast: a5f32b136e224ace47e695dacb7d481975a343cdcd5b822652b8ce4bace9bdc4 ssa_ast: cfbd02fec7cde8cb7de3cabe033207e0aa025d0c1eadf5b27f4aeff4b2f48c30 flattened_ast: c86be4a932e4a91d25b8cca98ebadb1875d30a7409585b1cbeab3c7bf511e7fa diff --git a/tests/expectations/compiler/core/algorithms/poseidon4_hash.out b/tests/expectations/compiler/core/algorithms/poseidon4_hash.out index 92400f1f9c..78511f8544 100644 --- a/tests/expectations/compiler/core/algorithms/poseidon4_hash.out +++ b/tests/expectations/compiler/core/algorithms/poseidon4_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 1e9c68e82f6c0dc9eaa4babbc5cb9e46d79f8f0661607b48efd2e9870a636f33 - initial_ast: 86b9e70b72058d64fb1461e72d9be08e9a9c776feae3233ae3aac7c947bd5726 - unrolled_ast: 86b9e70b72058d64fb1461e72d9be08e9a9c776feae3233ae3aac7c947bd5726 + initial_ast: 95f0769ebd6f1f6170771b5b4a2a8f333577f285531e64a3c2899e022d83b26c + unrolled_ast: 95f0769ebd6f1f6170771b5b4a2a8f333577f285531e64a3c2899e022d83b26c ssa_ast: 535712b468cd7472f115e1a3a4edd8e8e57ab80afb8fbb5922fcf0e41af9c6ee flattened_ast: 3843c47a4d735398cbdda45f1815a14fce9e83dcab0cc318b1f11b5b21d95a39 diff --git a/tests/expectations/compiler/core/algorithms/poseidon8_hash.out b/tests/expectations/compiler/core/algorithms/poseidon8_hash.out index e3f9f5756a..499b4cca5c 100644 --- a/tests/expectations/compiler/core/algorithms/poseidon8_hash.out +++ b/tests/expectations/compiler/core/algorithms/poseidon8_hash.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 1e9c68e82f6c0dc9eaa4babbc5cb9e46d79f8f0661607b48efd2e9870a636f33 - initial_ast: a2e29f76757bd9ca5ede2fbcb1383e3f6bddc809b870637db0e3e53f644de255 - unrolled_ast: a2e29f76757bd9ca5ede2fbcb1383e3f6bddc809b870637db0e3e53f644de255 + initial_ast: 08935ec63b16ea46fdc71ecf009d17664e1df123a7b8927933ecb8b6ebcc84d3 + unrolled_ast: 08935ec63b16ea46fdc71ecf009d17664e1df123a7b8927933ecb8b6ebcc84d3 ssa_ast: 05f1c0703a0987f866b19bcbc72a1e1cf4d7253a1fc75b1474b9f49aafb26cc4 flattened_ast: 699fdee0dcb831f86fb19c14b4f0387aec3ddfe4c6658a77e3cc7b450cc30e15 diff --git a/tests/expectations/compiler/field/field.out b/tests/expectations/compiler/field/field.out index 38bd29660d..2025094b8b 100644 --- a/tests/expectations/compiler/field/field.out +++ b/tests/expectations/compiler/field/field.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9dff7172de13bf9c5c1bf0e225ebb3132da11ea695a97692edacd36b18e5d86c - initial_ast: 67395cdd81b7d95fe82ae4c021fb24f68cbf7b6c34f70210dba63e812611b7f2 - unrolled_ast: 67395cdd81b7d95fe82ae4c021fb24f68cbf7b6c34f70210dba63e812611b7f2 + initial_ast: efb41e70f83aa7e2d78fe401a2515f43840c2679c46dd8556315a736414c68d8 + unrolled_ast: efb41e70f83aa7e2d78fe401a2515f43840c2679c46dd8556315a736414c68d8 ssa_ast: 03c6805324171292b0291c7578681fa9a4c69e06a5463693ffc12984806e0e29 flattened_ast: 45786b6a26579552c3b7142eec3cd0dc87d7c703ad250b7811bfdd269fc3c073 diff --git a/tests/expectations/compiler/field/operator_methods.out b/tests/expectations/compiler/field/operator_methods.out index 4c96d0ae04..9323279a55 100644 --- a/tests/expectations/compiler/field/operator_methods.out +++ b/tests/expectations/compiler/field/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: a6d4afdd7375c43967b7a3be380ac83f7b1a351203a2f521ca8ce9824f29df71 - initial_ast: df6d46969b3d8046ff7ceb0c8395a5726d004b29bf7b3c22254938219809d7a7 - unrolled_ast: df6d46969b3d8046ff7ceb0c8395a5726d004b29bf7b3c22254938219809d7a7 + initial_ast: fae67b0524629123386d97abe3d416217bf3603fa7e80d7fff171188b7a9cd92 + unrolled_ast: fae67b0524629123386d97abe3d416217bf3603fa7e80d7fff171188b7a9cd92 ssa_ast: 9f1ccb67dd1845e23cc51eaa7de1fa1de0ab2035d4a14ef6290f24e8b890511b flattened_ast: 2858a14218cb5f670950c60b32dae9c579fe73638553ea3eb56cae7073fc2039 diff --git a/tests/expectations/compiler/field/pow.out b/tests/expectations/compiler/field/pow.out index 69b5267733..abb752a358 100644 --- a/tests/expectations/compiler/field/pow.out +++ b/tests/expectations/compiler/field/pow.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 4e24333952c4eaea2c19106c9651e0bef29519e51632cc17f3ba1d07123306eb - initial_ast: e4e85067d7ebcd9e8f9a075b1dbec886d9668637642b1aa15742497914633908 - unrolled_ast: e4e85067d7ebcd9e8f9a075b1dbec886d9668637642b1aa15742497914633908 + initial_ast: e545f85a38342de5173ef77a87c688a1ec6ad9964d48731c167925f68693c62e + unrolled_ast: e545f85a38342de5173ef77a87c688a1ec6ad9964d48731c167925f68693c62e ssa_ast: 61769373206b7e2a87db43b9c6e35657749a373910584e137ceee4cf175ae9b6 flattened_ast: af9344ccab440497931207afc1d7efca6f5f6591b00f468848fc6296bfa1dc89 diff --git a/tests/expectations/compiler/finalize/closure_with_finalize_fail.out b/tests/expectations/compiler/finalize/closure_with_finalize_fail.out index a3b8887354..5c0a6761fe 100644 --- a/tests/expectations/compiler/finalize/closure_with_finalize_fail.out +++ b/tests/expectations/compiler/finalize/closure_with_finalize_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372036]: Cannot use a `finalize` statement without a `finalize` block.\n --> compiler-test:5:15\n |\n 5 | async finalize(a, b);\n | ^^^^^^^^^^^^^^\nError [ETYC0372044]: Function must contain a `finalize` statement on all execution paths.\n --> compiler-test:9:5\n |\n 9 | function bar(a: u8, b: u8) -> u8 {\n 10 | return a + b;\n 11 | }\n | ^\nError [ETYC0372032]: Only transition functions can have a `finalize` block.\n --> compiler-test:13:5\n |\n 13 | finalize bar(a: u8, b: u8) -> u8 {\n 14 | return a + b;\n 15 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372032]: Only transition functions can have a `finalize` block.\n --> compiler-test:22:5\n |\n 22 | finalize mint_public(receiver: address, amount: u64) {\n 23 | increment(account, receiver, amount);\n 24 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372005]: Unknown variable `account`\n --> compiler-test:23:19\n |\n 23 | increment(account, receiver, amount);\n | ^^^^^^^\nError [ETYC0372004]: Could not determine the type of `account`\n --> compiler-test:23:19\n |\n 23 | increment(account, receiver, amount);\n | ^^^^^^^\n" + - "Error [ETYC0372036]: Cannot use a `finalize` statement without a `finalize` block.\n --> compiler-test:5:15\n |\n 5 | async finalize(a, b);\n | ^^^^^^^^^^^^^^\nError [ETYC0372044]: Function must contain a `finalize` statement on all execution paths.\n --> compiler-test:9:5\n |\n 9 | function bar(a: u8, b: u8) -> u8 {\n 10 | return a + b;\n 11 | }\n | ^\nError [ETYC0372031]: Only transition functions can have a `finalize` block.\n --> compiler-test:13:5\n |\n 13 | finalize bar(a: u8, b: u8) -> u8 {\n 14 | return a + b;\n 15 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372031]: Only transition functions can have a `finalize` block.\n --> compiler-test:22:5\n |\n 22 | finalize mint_public(receiver: address, amount: u64) {\n 23 | increment(account, receiver, amount);\n 24 | }\n | ^\n |\n = Remove the `finalize` block or use the keyword `transition` instead of `function`.\nError [ETYC0372005]: Unknown variable `account`\n --> compiler-test:23:19\n |\n 23 | increment(account, receiver, amount);\n | ^^^^^^^\nError [ETYC0372004]: Could not determine the type of `account`\n --> compiler-test:23:19\n |\n 23 | increment(account, receiver, amount);\n | ^^^^^^^\n" diff --git a/tests/expectations/compiler/finalize/finalize_incorrect_modes_fail.out b/tests/expectations/compiler/finalize/finalize_incorrect_modes_fail.out index aed1fd6b98..41e33b590f 100644 --- a/tests/expectations/compiler/finalize/finalize_incorrect_modes_fail.out +++ b/tests/expectations/compiler/finalize/finalize_incorrect_modes_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372033]: An input to a finalize block must be public.\n --> compiler-test:10:62\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^^^^\n |\n = Add a `public` modifier to the input variable declaration or remove the visibility modifier entirely.\nError [ETYC0372033]: An input to a finalize block must be public.\n --> compiler-test:10:87\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^\n |\n = Add a `public` modifier to the input variable declaration or remove the visibility modifier entirely.\nError [ETYC0372038]: Function must return a value.\n --> compiler-test:10:5\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n 11 | increment(account, receiver, amount);\n 12 | }\n | ^\n" + - "Error [ETYC0372032]: An input to a finalize block must be public.\n --> compiler-test:10:62\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^^^^\n |\n = Add a `public` modifier to the input variable declaration or remove the visibility modifier entirely.\nError [ETYC0372033]: An output of a finalize block must be public.\n --> compiler-test:10:87\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^\n |\n = Add a `public` modifier to the output type declaration or remove the visibility modifier entirely.\nError [ETYC0372038]: Function must return a value.\n --> compiler-test:10:5\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n 11 | increment(account, receiver, amount);\n 12 | }\n | ^\n" diff --git a/tests/expectations/compiler/finalize/mapping_fail.out b/tests/expectations/compiler/finalize/mapping_fail.out index 55204a4fd4..d648e9d91a 100644 --- a/tests/expectations/compiler/finalize/mapping_fail.out +++ b/tests/expectations/compiler/finalize/mapping_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:4:18\n |\n 4 | mapping foo: (u32, u32) => u32;\n | ^" + - "Error [ETYC0372030]: A mapping's key cannot be a tuple\n --> compiler-test:4:5\n |\n 4 | mapping foo: (u32, u32) => u32;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:6:5\n |\n 6 | mapping floo: baz => u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/finalize/shadow_mapping_fail.out b/tests/expectations/compiler/finalize/shadow_mapping_fail.out index e5eac30199..ae1c7a10b9 100644 --- a/tests/expectations/compiler/finalize/shadow_mapping_fail.out +++ b/tests/expectations/compiler/finalize/shadow_mapping_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372009]: struct `bar` shadowed by\n --> compiler-test:5:5\n |\n 5 | mapping bar: u8 => u8;\n | ^^^^^^^^^^^^^^^^^^^^^^\nError [EAST0372009]: struct `bar` shadowed by\n --> compiler-test:7:5\n |\n 7 | transition bar(a: u8) -> u8 {\n 8 | return a + 1u8;\n 9 | }\n | ^\n" + - "Error [EAST0372007]: struct `bar` shadowed by\n --> compiler-test:5:5\n |\n 5 | mapping bar: u8 => u8;\n | ^^^^^^^^^^^^^^^^^^^^^^\nError [EAST0372007]: struct `bar` shadowed by\n --> compiler-test:7:5\n |\n 7 | transition bar(a: u8) -> u8 {\n 8 | return a + 1u8;\n 9 | }\n | ^\n" diff --git a/tests/expectations/compiler/function/annotated_function_fail.out b/tests/expectations/compiler/function/annotated_function_fail.out index 66ebd11876..1044f1297b 100644 --- a/tests/expectations/compiler/function/annotated_function_fail.out +++ b/tests/expectations/compiler/function/annotated_function_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372028]: Unknown annotation: `@test`.\n --> compiler-test:4:5\n |\n 4 | @test\n | ^^^^^\nError [ETYC0372028]: Unknown annotation: `@program`.\n --> compiler-test:9:5\n |\n 9 | @program\n | ^^^^^^^^\n" + - "Error [ETYC0372027]: Unknown annotation: `@test`.\n --> compiler-test:4:5\n |\n 4 | @test\n | ^^^^^\nError [ETYC0372027]: Unknown annotation: `@program`.\n --> compiler-test:9:5\n |\n 9 | @program\n | ^^^^^^^^\n" diff --git a/tests/expectations/compiler/function/flatten_test.out b/tests/expectations/compiler/function/flatten_test.out index eb20f4f1d8..f7a7234bd9 100644 --- a/tests/expectations/compiler/function/flatten_test.out +++ b/tests/expectations/compiler/function/flatten_test.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 3137ced43ba99ee2f63930ef3f2921291ad12fc206872a52eaba12920524929a - unrolled_ast: 3137ced43ba99ee2f63930ef3f2921291ad12fc206872a52eaba12920524929a - ssa_ast: f9ac185f4e025eb033c2bcabf720a1360286b386bbc9ff30f73634d5a9725203 - flattened_ast: 9688131a7231b7794c6c3c29cee7d3c7c371eaf41c923a881cdeca572b03e853 + initial_ast: f237855e5889c18d9a87c930f1e0087adee8df4fdda005f0228e2c5524efd2d3 + unrolled_ast: f237855e5889c18d9a87c930f1e0087adee8df4fdda005f0228e2c5524efd2d3 + ssa_ast: 878d0180bd4671c1e316e78199016833a6d526e99e26d333d9ad9c4ab1d0bcba + flattened_ast: 66e1626e6349f9bbc258e5703e44e8b5e94bb0ae9f35846114a276e764bff2b7 diff --git a/tests/expectations/compiler/function/flatten_tuples_of_structs.out b/tests/expectations/compiler/function/flatten_tuples_of_structs.out new file mode 100644 index 0000000000..1d1a7e22ac --- /dev/null +++ b/tests/expectations/compiler/function/flatten_tuples_of_structs.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 072b212443dbc525313d0fd0ee5944d9c844e0b94f99df30f3c69272d4309099 + unrolled_ast: 072b212443dbc525313d0fd0ee5944d9c844e0b94f99df30f3c69272d4309099 + ssa_ast: 11c9c41d1950c2a3ae95b454a63e8caccccbe598f8d87c086241f77413e53416 + flattened_ast: fec064665269c22dd99c30949b759fbfb6c55b7b6042a1fc08aaa7fbdcb28913 diff --git a/tests/expectations/compiler/function/helper_function_with_interface.out b/tests/expectations/compiler/function/helper_function_with_interface.out index d5e7d10b19..9496e7ccbb 100644 --- a/tests/expectations/compiler/function/helper_function_with_interface.out +++ b/tests/expectations/compiler/function/helper_function_with_interface.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 5d71dee426542f81c8bec2e80a4b5f5f7e264bcca8449f7b7d8377a3cc8d5384 - unrolled_ast: 5d71dee426542f81c8bec2e80a4b5f5f7e264bcca8449f7b7d8377a3cc8d5384 + initial_ast: 9994f0cbf43eec59fd9dc734b1a4d69417e51c1351c2e03d57da4996b735da43 + unrolled_ast: 9994f0cbf43eec59fd9dc734b1a4d69417e51c1351c2e03d57da4996b735da43 ssa_ast: 5f0508c0a5d301e7c5e39848ed5ca004d1ed40ee616613517a0fc110773e8123 flattened_ast: 626e995bfa1c8c5ff62a4702b128a5b7fa6d200fdaa9e45ad349c06a49d92103 diff --git a/tests/expectations/compiler/function/program_function_no_constant_mode_fail.out b/tests/expectations/compiler/function/program_function_no_constant_mode_fail.out index 4d71cddee4..2905d10355 100644 --- a/tests/expectations/compiler/function/program_function_no_constant_mode_fail.out +++ b/tests/expectations/compiler/function/program_function_no_constant_mode_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372008]: function `foo` shadowed by\n --> compiler-test:7:5\n |\n 7 | transition foo(a: u8) -> constant u8 {\n 8 | return a + a;\n 9 | }\n | ^\n" + - "Error [EAST0372006]: function `foo` shadowed by\n --> compiler-test:7:5\n |\n 7 | transition foo(a: u8) -> constant u8 {\n 8 | return a + a;\n 9 | }\n | ^\n" diff --git a/tests/expectations/compiler/function/record_in_conditional_return.out b/tests/expectations/compiler/function/record_in_conditional_return.out index 613694b2fe..f87bc9e090 100644 --- a/tests/expectations/compiler/function/record_in_conditional_return.out +++ b/tests/expectations/compiler/function/record_in_conditional_return.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: b24cbee71a8cc3c995d22b70a42981906ad01c9bcdf5fed40b78ce89efd637b9 - unrolled_ast: b24cbee71a8cc3c995d22b70a42981906ad01c9bcdf5fed40b78ce89efd637b9 + initial_ast: 65ef0a8f08605b9b607d7b32712b3683f141b387d0e97b23e251e847b30684f7 + unrolled_ast: 65ef0a8f08605b9b607d7b32712b3683f141b387d0e97b23e251e847b30684f7 ssa_ast: f3434ad7e0ced5cbe25012bbcfaca888c159deb5173e148e7a851dfc0a554c90 flattened_ast: 9149b476ec91c59d8bc1d9bb9c94bc143bf9c807d831c93eeaf6f5dae7c813d0 diff --git a/tests/expectations/compiler/function/shadow_function_with_input_fail.out b/tests/expectations/compiler/function/shadow_function_with_input_fail.out index e122add535..e89def5647 100644 --- a/tests/expectations/compiler/function/shadow_function_with_input_fail.out +++ b/tests/expectations/compiler/function/shadow_function_with_input_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372008]: function `hi` shadowed by\n --> compiler-test:8:21\n |\n 8 | function tester(hi: u8) -> u8 {\n | ^^\n" + - "Error [EAST0372006]: function `hi` shadowed by\n --> compiler-test:8:21\n |\n 8 | function tester(hi: u8) -> u8 {\n | ^^\n" diff --git a/tests/expectations/compiler/function/undefined_fail.out b/tests/expectations/compiler/function/undefined_fail.out index 585bbca89e..d514b70cd1 100644 --- a/tests/expectations/compiler/function/undefined_fail.out +++ b/tests/expectations/compiler/function/undefined_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370021]: Expression statements are not supported.\n --> compiler-test:5:9\n |\n 5 | my_function();\n | ^^^^^^^^^^^^^^" + - "Error [ETYC0372005]: Unknown function `my_function`\n --> compiler-test:5:9\n |\n 5 | my_function();\n | ^^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/function/unknown_parameter_type_fail.out b/tests/expectations/compiler/function/unknown_parameter_type_fail.out index 67e62d45b4..6e9597fc92 100644 --- a/tests/expectations/compiler/function/unknown_parameter_type_fail.out +++ b/tests/expectations/compiler/function/unknown_parameter_type_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:4:28\n |\n 4 | transition main(a: u8, foo: Foo) -> u8 {\n | ^^^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:8:38\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n | ^^^\nError [ETYC0372003]: Expected type `Foo` but type `u8` was found\n --> compiler-test:9:16\n |\n 9 | return a;\n | ^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n 9 | return a;\n 10 | }}\n | ^\n" + - "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:4:28\n |\n 4 | transition main(a: u8, foo: Foo) -> u8 {\n | ^^^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:8:38\n |\n 8 | transition returns_foo(a: u8) -> Foo {\n | ^^^\nError [ETYC0372003]: Expected type `Foo` but type `u8` was found\n --> compiler-test:9:16\n |\n 9 | return a;\n | ^\n" diff --git a/tests/expectations/compiler/group/group_mul.out b/tests/expectations/compiler/group/group_mul.out index f844bfdc93..a7213d7e08 100644 --- a/tests/expectations/compiler/group/group_mul.out +++ b/tests/expectations/compiler/group/group_mul.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: d530d7963eff5ef7d1c2c2f40e26ed585da3391244bd857a61da42576e2368fd - initial_ast: ca748863847f96046db8462c3cbb5060ec449767af9ee082b10690cdf8f077c7 - unrolled_ast: ca748863847f96046db8462c3cbb5060ec449767af9ee082b10690cdf8f077c7 + initial_ast: 9f981f58d9a87cb82c93b86cebfa2a14ca36c60037739ce04c1394df44d1ac5b + unrolled_ast: 9f981f58d9a87cb82c93b86cebfa2a14ca36c60037739ce04c1394df44d1ac5b ssa_ast: 6a1473291566c71f843bb638c40e183339c66ec80172502802ac21995d0997c7 flattened_ast: 22877c98b9eee66969876c2b1b2823c850e122cd0397fbb3409ee0fcce9867db diff --git a/tests/expectations/compiler/group/operator_methods.out b/tests/expectations/compiler/group/operator_methods.out index b4041fe32e..d30ee19b39 100644 --- a/tests/expectations/compiler/group/operator_methods.out +++ b/tests/expectations/compiler/group/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 312b6355a92e2532eb3c94405d148e2ae8046ababf19ed39064addd5341ad870 - initial_ast: 71dd4c460d59490006c1349772fbc0e0077d4c99c2e3cde8f5b73b5963a48844 - unrolled_ast: 71dd4c460d59490006c1349772fbc0e0077d4c99c2e3cde8f5b73b5963a48844 + initial_ast: 8f9326bd384045bfcc414c02583e35a23cbf5ad792ea6d47ba2daaa705ee1e35 + unrolled_ast: 8f9326bd384045bfcc414c02583e35a23cbf5ad792ea6d47ba2daaa705ee1e35 ssa_ast: e2d475beca3fcca92d25ab0c6077364c7a41349d9625cc477dcec0824df16ca4 flattened_ast: 300975fa5eae3a97295101c50eea5897d566eda6e232973d53d3a492b7bb0312 diff --git a/tests/expectations/compiler/group/ternary.out b/tests/expectations/compiler/group/ternary.out index 638f1a41db..cc31a098ba 100644 --- a/tests/expectations/compiler/group/ternary.out +++ b/tests/expectations/compiler/group/ternary.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 15dd8fc332c05446df0418990c17c417db37437307b4993fb0d857550b28c11b - initial_ast: b14b2cc89b2e0a8322419f536acaa437d5c05620cb05c5e4cf5714148615b45f - unrolled_ast: b14b2cc89b2e0a8322419f536acaa437d5c05620cb05c5e4cf5714148615b45f + initial_ast: 0dd57c5b0b29b44331de209840ed90d78cca3c434eb83aefe49238d074c68966 + unrolled_ast: 0dd57c5b0b29b44331de209840ed90d78cca3c434eb83aefe49238d074c68966 ssa_ast: f8c29c9178d0560dbc54691543c44b5d4884c5a58a094c1646c33349ac229a9b flattened_ast: 8350b677e3b00865facaa6ed7debfe4fdf9a24d2686af415461f8c0e9e809c10 diff --git a/tests/expectations/compiler/group/x_and_y.out b/tests/expectations/compiler/group/x_and_y.out index c374abaf2f..8523903d3b 100644 --- a/tests/expectations/compiler/group/x_and_y.out +++ b/tests/expectations/compiler/group/x_and_y.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 53d3f9b77d0b8c3485ba7e6b3f6679105dcd42b9af36481dbe38629bb50f596f - initial_ast: 007ee08c41458f80a300a49820ecefdf0ec38a65b30f4427ad4b7304a31978c9 - unrolled_ast: 007ee08c41458f80a300a49820ecefdf0ec38a65b30f4427ad4b7304a31978c9 + initial_ast: f92de877ad1e56eb2672b89d610bdbafe9b9e8c50cd27a1fa9af56cfedf2edbd + unrolled_ast: f92de877ad1e56eb2672b89d610bdbafe9b9e8c50cd27a1fa9af56cfedf2edbd ssa_ast: a61450bd15b8174ba5598ec18e5e52cad44c3b94f484d44053175dbdddc696ca flattened_ast: 7f6383c97a4adb8be5cfd661245e7930a5d6c45e6905f9dee790cf7e1e679368 diff --git a/tests/expectations/compiler/group/x_sign_high.out b/tests/expectations/compiler/group/x_sign_high.out index 4351f626b8..33c439a039 100644 --- a/tests/expectations/compiler/group/x_sign_high.out +++ b/tests/expectations/compiler/group/x_sign_high.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: ef187d487da23e54c2fbcd54d5f49b35f4647c996fea1af047dc24c51dde9216 - initial_ast: 928b40c14c03bb0077d99b32de6a5489abdb4740e260b59c0a7dd1fab3ae47a9 - unrolled_ast: 928b40c14c03bb0077d99b32de6a5489abdb4740e260b59c0a7dd1fab3ae47a9 + initial_ast: 85fdcaf6fe41d215bf42f775b57af0799a484b817a7c631eed4ce65d20a585eb + unrolled_ast: 85fdcaf6fe41d215bf42f775b57af0799a484b817a7c631eed4ce65d20a585eb ssa_ast: 6ef1e0acb88aa066c61987908aa39e105c9efbd2aff6dda103699bc14391a20d flattened_ast: a44118e966157aee97ea8181033fdf0492bf1a7c7be1592d9a82a3ddfc42f04f diff --git a/tests/expectations/compiler/group/x_sign_inferred.out b/tests/expectations/compiler/group/x_sign_inferred.out index d83ddc89a1..4a8885fe08 100644 --- a/tests/expectations/compiler/group/x_sign_inferred.out +++ b/tests/expectations/compiler/group/x_sign_inferred.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: ef187d487da23e54c2fbcd54d5f49b35f4647c996fea1af047dc24c51dde9216 - initial_ast: 2779c75a2f0421442041da883cff0450c3624701c0ffb466ac6df7335d927d31 - unrolled_ast: 2779c75a2f0421442041da883cff0450c3624701c0ffb466ac6df7335d927d31 + initial_ast: b0f1e8b451879e23ab244c824a852940d1c2c69e84af2d6191f6b26e11e1f1c1 + unrolled_ast: b0f1e8b451879e23ab244c824a852940d1c2c69e84af2d6191f6b26e11e1f1c1 ssa_ast: 21e6cf37a86c7b83e9a71dbe8718447c3f8639233c123df309a68ae9d8438782 flattened_ast: b10e763c02fed816a6bd3dbcb83c613d951dd4da1e31cc49ec5eb3905dd4c220 diff --git a/tests/expectations/compiler/group/x_sign_low.out b/tests/expectations/compiler/group/x_sign_low.out index e1a22f92be..8940d1dea4 100644 --- a/tests/expectations/compiler/group/x_sign_low.out +++ b/tests/expectations/compiler/group/x_sign_low.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: ef187d487da23e54c2fbcd54d5f49b35f4647c996fea1af047dc24c51dde9216 - initial_ast: 77b4e5bca7f5e63c2fc0b2891663ff34f9662f5654941f39138f22c20625c00d - unrolled_ast: 77b4e5bca7f5e63c2fc0b2891663ff34f9662f5654941f39138f22c20625c00d + initial_ast: f793c32a78c38e1b107ea9da976ed749babc95db155e640996537561334e4c10 + unrolled_ast: f793c32a78c38e1b107ea9da976ed749babc95db155e640996537561334e4c10 ssa_ast: 047618042d8073437956b11b49c67ad4fd2008f45f62c2d767bc6246221fef6d flattened_ast: a7d7494f5d15164b24f12489cad4b4df0a8b066307114b736ecff0c060613a94 diff --git a/tests/expectations/compiler/group/zero.out b/tests/expectations/compiler/group/zero.out index f391abcbd1..1e0c735770 100644 --- a/tests/expectations/compiler/group/zero.out +++ b/tests/expectations/compiler/group/zero.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 01e9fbd2cc8b5f07d158f39b2b91792bbf8b3440b6a822c924fcdd4021dd3b12 - initial_ast: d8d4dbe8551ec5518ec79abdacbf8b815a7a91645fbd2760d3c1da9e42643083 - unrolled_ast: d8d4dbe8551ec5518ec79abdacbf8b815a7a91645fbd2760d3c1da9e42643083 + initial_ast: 09f2a33d431146f457930c2bcecf127354bb9cde2439cc7b1701b90b8bddf32d + unrolled_ast: 09f2a33d431146f457930c2bcecf127354bb9cde2439cc7b1701b90b8bddf32d ssa_ast: cde395271ddfce8e1be4bd0b847010a24b42f454795402ad94e83ff59296014b flattened_ast: 8a4aa7887748d4c21cf812eaee2239542afc5e789f4aeee97a218d66f607eec4 diff --git a/tests/expectations/compiler/integers/i128/console_assert.out b/tests/expectations/compiler/integers/i128/console_assert.out index 2a54753966..0f37b0265c 100644 --- a/tests/expectations/compiler/integers/i128/console_assert.out +++ b/tests/expectations/compiler/integers/i128/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: fd948adbdd5de687a000a2ba4ba163a28b51ae5ddc1f4bb8afabadb3c0a0fc65 - initial_ast: 50ea674c1e06d088210f7a33e2ab6d8c62e795837dd7780e9ed206c4bfd66abf - unrolled_ast: 50ea674c1e06d088210f7a33e2ab6d8c62e795837dd7780e9ed206c4bfd66abf + initial_ast: db9326c8866aee6ce6a7853ec99483e7fa40ebbd394a242ea6849ef0273d0391 + unrolled_ast: db9326c8866aee6ce6a7853ec99483e7fa40ebbd394a242ea6849ef0273d0391 ssa_ast: 58495c67049c4fe05ebcfaa1a54bee3a886aa70a1e81a29329075803f3b5876f flattened_ast: ccee47d7e3219e0c8c3b04598c685f461f3da7b20b7cedabcda4662db3093e59 diff --git a/tests/expectations/compiler/integers/i128/max.out b/tests/expectations/compiler/integers/i128/max.out index 7dfbc25ed4..1c8c4cea63 100644 --- a/tests/expectations/compiler/integers/i128/max.out +++ b/tests/expectations/compiler/integers/i128/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 121d3d230edf98176b85fa3d8871bec6cfcbcae1488ae6e19f5768a5dd5ceb0a - initial_ast: 229ecba6b823ba2434e3804b258cc5ecb3eec23d6dde25102c13f386247c5c1c - unrolled_ast: 229ecba6b823ba2434e3804b258cc5ecb3eec23d6dde25102c13f386247c5c1c + initial_ast: c358a937873b7707f624a342932a2a3f9335991b72d1ad5828c517eb2833deed + unrolled_ast: c358a937873b7707f624a342932a2a3f9335991b72d1ad5828c517eb2833deed ssa_ast: b67e298ac55202b4bb94af31e579393bb7673eea64decb7bc1c2f3fb436ae0cc flattened_ast: 6d06585c1e1ba14042f6dbe52eb91e19493a9b14c0769356da711b6de45bb86f diff --git a/tests/expectations/compiler/integers/i128/min.out b/tests/expectations/compiler/integers/i128/min.out index a0599bbeb8..7a8a69e4b3 100644 --- a/tests/expectations/compiler/integers/i128/min.out +++ b/tests/expectations/compiler/integers/i128/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 4fdda35493f7a160d5f65ba04f0f5d23f54679aa2732477e6bcb47ade0203fab - initial_ast: 057ca8cf8763fe405256d38571c08c62bc15513e846968a0332b0251df212b05 - unrolled_ast: 057ca8cf8763fe405256d38571c08c62bc15513e846968a0332b0251df212b05 + initial_ast: 11255e25d924c0e641f8e48a8ec7709ba095572be906a442d17518e9a8d58b29 + unrolled_ast: 11255e25d924c0e641f8e48a8ec7709ba095572be906a442d17518e9a8d58b29 ssa_ast: 480280d740c1c49ef7dd2fdcb200d5c818b4483ef1443f12289a345b51aa53ab flattened_ast: 73de1a6083a57e1b72b9cf284eb9e95ff300ccd8b2c67992241f5d8f805f731d diff --git a/tests/expectations/compiler/integers/i128/min_fail.out b/tests/expectations/compiler/integers/i128/min_fail.out index 0006b64adf..65834fbb4c 100644 --- a/tests/expectations/compiler/integers/i128/min_fail.out +++ b/tests/expectations/compiler/integers/i128/min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 170f803adc313cd27a9932eb2b62e2ab8201bab40508df920a9881a87b6a7d51 - initial_ast: e296cf93d7a63e76affe2d55b27009aa2a760d2af868f168f989e14eff26ff67 - unrolled_ast: e296cf93d7a63e76affe2d55b27009aa2a760d2af868f168f989e14eff26ff67 + initial_ast: 6689ab8048e1e3533e504ac46889df43b51cb50fb0993fc24939d8a9795a6b8c + unrolled_ast: 6689ab8048e1e3533e504ac46889df43b51cb50fb0993fc24939d8a9795a6b8c ssa_ast: 965b63d39de6fccf76dfaa04cde0d0fdc9548824135a44971d2ad524003e3593 flattened_ast: d79f205d4316ae3ea2021f0f56386a726d084924bbc68b72e75ee1ed0ccc2853 diff --git a/tests/expectations/compiler/integers/i128/negate_min_fail.out b/tests/expectations/compiler/integers/i128/negate_min_fail.out index ab88068639..5ff53edaaa 100644 --- a/tests/expectations/compiler/integers/i128/negate_min_fail.out +++ b/tests/expectations/compiler/integers/i128/negate_min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9a29dbbfa44f9ad968a66dfc44e33becc1f7a913595116a8883b0c2c31d2e7a3 - initial_ast: 78a78a2db6846159bae952d57e4115b619a87b3feda0aad1ab9dfd4c2580387c - unrolled_ast: 78a78a2db6846159bae952d57e4115b619a87b3feda0aad1ab9dfd4c2580387c + initial_ast: 4926b88fe41ef384a13a04cd61a364ab96f39b37af261fce0e89285ee4540593 + unrolled_ast: 4926b88fe41ef384a13a04cd61a364ab96f39b37af261fce0e89285ee4540593 ssa_ast: 40b24681687909639d389f6869b23a16fa39a2c4025525495815c156dcf251be flattened_ast: effd031093759a77a6148d07ef3c8a3d36199355c5b83639f330f5e9e08bcf72 diff --git a/tests/expectations/compiler/integers/i128/negate_zero.out b/tests/expectations/compiler/integers/i128/negate_zero.out index db559b506c..95b5c98c14 100644 --- a/tests/expectations/compiler/integers/i128/negate_zero.out +++ b/tests/expectations/compiler/integers/i128/negate_zero.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: c31be221fd6a6bfd1f5c45ceb3752c44e4b10bbc865f0fbe5d0c6d145fe6857b - initial_ast: 94e1bd16933a94626aceda39cc6323d76badafddb0f422a57b50d04bb1846f59 - unrolled_ast: 94e1bd16933a94626aceda39cc6323d76badafddb0f422a57b50d04bb1846f59 + initial_ast: 28826c2c01fbad376074fe079d4ba007b28ac17f341aea2ad6b7af290bf8f86a + unrolled_ast: 28826c2c01fbad376074fe079d4ba007b28ac17f341aea2ad6b7af290bf8f86a ssa_ast: c6eb5709a3aee81eafb80917a35c2e9f53dd82bbfc52df6e2d6732e436792d76 flattened_ast: 21c0c7259a728cd6073c2ba8f5ffd8a8b722b317b33f513e45a4327933a5eeca diff --git a/tests/expectations/compiler/integers/i128/operator_methods.out b/tests/expectations/compiler/integers/i128/operator_methods.out index 2ab8d279d6..0d88a97164 100644 --- a/tests/expectations/compiler/integers/i128/operator_methods.out +++ b/tests/expectations/compiler/integers/i128/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: d8676ea64f645df6652a5634ca7bf504d715d32bd1f5b9d107d63fc4ea1877f4 - initial_ast: 0e00f98c2a473c953b9a3a1fda7b83fcbd3d2ee3f8a27dd900bd30a9f7687dfc - unrolled_ast: 0e00f98c2a473c953b9a3a1fda7b83fcbd3d2ee3f8a27dd900bd30a9f7687dfc + initial_ast: cfd5c5db7db448dabaa57ebc8267d4970e11cfc2328e7dbd0fce07f4468b341e + unrolled_ast: cfd5c5db7db448dabaa57ebc8267d4970e11cfc2328e7dbd0fce07f4468b341e ssa_ast: 418640e89a86b482fa524532b4b4883fbb9266fb1e06d6ac8b2fcc327581831e flattened_ast: 93d56bd2eb7029525d384e5eb99856f2507f75fc387679327ffb0a6ba6dd2355 diff --git a/tests/expectations/compiler/integers/i128/ternary.out b/tests/expectations/compiler/integers/i128/ternary.out index 61827648f1..6ec53cb9e8 100644 --- a/tests/expectations/compiler/integers/i128/ternary.out +++ b/tests/expectations/compiler/integers/i128/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 93d3253ae5fbd7a5cb3ff2f7bf81c0f5139b5312bbdb1533f8c861654c93f574 - initial_input_ast: 35806a4ffb6e1dd4523230b0540de902b2ff712bc20199d5b51c87bbd41c1c33 - initial_ast: 627cb30fee193b73814595bf6cb8e10ea22cc8dac86599d370bd7c4583344938 - unrolled_ast: 627cb30fee193b73814595bf6cb8e10ea22cc8dac86599d370bd7c4583344938 + initial_ast: b468a260cb690990bdff8396e8604deca802ee51181c1864eef4b0b2ad53caba + unrolled_ast: b468a260cb690990bdff8396e8604deca802ee51181c1864eef4b0b2ad53caba ssa_ast: 464a1d79f703b31c73c91d4c0d8d849b5d0d043158fce511eb604c74d23dfc11 flattened_ast: 7868a79dacce408f8b84616596dfeadc32872384c05ce06993866b9d46d228aa diff --git a/tests/expectations/compiler/integers/i16/console_assert.out b/tests/expectations/compiler/integers/i16/console_assert.out index 4b592a97b0..d7eb896112 100644 --- a/tests/expectations/compiler/integers/i16/console_assert.out +++ b/tests/expectations/compiler/integers/i16/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 83b0d0ce22e667751ae91281a8dfd1291f8d1d823f5f740b2bd6abce5dbd26c3 - initial_ast: f57013d262c104d9b68ae05d6e5d0af27700cca4c5e8eb7d0953e723b4ce82be - unrolled_ast: f57013d262c104d9b68ae05d6e5d0af27700cca4c5e8eb7d0953e723b4ce82be + initial_ast: 0985ffa3c488e47be5a0ca35ba6b9dca37e91513353a6755a98fce0534ba0ec8 + unrolled_ast: 0985ffa3c488e47be5a0ca35ba6b9dca37e91513353a6755a98fce0534ba0ec8 ssa_ast: 6f94d51bc2ea6281dce9ae970becc7bcfeeedf44e80cc4eabfaaff2e8b53dcb7 flattened_ast: 8f4380ed1a7c40c88a4d6e51c04deead38354163446b9fb3ca13f2d1e9e390a9 diff --git a/tests/expectations/compiler/integers/i16/max.out b/tests/expectations/compiler/integers/i16/max.out index 7cd2712b71..8c54961e8d 100644 --- a/tests/expectations/compiler/integers/i16/max.out +++ b/tests/expectations/compiler/integers/i16/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 0667084cb065a1132f00f1d168747a840766ba22a3f337252cd1c0d3c82e9668 - initial_ast: 021ae6f5e0cb3799e0af831cb50251aa2bfb18b6e5d7d813192fdfcf188bbe10 - unrolled_ast: 021ae6f5e0cb3799e0af831cb50251aa2bfb18b6e5d7d813192fdfcf188bbe10 + initial_ast: 0a5cafd827db283ced89650bf4936614efc89d023e8933e8a5cc5c4c06bc67bd + unrolled_ast: 0a5cafd827db283ced89650bf4936614efc89d023e8933e8a5cc5c4c06bc67bd ssa_ast: 8d962eb8165dc02df8ed9a40295a0809ac92954d27c80ee61ee37920fc2fdc66 flattened_ast: e3c3267c652d694581fdaa8bf8822810412642894e78955643e223b3ca8c0931 diff --git a/tests/expectations/compiler/integers/i16/min.out b/tests/expectations/compiler/integers/i16/min.out index cbb97958fb..7f67a24985 100644 --- a/tests/expectations/compiler/integers/i16/min.out +++ b/tests/expectations/compiler/integers/i16/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 2cd7053b8ebf3f13da84e8781a0b5740657b3bcf7e1d072ac5b238b529aad73c - initial_ast: 419aa0f78027ec2ad05e5851a3787bbcb51cf9d03914fa844a75828d4fdabc97 - unrolled_ast: 419aa0f78027ec2ad05e5851a3787bbcb51cf9d03914fa844a75828d4fdabc97 + initial_ast: 288664a7f1d04160449d9f3f24a10cd8ab746d214f3187e676112938d84c7c6a + unrolled_ast: 288664a7f1d04160449d9f3f24a10cd8ab746d214f3187e676112938d84c7c6a ssa_ast: e894da3eb366749c9b47fa2724bd72fef32ad4b14e694cc4f6dec35d90734b60 flattened_ast: 8b08eb65bad62c9d7295543bd3c1b5fa5055c87c1b1be547e958f5a659d736dd diff --git a/tests/expectations/compiler/integers/i16/min_fail.out b/tests/expectations/compiler/integers/i16/min_fail.out index 6d9203e4b7..fc19415b19 100644 --- a/tests/expectations/compiler/integers/i16/min_fail.out +++ b/tests/expectations/compiler/integers/i16/min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 02c389160a9fc5cbb9562dfa3a46bd1cb083adedacca5562a38be46ed476b39e - initial_ast: 633a82e69460f4d1e735f9f8f16e791292601f93b98fc30bb6b64dc9ebc9f678 - unrolled_ast: 633a82e69460f4d1e735f9f8f16e791292601f93b98fc30bb6b64dc9ebc9f678 + initial_ast: 0992c74bfd4efb19f2a5912790e6ac7150c3a0885c50012a8822978a13b74b2e + unrolled_ast: 0992c74bfd4efb19f2a5912790e6ac7150c3a0885c50012a8822978a13b74b2e ssa_ast: 68f42e48b156b7b1ea09af978df68ea6013e9e93e3f605d6dbb6e034da35a57a flattened_ast: 44e1a1afbae654f5c5cf6641deea24f40f3a8ab13463c87d7804b7b5150db4c9 diff --git a/tests/expectations/compiler/integers/i16/negate_min_fail.out b/tests/expectations/compiler/integers/i16/negate_min_fail.out index 5a8a827ba9..4b3c0e583a 100644 --- a/tests/expectations/compiler/integers/i16/negate_min_fail.out +++ b/tests/expectations/compiler/integers/i16/negate_min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 93b05f0898e33c5b4a63709626f9e80fe11f8fc77d3005fccb9a7183149e227f - initial_ast: 799a3d881f77c32bafd2e5985faaf36b2dbaba200587ecec88723be8bf8c8a02 - unrolled_ast: 799a3d881f77c32bafd2e5985faaf36b2dbaba200587ecec88723be8bf8c8a02 + initial_ast: 0f17b1e07275e3f320ccd9c733525f6993ba123936b335d55bcacf08900ac5d5 + unrolled_ast: 0f17b1e07275e3f320ccd9c733525f6993ba123936b335d55bcacf08900ac5d5 ssa_ast: 856ebcd84d833742b8b45351fbd689add74c32bdfd2a1850ce1be413967f2eb7 flattened_ast: ab9ef6b9479ba31a31c3094724543c36e8cb6fb6303850369c145ea77b80a454 diff --git a/tests/expectations/compiler/integers/i16/negate_zero.out b/tests/expectations/compiler/integers/i16/negate_zero.out index 5f0ab179af..48b7407e68 100644 --- a/tests/expectations/compiler/integers/i16/negate_zero.out +++ b/tests/expectations/compiler/integers/i16/negate_zero.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9c3e3d08240eff67d8ec39d250ed59b8a506de6facc94ae31ba778115eb906ff - initial_ast: cf93ad1b407e2e3b1e1e3ce82f5bb6530abca0dd0457e976b073dadca9cccb33 - unrolled_ast: cf93ad1b407e2e3b1e1e3ce82f5bb6530abca0dd0457e976b073dadca9cccb33 + initial_ast: 67c08f48dc2ad8e143a70ff1ae3ae251655aee44a7693d7e9f1c4b001d35a00a + unrolled_ast: 67c08f48dc2ad8e143a70ff1ae3ae251655aee44a7693d7e9f1c4b001d35a00a ssa_ast: 73286d0d16e5f3bd599171e20b8bf7eee5f17c39939d0cb4ca9e62169ebfb4e8 flattened_ast: 7bb16f3b57902a6f8302cc1d8f5fa7b04b3d202b020a11f9cdcf081ed7c2ebae diff --git a/tests/expectations/compiler/integers/i16/operator_methods.out b/tests/expectations/compiler/integers/i16/operator_methods.out index d7d5c72fae..8fd00aa306 100644 --- a/tests/expectations/compiler/integers/i16/operator_methods.out +++ b/tests/expectations/compiler/integers/i16/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: ff2ce3a425464819132d13948a86df41352d0c5f632297d3e16e81f96a2575a5 - initial_ast: efd1f5d74cbe60d44955fd8ae33a9d9b7796e8aceacd827aaf09658b5dc0b62f - unrolled_ast: efd1f5d74cbe60d44955fd8ae33a9d9b7796e8aceacd827aaf09658b5dc0b62f + initial_ast: 667d028df97a4278a8d6694db3c77d4aaa497ff0aad507eb0c8658953b6f071b + unrolled_ast: 667d028df97a4278a8d6694db3c77d4aaa497ff0aad507eb0c8658953b6f071b ssa_ast: 1a3bbbe4e8317b12010359aadb9588c0ab0bdad805c98b0e752f231c4d064de0 flattened_ast: 1c8704cff4795101c09500802f1dee41b44216a31605df255b6c07f6e452719d diff --git a/tests/expectations/compiler/integers/i16/ternary.out b/tests/expectations/compiler/integers/i16/ternary.out index 051addefd5..f263c8170b 100644 --- a/tests/expectations/compiler/integers/i16/ternary.out +++ b/tests/expectations/compiler/integers/i16/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 4b12221625f50a37c46fce89b201b2985fff21d16e8c26f94f173e261952fa46 - initial_input_ast: 34ce45dd6c888d989524f9ec40cd5ecaeaa629faa5fee640f1a21260278f0965 - initial_ast: afaa5cea2c5c173dfd5f1eb708f31c537061092576488d4a8e19f9f393c34927 - unrolled_ast: afaa5cea2c5c173dfd5f1eb708f31c537061092576488d4a8e19f9f393c34927 + initial_ast: bb3e52306aadb1f69abcb0c4e175c1a8f4300b618e3a529342796582cff565d7 + unrolled_ast: bb3e52306aadb1f69abcb0c4e175c1a8f4300b618e3a529342796582cff565d7 ssa_ast: 8d629e8ccf26566248c299c3bf4476fa93aa623675daa1e7d75befa2a19681cf flattened_ast: 8b68c4593356b3fc8ae2ce37e28dd41ae3500f1fac4783815b765abad29333a3 diff --git a/tests/expectations/compiler/integers/i32/console_assert.out b/tests/expectations/compiler/integers/i32/console_assert.out index e868b11d39..ff1786b4d1 100644 --- a/tests/expectations/compiler/integers/i32/console_assert.out +++ b/tests/expectations/compiler/integers/i32/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: d5eff5d89b59fc926cbe281d3ce9562965b96a8492cb120e6f257aa8e0cc129a - initial_ast: 7fba6123f9a83e7554e412cbeda64b368fffa661e58478d7809f10eb22e84321 - unrolled_ast: 7fba6123f9a83e7554e412cbeda64b368fffa661e58478d7809f10eb22e84321 + initial_ast: 358f4091eadea227d1077e7d08a6d5f7aeddf12a6b74fabb98fd9bd970c19519 + unrolled_ast: 358f4091eadea227d1077e7d08a6d5f7aeddf12a6b74fabb98fd9bd970c19519 ssa_ast: 4c0cc001302bb6646c4bf059e06084245c546c302a63bd5e1e440bb4dda3f0fc flattened_ast: 620a7e8a1c3e0f05f29096f82e3c2538e0af6a56461c5c37f4f94ace63c7d421 diff --git a/tests/expectations/compiler/integers/i32/max.out b/tests/expectations/compiler/integers/i32/max.out index 38f62b5250..f8d91275b1 100644 --- a/tests/expectations/compiler/integers/i32/max.out +++ b/tests/expectations/compiler/integers/i32/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 38347cf5e03a37ac8284d28a3b003abcb6242f44349f714b0683bd5c363cfe64 - initial_ast: b1b0bc85ecb7077826b733eff5d4772b7164b456316ff87ec77927babff9ea81 - unrolled_ast: b1b0bc85ecb7077826b733eff5d4772b7164b456316ff87ec77927babff9ea81 + initial_ast: a7d0fa6649349fbabc26cbc8f212cdee93689196ce516fa179b61a55d220b336 + unrolled_ast: a7d0fa6649349fbabc26cbc8f212cdee93689196ce516fa179b61a55d220b336 ssa_ast: f82e56bbfc0a15d706ff29aae19729f7d8c3509abdf10836b263760513eee815 flattened_ast: ad56030462af16d70d9b4c5fe7074e486e31f1be5d19a149e1923deb1e20e9f8 diff --git a/tests/expectations/compiler/integers/i32/min.out b/tests/expectations/compiler/integers/i32/min.out index 1ad67cd92a..a83cc01375 100644 --- a/tests/expectations/compiler/integers/i32/min.out +++ b/tests/expectations/compiler/integers/i32/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: a08b93d004fccd4589efa8a45ec8edc42355d5e5a3adb529c789de0cd2f4036a - initial_ast: 39772b488498c264234e57c815631f80b899df4d5f35b2f5e3a4530fb5f5eea1 - unrolled_ast: 39772b488498c264234e57c815631f80b899df4d5f35b2f5e3a4530fb5f5eea1 + initial_ast: d99d00af92aeb582182f9ff72cae2d12564a53d01c97397ae9cfe813d16645a8 + unrolled_ast: d99d00af92aeb582182f9ff72cae2d12564a53d01c97397ae9cfe813d16645a8 ssa_ast: da94a8a505eb6c88b005ede61c50e219e48f3f141af6c7a22e386875cd52d190 flattened_ast: 2aa32ef973b6b8c6b3ca3011ad336a42dd8b72a28543d2e8ec90caef1b12a4f0 diff --git a/tests/expectations/compiler/integers/i32/min_fail.out b/tests/expectations/compiler/integers/i32/min_fail.out index b3c6aa0163..03d917741a 100644 --- a/tests/expectations/compiler/integers/i32/min_fail.out +++ b/tests/expectations/compiler/integers/i32/min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9466fc281de8d96e644c187821efb1c6ff0ccf4c9c1ef134afac9fd24236ceed - initial_ast: bdfabb9c2384388eb067d1058a5dee479129f63e5230fdbc8a1be731b5d8cf03 - unrolled_ast: bdfabb9c2384388eb067d1058a5dee479129f63e5230fdbc8a1be731b5d8cf03 + initial_ast: 89c9d11541ffd9ee37ecc067c1c5a967f5e906ba444da8a30844e69894510fa4 + unrolled_ast: 89c9d11541ffd9ee37ecc067c1c5a967f5e906ba444da8a30844e69894510fa4 ssa_ast: 53693373b01c5f0efbe2ababfcbb684a8c0bbf5a35c41e1bfd0ce5a84ccdce57 flattened_ast: 8f19040ce98960a3a18ff5fccdd2f0157328a689320d3d3661336d3e3efd7dff diff --git a/tests/expectations/compiler/integers/i32/negate_min_fail.out b/tests/expectations/compiler/integers/i32/negate_min_fail.out index a9f2ef36aa..b7038d10ba 100644 --- a/tests/expectations/compiler/integers/i32/negate_min_fail.out +++ b/tests/expectations/compiler/integers/i32/negate_min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 8e544d7c15b584417da4f0cd9c99ad2a027ee2f19e375bed96b13d49f96c7159 - initial_ast: 460b89a3cae47bb54562e61c289248f5db8b01f02383c174a02757de75076de1 - unrolled_ast: 460b89a3cae47bb54562e61c289248f5db8b01f02383c174a02757de75076de1 + initial_ast: 59325cabb9f0bdfd0f50bc6155a0a142825e57c0c664b1547045488b82b8435e + unrolled_ast: 59325cabb9f0bdfd0f50bc6155a0a142825e57c0c664b1547045488b82b8435e ssa_ast: 6adb68e50bf5b196b929ce11e64256eaad00732840814818a4df9ce98b0857e9 flattened_ast: 82dee3ba935b0a1f52a0e1aad0e2ce03fde12a5fbd3405e1b515c68feaab81ea diff --git a/tests/expectations/compiler/integers/i32/negate_zero.out b/tests/expectations/compiler/integers/i32/negate_zero.out index e01997f8a3..aae5a20895 100644 --- a/tests/expectations/compiler/integers/i32/negate_zero.out +++ b/tests/expectations/compiler/integers/i32/negate_zero.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9c3e3d08240eff67d8ec39d250ed59b8a506de6facc94ae31ba778115eb906ff - initial_ast: bfadd968f3af926e5f51140e825097782d18a109b3e3f58705e32e27799be42a - unrolled_ast: bfadd968f3af926e5f51140e825097782d18a109b3e3f58705e32e27799be42a + initial_ast: 425afa3a2abef685ff95b184fbb787e0b9a622635aabab7db1e0ef92db6f8188 + unrolled_ast: 425afa3a2abef685ff95b184fbb787e0b9a622635aabab7db1e0ef92db6f8188 ssa_ast: f5121917e5a09185ee6fc74c4da86d71effee9ca4029987d213366cbe323f1d5 flattened_ast: 9366ee060031c3238fccca2b7b8ef6f9515cfd06d88d1e5a4ff4a0dffcd037cf diff --git a/tests/expectations/compiler/integers/i32/operator_methods.out b/tests/expectations/compiler/integers/i32/operator_methods.out index 80d7198950..aeadef8caf 100644 --- a/tests/expectations/compiler/integers/i32/operator_methods.out +++ b/tests/expectations/compiler/integers/i32/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 01fb90fd1f6c85944f4593466f31cae9bfe10f8b79994bec1bd6f697d9689940 - initial_ast: c48c65dd90d9b0e47a85d8631e0340a1c6da3983cfd8a41daebda302bd5e8a35 - unrolled_ast: c48c65dd90d9b0e47a85d8631e0340a1c6da3983cfd8a41daebda302bd5e8a35 + initial_ast: c0758ca5b0b10ac0a21d8bcb76bacb563badf104dca7c52bdd62fa5b4520198f + unrolled_ast: c0758ca5b0b10ac0a21d8bcb76bacb563badf104dca7c52bdd62fa5b4520198f ssa_ast: 29e608be37bdb807b3e96436254410a2023f418f8b0e5d242e7c6743dc6af9ab flattened_ast: 16a9adf039d53339a6263c940bdcfedb9f981c135864940c9e93b0a9c7ca6656 diff --git a/tests/expectations/compiler/integers/i32/ternary.out b/tests/expectations/compiler/integers/i32/ternary.out index ed000e5a03..77e0aacf10 100644 --- a/tests/expectations/compiler/integers/i32/ternary.out +++ b/tests/expectations/compiler/integers/i32/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 26d74294a98e17aae6b3c34a958339ae165c9a7479dc1a49dfd3f2603482b489 - initial_input_ast: 2a2521c9ce0dd30a9d445359538ed84f5bf10d6a8586c8d03635deba6360523c - initial_ast: 889946392684ac95fb45006e0c1e20e8d7e4eee63558d6c24c30bbc98b1cf1e1 - unrolled_ast: 889946392684ac95fb45006e0c1e20e8d7e4eee63558d6c24c30bbc98b1cf1e1 + initial_ast: b5e50a535d46f77a9a1046d1c601ca7a29a0eb46a7a949c60ae1efd6625b36e9 + unrolled_ast: b5e50a535d46f77a9a1046d1c601ca7a29a0eb46a7a949c60ae1efd6625b36e9 ssa_ast: 5a45e7bca3e5cbbaab54722f15e1d1682c8afe9e11bd4e685af45ac286277037 flattened_ast: 5753e0324e050042d53f9b0fc55029556d1d0772ed0f2da14e4575139b2b1473 diff --git a/tests/expectations/compiler/integers/i64/console_assert.out b/tests/expectations/compiler/integers/i64/console_assert.out index 63812fbb6a..3f980550a3 100644 --- a/tests/expectations/compiler/integers/i64/console_assert.out +++ b/tests/expectations/compiler/integers/i64/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 255e901028eebc10b8653b7bb448553de33ad2357bd21186d5f345583c09851a - initial_ast: 8c09675b244668c7959e3e987849383c774744e02d231016ebeb908e2ec4e5fb - unrolled_ast: 8c09675b244668c7959e3e987849383c774744e02d231016ebeb908e2ec4e5fb + initial_ast: 6eb32c4959ac3c4c6a003f277cecad8f79f2fc57ac38e0f6e0a31964a7e757a6 + unrolled_ast: 6eb32c4959ac3c4c6a003f277cecad8f79f2fc57ac38e0f6e0a31964a7e757a6 ssa_ast: b0c6633888628e5568f86e23f9555fbf782004ad568ee29ae7da499348fd7585 flattened_ast: 97bdc9acb78fbbe8298721a2f2eab2ee0ca3302c644e29876d0aa3f0158bfb57 diff --git a/tests/expectations/compiler/integers/i64/max.out b/tests/expectations/compiler/integers/i64/max.out index 7d98b36f18..7ce78d1f22 100644 --- a/tests/expectations/compiler/integers/i64/max.out +++ b/tests/expectations/compiler/integers/i64/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 26b351d76478e50404e762564f70833cf77cd7216f2652da821994790e1201f1 - initial_ast: ffc17bf5103c633d102ce4d7bb9be4cbc5851465630b298e7abc273a40357ce3 - unrolled_ast: ffc17bf5103c633d102ce4d7bb9be4cbc5851465630b298e7abc273a40357ce3 + initial_ast: a78d9fc00be59a1789834a90bfa213acd87398000095758736792ff70cd40c11 + unrolled_ast: a78d9fc00be59a1789834a90bfa213acd87398000095758736792ff70cd40c11 ssa_ast: b1a5a9c7995751798d98b6c5f483050ba57d3cbfe3dccf4c9ec998d8dec355c2 flattened_ast: fde085344356c11af7c3c52fc809512596fa73d7c00b26b89f204d54d9d811c3 diff --git a/tests/expectations/compiler/integers/i64/min.out b/tests/expectations/compiler/integers/i64/min.out index 2fdfddabea..58984c8a8f 100644 --- a/tests/expectations/compiler/integers/i64/min.out +++ b/tests/expectations/compiler/integers/i64/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: d3b2d2d48471f1552d70e643d52187398e67f52aa60c3cc23b8af1baa5b640ea - initial_ast: 090219d669d6861114ecf0a171ab7b9d1c645a56d017a89fa1042022c736d2b3 - unrolled_ast: 090219d669d6861114ecf0a171ab7b9d1c645a56d017a89fa1042022c736d2b3 + initial_ast: a5e0097d53c07abd3fcf69425b214be863fe7b02be8069a7e65a7d516a57d98f + unrolled_ast: a5e0097d53c07abd3fcf69425b214be863fe7b02be8069a7e65a7d516a57d98f ssa_ast: c309b7f99695d34281ab8af9181760f2d26209be007c9c9148c8420dc198c4a0 flattened_ast: d1310aed0514b0503b4598d599512cbb2731d4e52bcc3b33e967da1a9ac54025 diff --git a/tests/expectations/compiler/integers/i64/min_fail.out b/tests/expectations/compiler/integers/i64/min_fail.out index fb9afec8d0..e4fd9ecaa4 100644 --- a/tests/expectations/compiler/integers/i64/min_fail.out +++ b/tests/expectations/compiler/integers/i64/min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: ccf014934a20ad3560a15490112b54a3b05b41a933d6a6d9c8d43908230e84a3 - initial_ast: 731ff713921889f47d23160035e1fb53e690faa227dcacad41bd2be0591d5724 - unrolled_ast: 731ff713921889f47d23160035e1fb53e690faa227dcacad41bd2be0591d5724 + initial_ast: fccdf39afb711c5469273a6a9633db18e758637a218314d4fda58f984b3b1289 + unrolled_ast: fccdf39afb711c5469273a6a9633db18e758637a218314d4fda58f984b3b1289 ssa_ast: 51d5cb3257778e0d71de586d46b0b62b43e1a92d41ba4fbe99d38744dcca7593 flattened_ast: 6f1c25a2e082e82e38e2ca9ca181d4565312fa9d1b0da860d4b089148c267d37 diff --git a/tests/expectations/compiler/integers/i64/negate_min_fail.out b/tests/expectations/compiler/integers/i64/negate_min_fail.out index fc11097ce8..54652e0cae 100644 --- a/tests/expectations/compiler/integers/i64/negate_min_fail.out +++ b/tests/expectations/compiler/integers/i64/negate_min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 28ad696a5fec9df3cef03e907efc35c5f9d81f43c13fe0fc5680f665d80eb4df - initial_ast: 3c2217b7a378992a865f769ccda19edc0444172bbcf7bfa0dd610c14806ba01a - unrolled_ast: 3c2217b7a378992a865f769ccda19edc0444172bbcf7bfa0dd610c14806ba01a + initial_ast: b5c70c3c4dbe67fa42643614e798d2e9a4c0aab2bcabcf3a8e6d9a6e6f26dab6 + unrolled_ast: b5c70c3c4dbe67fa42643614e798d2e9a4c0aab2bcabcf3a8e6d9a6e6f26dab6 ssa_ast: b5732df353f268923042c30603aa826c0f9a1064bb26cfba35ed64d6ddf53bb3 flattened_ast: c474005e4027bc336a9c65dc5c7ba3addd3cfd8999ab1d91b6f3f10dd537e741 diff --git a/tests/expectations/compiler/integers/i64/negate_zero.out b/tests/expectations/compiler/integers/i64/negate_zero.out index 8193192370..a2c859e9a8 100644 --- a/tests/expectations/compiler/integers/i64/negate_zero.out +++ b/tests/expectations/compiler/integers/i64/negate_zero.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9c3e3d08240eff67d8ec39d250ed59b8a506de6facc94ae31ba778115eb906ff - initial_ast: 99ba99d27c20480c238f058405e9d12935bd9986f45cc2485ef934954779e7cc - unrolled_ast: 99ba99d27c20480c238f058405e9d12935bd9986f45cc2485ef934954779e7cc + initial_ast: 79d0a65eaf2dfde3bac09ab24b066ca631254b41761d17d411199aa98fee242d + unrolled_ast: 79d0a65eaf2dfde3bac09ab24b066ca631254b41761d17d411199aa98fee242d ssa_ast: 5c71be97ca63291cf501dd1cff20e66fc44d5e6b0f3e3ea6e65d2d669651d35e flattened_ast: 15effde342221d0810fa0ae55011ab84f3a3902bd25ac32d196ad6ac8762b6a2 diff --git a/tests/expectations/compiler/integers/i64/operator_methods.out b/tests/expectations/compiler/integers/i64/operator_methods.out index 9f8e3002a0..f0a898bdc6 100644 --- a/tests/expectations/compiler/integers/i64/operator_methods.out +++ b/tests/expectations/compiler/integers/i64/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: c572c56285dc294e7b23700ccce9682e351a8b16e099394a7caf40705371f1e9 - initial_ast: 9e479809819794b714a7af2aced7b539d382eff76a55f5bb19ee7c1d586c7f08 - unrolled_ast: 9e479809819794b714a7af2aced7b539d382eff76a55f5bb19ee7c1d586c7f08 + initial_ast: 4ce857dbb2b92ae8745b1289532260a64e3584ae710fcad70a3138003575af84 + unrolled_ast: 4ce857dbb2b92ae8745b1289532260a64e3584ae710fcad70a3138003575af84 ssa_ast: 6bf92cdf53c732cd347fa4ff4306aa2a522490d164a66d614b670a93aae3afca flattened_ast: ebb2a32eef87606568e54ddb5d5374077cbc842f48778c62bfc70080af02a34b diff --git a/tests/expectations/compiler/integers/i64/ternary.out b/tests/expectations/compiler/integers/i64/ternary.out index f2b24f2f8e..7c81840d88 100644 --- a/tests/expectations/compiler/integers/i64/ternary.out +++ b/tests/expectations/compiler/integers/i64/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: aaaced365bd0e11d40cfb0b008bd1f886eb3df7587717717af63038ee76ee21a - initial_input_ast: 9857cf9663bcf222eab6a4fd2e31ed0eebd8649b8df18f8fcc5b9baa5567e018 - initial_ast: 988c95a65bdae9242509594a07cdbec7ca9417682e580510a9e37028843f10c2 - unrolled_ast: 988c95a65bdae9242509594a07cdbec7ca9417682e580510a9e37028843f10c2 + initial_ast: e1e84f91488913f22bbb33cb7f211a80b1f145134b8e4326d5172abcd4deda37 + unrolled_ast: e1e84f91488913f22bbb33cb7f211a80b1f145134b8e4326d5172abcd4deda37 ssa_ast: 946c8d93d46168ff08596f3245cb98ad70df3b6980a74e567eb789f0e8e26b6b flattened_ast: 8541366e65240d01607427177c0472436a74ea1d24e1d05d6f784f2cc0835b1c diff --git a/tests/expectations/compiler/integers/i8/console_assert.out b/tests/expectations/compiler/integers/i8/console_assert.out index 5c001e78b4..ff9016fd01 100644 --- a/tests/expectations/compiler/integers/i8/console_assert.out +++ b/tests/expectations/compiler/integers/i8/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9548e64af3d1801b57e671b887e2a45630155c589bd3f3cba4553d110c72297c - initial_ast: 46cb8089befd193dabba22ff179bdc2c9e58c7933fc588f2c28d305085c35bbb - unrolled_ast: 46cb8089befd193dabba22ff179bdc2c9e58c7933fc588f2c28d305085c35bbb + initial_ast: 0b429179eae6066ca16bda5f506bbb3c13a1164cf7e693ee3cd17b33df7166be + unrolled_ast: 0b429179eae6066ca16bda5f506bbb3c13a1164cf7e693ee3cd17b33df7166be ssa_ast: ace5c6d1f0ba4c43de746517062402f1ee73fd1fecbf330f8641d67c3e9c5824 flattened_ast: 6f2dbe6912b695e1e80db1468dbdabb8c77b24f4bf0d8e450fa0277fb032434b diff --git a/tests/expectations/compiler/integers/i8/max.out b/tests/expectations/compiler/integers/i8/max.out index e55550289c..4f011afc3e 100644 --- a/tests/expectations/compiler/integers/i8/max.out +++ b/tests/expectations/compiler/integers/i8/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 053c52e2f561e1f5179ffa94f743c16b3648c90c2feafd73cf762ab8cf306a3b - initial_ast: 71c09de77ed9b0c4b4b53b3055a9271c3d8e537ec3cc3911e418f9321f358e38 - unrolled_ast: 71c09de77ed9b0c4b4b53b3055a9271c3d8e537ec3cc3911e418f9321f358e38 + initial_ast: f75874aff2bd9f434a51c06f22d37a0f08809b52635718f8b4700542fab409a9 + unrolled_ast: f75874aff2bd9f434a51c06f22d37a0f08809b52635718f8b4700542fab409a9 ssa_ast: 4d7cfab00d6e7a77592a17423aef3607d2119a25603445887bcbf45f05c823e0 flattened_ast: 85ad25ddb4144de748828d019cc77c229038028e2b7783feebcca0e628078d70 diff --git a/tests/expectations/compiler/integers/i8/min.out b/tests/expectations/compiler/integers/i8/min.out index e9b825927f..37745ba549 100644 --- a/tests/expectations/compiler/integers/i8/min.out +++ b/tests/expectations/compiler/integers/i8/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 84b46c678330eec4edf135e45cf883d4702d536564b83c6577659bbdb35d08ae - initial_ast: 337771214704f7646b09e38ada1435eaa056a0aeb7e3e3eccda745639eb0f40b - unrolled_ast: 337771214704f7646b09e38ada1435eaa056a0aeb7e3e3eccda745639eb0f40b + initial_ast: 7675ce2841f612004884d7c68535498460714437f23a907f78691ba09385b62f + unrolled_ast: 7675ce2841f612004884d7c68535498460714437f23a907f78691ba09385b62f ssa_ast: 7b18f253497b5a86a69c1a926ebf3ce507cfac564351ba08b8fd7f8549ba2500 flattened_ast: 017a11558f5996d023e61d2bbdeeae5e8e6ac0b88948d9fa5e8238af1df49b9d diff --git a/tests/expectations/compiler/integers/i8/min_fail.out b/tests/expectations/compiler/integers/i8/min_fail.out index 6a613786b6..03f920bd33 100644 --- a/tests/expectations/compiler/integers/i8/min_fail.out +++ b/tests/expectations/compiler/integers/i8/min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 3ca155c33debfdfb0192a7bddb387e5e7fafeeaf31f0ef5089be2352d74faed3 - initial_ast: dab9213d6dd221ed32197393ab2cf7bf77849e7e8cad9242c55bd058b38aac3d - unrolled_ast: dab9213d6dd221ed32197393ab2cf7bf77849e7e8cad9242c55bd058b38aac3d + initial_ast: e5a68a36d19ed73b24c03cc8c0f145401d4b3b2ce9ef81f04d35e6f957d99676 + unrolled_ast: e5a68a36d19ed73b24c03cc8c0f145401d4b3b2ce9ef81f04d35e6f957d99676 ssa_ast: 0cfdb78c8f2acf9863951a8621106651565cdb9e150042781b19e9f667aae280 flattened_ast: 6835a1d9bbe610390aaa3122dcc4f1d44a7a52e2d87beb8fe9f797afedb25bb3 diff --git a/tests/expectations/compiler/integers/i8/negate_min_fail.out b/tests/expectations/compiler/integers/i8/negate_min_fail.out index 31480efa7b..963c77bbf8 100644 --- a/tests/expectations/compiler/integers/i8/negate_min_fail.out +++ b/tests/expectations/compiler/integers/i8/negate_min_fail.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 35fa571f4f989bab1f0d2700da8761162092610be31c9cb6a1d6940f7ddafe1d - initial_ast: 92ab5527ea7ba5737a5b493cb1b0fcb82bdd5618e14ccb4e3590fdedfdb7fe7a - unrolled_ast: 92ab5527ea7ba5737a5b493cb1b0fcb82bdd5618e14ccb4e3590fdedfdb7fe7a + initial_ast: edd1f86192dfe7badb4055772e88cb50d1538313a17bcda9356d7877797b45bd + unrolled_ast: edd1f86192dfe7badb4055772e88cb50d1538313a17bcda9356d7877797b45bd ssa_ast: 99d24d5810df1dc705778b92f35de48e3cabed8f65a4fa19b84a1692f60b5375 flattened_ast: 73b7b1dbc3c20b5a7e7d4eb62be75dc779ee3b537ed65542742af0d271909e9d diff --git a/tests/expectations/compiler/integers/i8/negate_zero.out b/tests/expectations/compiler/integers/i8/negate_zero.out index ba57709abf..f647e4d7f7 100644 --- a/tests/expectations/compiler/integers/i8/negate_zero.out +++ b/tests/expectations/compiler/integers/i8/negate_zero.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 5446f448ff498f75a8f37b0b6c929a33a6148e49ec0982adb9edc7d89fbbe5e8 - initial_ast: 96bb278861c2b40cfb89a499c246b8cc809d52825879d9bf416d66f2555a3506 - unrolled_ast: 96bb278861c2b40cfb89a499c246b8cc809d52825879d9bf416d66f2555a3506 + initial_ast: 6e5826180cec7973f9c2ba3b0b67fd24b252068536f6fb755e1a04ad31e19aac + unrolled_ast: 6e5826180cec7973f9c2ba3b0b67fd24b252068536f6fb755e1a04ad31e19aac ssa_ast: de974c098257ad238cf5f8551037038a18908e87b99cf8e2bb45539864f9bd72 flattened_ast: 70cf56b6db7dc5452a85e744cb09b47e9b4569b622232fc4fa8fd2d5ff16cf4b diff --git a/tests/expectations/compiler/integers/i8/operator_methods.out b/tests/expectations/compiler/integers/i8/operator_methods.out index 0745dfb5e9..19c1bf22db 100644 --- a/tests/expectations/compiler/integers/i8/operator_methods.out +++ b/tests/expectations/compiler/integers/i8/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 4bd16d5f40cf0ace11becd2cdceca047bb16007e8172f1e8d98b23340b737128 - initial_ast: c871f0e0f91ca47be9c6059ca6a0e31480b9b00c5c3964c9e23f3c17de6c99b5 - unrolled_ast: c871f0e0f91ca47be9c6059ca6a0e31480b9b00c5c3964c9e23f3c17de6c99b5 + initial_ast: d0dd243a3f92b1aeec59ce466239fcaddd87470b2e6192c925012f514fd90b08 + unrolled_ast: d0dd243a3f92b1aeec59ce466239fcaddd87470b2e6192c925012f514fd90b08 ssa_ast: d57a7d6f6dafd14024d6768e64d2cbc269bd99952a3fb61572ef366125ee1f93 flattened_ast: 7802b8c7f39552aae99180c4a9dd5932299ce50d4631d57a8bb524feefb3e121 diff --git a/tests/expectations/compiler/integers/i8/ternary.out b/tests/expectations/compiler/integers/i8/ternary.out index 11b9917664..f4fc6b339b 100644 --- a/tests/expectations/compiler/integers/i8/ternary.out +++ b/tests/expectations/compiler/integers/i8/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 0c8e5c3fbf98062dd6d13474b12d23183d4c00ae89920b197c8070c47e2d2af6 - initial_input_ast: 5c094a5394c130ed45fe1a8d9f67741d706b742938effb7c729c5b4ac493a04f - initial_ast: b3f620f34acf059212eb5fb145da9b5cdc4eaacbaefaeea39e79e3de40f349fc - unrolled_ast: b3f620f34acf059212eb5fb145da9b5cdc4eaacbaefaeea39e79e3de40f349fc + initial_ast: 9f8f5436fc55b3bcdd5a0d3111014aca50920753638bb1b0b485d83e1194ecfd + unrolled_ast: 9f8f5436fc55b3bcdd5a0d3111014aca50920753638bb1b0b485d83e1194ecfd ssa_ast: 842ab433a61150acfd0b17a3fec441fcf663f3e8a797948fc672af4860b64e0b flattened_ast: f169c3079d402638b56404e27e92089c88a12e01b5ab8709366b6bc479a2f902 diff --git a/tests/expectations/compiler/integers/u128/console_assert.out b/tests/expectations/compiler/integers/u128/console_assert.out index 6c6deea14c..b29907e181 100644 --- a/tests/expectations/compiler/integers/u128/console_assert.out +++ b/tests/expectations/compiler/integers/u128/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 0584ff1e138fd43a9ade570fa63665dad9dba5bc976e90f896f8bd6cfe4f5b6b - initial_ast: a4529659ff71373e0d58f1287cea355d41d1d9930a8a0dfdc10f06740c92e69b - unrolled_ast: a4529659ff71373e0d58f1287cea355d41d1d9930a8a0dfdc10f06740c92e69b + initial_ast: 8bc9fdfb41b5bfca1f07adedca7c6567d2675986433cbfac8f53500491347666 + unrolled_ast: 8bc9fdfb41b5bfca1f07adedca7c6567d2675986433cbfac8f53500491347666 ssa_ast: 7afa8af8e95c6292340bc1300b8562ee41606be47601bcefae74f6b3e185adf9 flattened_ast: 83f847b357697a184580e13a64cc7fbe45046afd96971db09e872eb6e95db667 diff --git a/tests/expectations/compiler/integers/u128/max.out b/tests/expectations/compiler/integers/u128/max.out index 3d0aab60eb..4b90c175bd 100644 --- a/tests/expectations/compiler/integers/u128/max.out +++ b/tests/expectations/compiler/integers/u128/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 7279f02a6199e810e5a2eef9037b78189c6044a45519b267306d39465a516ef4 - initial_ast: 780a1b173e74b7f584ba40655801e317bdebc7539880263766f705c13a477a08 - unrolled_ast: 780a1b173e74b7f584ba40655801e317bdebc7539880263766f705c13a477a08 + initial_ast: d5e7a51826312b0f1c84bb4a027856c652b87aea56c24741077f7472abbcede2 + unrolled_ast: d5e7a51826312b0f1c84bb4a027856c652b87aea56c24741077f7472abbcede2 ssa_ast: 53f230b419a9a5d66281510efe5af1b155258f899fe318f7e86e837763a6d3de flattened_ast: e26efe7128bfdc238f2e2875f185555dce4b6bdd8a4a8fba5f8720d3a24eba49 diff --git a/tests/expectations/compiler/integers/u128/min.out b/tests/expectations/compiler/integers/u128/min.out index a4bbe9d7c9..8bb0d72ee3 100644 --- a/tests/expectations/compiler/integers/u128/min.out +++ b/tests/expectations/compiler/integers/u128/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: e412b9eb24a9ab2ac5ec9f8e20472ee42e4ab67e136948bca8bf8afadc53d1c6 - initial_ast: d96ab078d65b76cbb407a7f72d049257a82dc75d4873ee3caccaa18e49fe4d0f - unrolled_ast: d96ab078d65b76cbb407a7f72d049257a82dc75d4873ee3caccaa18e49fe4d0f + initial_ast: 8a99aab48ef8edaf8b2ccd6369c0b27f30d37a3d0cbf94fea18012af443e27ca + unrolled_ast: 8a99aab48ef8edaf8b2ccd6369c0b27f30d37a3d0cbf94fea18012af443e27ca ssa_ast: 24be7978245d994e5dad45b3cbdf98f48ea78d18d0269788e27c5c064c6e1a28 flattened_ast: 57ab1a9a654a205ce16bcd460fba449bc5ca83c550a0a70ea0ba7c7649f2c2a1 diff --git a/tests/expectations/compiler/integers/u128/operator_methods.out b/tests/expectations/compiler/integers/u128/operator_methods.out index 160cee956b..437d49c6a1 100644 --- a/tests/expectations/compiler/integers/u128/operator_methods.out +++ b/tests/expectations/compiler/integers/u128/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 62ab9d81c7cb24b485090a7e1984374758c09605fd331b866c8cc27e3e569506 - initial_ast: dd7a5f2a576fb1a15ac002b0608825638e59a6f54e93e4c65dc064333f4f861f - unrolled_ast: dd7a5f2a576fb1a15ac002b0608825638e59a6f54e93e4c65dc064333f4f861f + initial_ast: f8bf82055536cdc7bd95321d95526f53dd8ead847e47adf8ba595b05390459c4 + unrolled_ast: f8bf82055536cdc7bd95321d95526f53dd8ead847e47adf8ba595b05390459c4 ssa_ast: b0ce02e75ccd74a84c77519babf5be98b2b884c5c4f262488187fe88d6c118a8 flattened_ast: 725abf00068449048589515491ebb345a684f5f81a1d152f3ac1175759eb6649 diff --git a/tests/expectations/compiler/integers/u128/ternary.out b/tests/expectations/compiler/integers/u128/ternary.out index 2ff1e57583..08d62a24b0 100644 --- a/tests/expectations/compiler/integers/u128/ternary.out +++ b/tests/expectations/compiler/integers/u128/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 4d4bc441f3e33685e211bd83cb1231ae32287b1281d216c5c24c1646c676bcca - initial_input_ast: b4109e46eb1c44997ac6c92cabb52485c8f455cfe03d441c6355a21f07f77ccd - initial_ast: e029c24c2db9314bcdbb0d667e6a5b2b1f3ef7e8f8e50a42d6b4caef2e1e6adb - unrolled_ast: e029c24c2db9314bcdbb0d667e6a5b2b1f3ef7e8f8e50a42d6b4caef2e1e6adb + initial_ast: bf71a635c8b6de14f8f73b9172cfc47142537530d000f474a6afe29d1c9471be + unrolled_ast: bf71a635c8b6de14f8f73b9172cfc47142537530d000f474a6afe29d1c9471be ssa_ast: 967937c20ead276d7fab470927c2be5569d967592af980a69c14336ab1e69eb5 flattened_ast: c725980bf965474ad01c307db89b7e83077c3d1d384162a829d1bea23cff229a diff --git a/tests/expectations/compiler/integers/u16/console_assert.out b/tests/expectations/compiler/integers/u16/console_assert.out index 6af3a1d645..ca848a55b6 100644 --- a/tests/expectations/compiler/integers/u16/console_assert.out +++ b/tests/expectations/compiler/integers/u16/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: a8703727412fbfb964692a72d1a98edf66f4077d1c0b16616eca3b6b90386014 - initial_ast: d29e16d6c11b53e19c702689ce218685eea8319bf4530c3417a500808df62431 - unrolled_ast: d29e16d6c11b53e19c702689ce218685eea8319bf4530c3417a500808df62431 + initial_ast: 881f889f65565b03e4c00b350947c525d8e4cb1efe0184ef62cdfad57f15794d + unrolled_ast: 881f889f65565b03e4c00b350947c525d8e4cb1efe0184ef62cdfad57f15794d ssa_ast: c651a6b698f90b924e1a268e0ce84ce9ad787cdb3b1426fdf7488f428a6ae1d3 flattened_ast: e5f435a7dc44517dc8719393e46fd1e803b57556cf63278d57479205f4af3ec9 diff --git a/tests/expectations/compiler/integers/u16/max.out b/tests/expectations/compiler/integers/u16/max.out index 7497d96521..8d4819ef0d 100644 --- a/tests/expectations/compiler/integers/u16/max.out +++ b/tests/expectations/compiler/integers/u16/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 68fd37b711e1f8f45e98d2652234bc50685b9c2227d5074b42f7b2706e56b6d3 - initial_ast: 99c6cd1abbd4f1e4cf85beec80079e9272b3ebac5e60db07953ab21a90a63a2a - unrolled_ast: 99c6cd1abbd4f1e4cf85beec80079e9272b3ebac5e60db07953ab21a90a63a2a + initial_ast: 3bba760437c29487489bde95e94cfbbbadba6bd8a76d0cdb06c13fddb903b325 + unrolled_ast: 3bba760437c29487489bde95e94cfbbbadba6bd8a76d0cdb06c13fddb903b325 ssa_ast: 26a304b6536173053a3431d6d34e0ad591faa7df1270519598fe1ddd690fc9ca flattened_ast: 93a9b13e9a29ada587e48ccb570b2af3663b3be874821e934dcf628f4eca99a3 diff --git a/tests/expectations/compiler/integers/u16/min.out b/tests/expectations/compiler/integers/u16/min.out index 65aab8bc6b..32e6f95714 100644 --- a/tests/expectations/compiler/integers/u16/min.out +++ b/tests/expectations/compiler/integers/u16/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 7855c10e2bb4c8465d2442a521bec1343e02fa87ba208adc4a777501445ccdd8 - initial_ast: e24e7883c3030caeebd83174e98066c1730e683f03e66423784aab24dec77ad9 - unrolled_ast: e24e7883c3030caeebd83174e98066c1730e683f03e66423784aab24dec77ad9 + initial_ast: ea58d5b7ad156064b6fe429701646e67ca46fafe6b6f80ce49ce3bbc654c61bd + unrolled_ast: ea58d5b7ad156064b6fe429701646e67ca46fafe6b6f80ce49ce3bbc654c61bd ssa_ast: d4fde2c47bdfc87e5d57f80736f6eb6f4dd0d7fdab99a4ac698f5204cb7d47e6 flattened_ast: 124c34b6abb87318b59da73edd28845240f71854cc9102f1020ed367db6cd7ec diff --git a/tests/expectations/compiler/integers/u16/operator_methods.out b/tests/expectations/compiler/integers/u16/operator_methods.out index e72b26637f..3270572de1 100644 --- a/tests/expectations/compiler/integers/u16/operator_methods.out +++ b/tests/expectations/compiler/integers/u16/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 4b1d0ab9e4c9f57416822a7d56e0c43ea6960e01aea61197c7b460c72e21d62b - initial_ast: eeac52cc3bf0c03c3344598a6ac183a820f9707ba8a1321a4f72437b899ddd23 - unrolled_ast: eeac52cc3bf0c03c3344598a6ac183a820f9707ba8a1321a4f72437b899ddd23 + initial_ast: 221c18dbd5609d0e2d472c47aef3aaa8224bf436a316630215c102d806d890bb + unrolled_ast: 221c18dbd5609d0e2d472c47aef3aaa8224bf436a316630215c102d806d890bb ssa_ast: 6f6d633fa6c347d00d370976764815e7a4fb55d440ad544f4a120bb3250781fa flattened_ast: fa52e4079793a36d82cb78c963a023ef8fa9add3980d9ed96285f4c21935e938 diff --git a/tests/expectations/compiler/integers/u16/ternary.out b/tests/expectations/compiler/integers/u16/ternary.out index f3bb8d3cae..448d25bfea 100644 --- a/tests/expectations/compiler/integers/u16/ternary.out +++ b/tests/expectations/compiler/integers/u16/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 15bbb5f89b835d1c35f8a14d00f5f55da3e2e8eb2bcd1226242289ebea375edf - initial_input_ast: 97e87e27140f8e859ed9167616dacddd5eef10708909901754a67cd035d1c05e - initial_ast: c5d4e32d84ca4096f7610026ae647e3b2a31516735ecfb00dbe595a28a192b36 - unrolled_ast: c5d4e32d84ca4096f7610026ae647e3b2a31516735ecfb00dbe595a28a192b36 + initial_ast: 8adb8d645ddc77d5c26eeb97cefeae2c7ab45c057ef0321eb7911f2939a7a469 + unrolled_ast: 8adb8d645ddc77d5c26eeb97cefeae2c7ab45c057ef0321eb7911f2939a7a469 ssa_ast: 1bdb6715fdda5ca0ec8c48626b7a184b8bbcd0778ebdbd5ba7a9adfced630ea6 flattened_ast: 28c0bd283a0379ce8aa64c52e20736c86906bdce5b2b3aca1f6d5d3828509dfa diff --git a/tests/expectations/compiler/integers/u32/console_assert.out b/tests/expectations/compiler/integers/u32/console_assert.out index 700eeb9b08..46b3f32243 100644 --- a/tests/expectations/compiler/integers/u32/console_assert.out +++ b/tests/expectations/compiler/integers/u32/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: b6047e3825e6fe87f55510f8619d842e78d01ae4c9a575653387c74ba2a64947 - initial_ast: 337dcf37290901d9df72c0f80aeb33bb4602eb6b84c6ee9f0311001bb5c2a4e0 - unrolled_ast: 337dcf37290901d9df72c0f80aeb33bb4602eb6b84c6ee9f0311001bb5c2a4e0 + initial_ast: 2c9125421bd0c7389824025fbcf9051c5ce2d1a805bddb7e696a5f669ac2c3ed + unrolled_ast: 2c9125421bd0c7389824025fbcf9051c5ce2d1a805bddb7e696a5f669ac2c3ed ssa_ast: 5bb4db20e6221080fbf6e250a15185371c18c0b37a7fa6af36d385479424e673 flattened_ast: bc3cde98f2d0a021fcb0080be9f30da02048441bd39e674fdc8d178cf9c8f3ca diff --git a/tests/expectations/compiler/integers/u32/max.out b/tests/expectations/compiler/integers/u32/max.out index ba0318058d..145c61c3ca 100644 --- a/tests/expectations/compiler/integers/u32/max.out +++ b/tests/expectations/compiler/integers/u32/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 82522a99fdd02acd3618a35012182db5b4fb3eea4ab3e135a57533b6489bd993 - initial_ast: 442dd1489e6f6050c3ce9afe491573364ebeec11673ef9d9d4e964b754db372a - unrolled_ast: 442dd1489e6f6050c3ce9afe491573364ebeec11673ef9d9d4e964b754db372a + initial_ast: c64954ea0632e7a506c056ffad59b006d55e96093d79028e395b0bd1014b5ea0 + unrolled_ast: c64954ea0632e7a506c056ffad59b006d55e96093d79028e395b0bd1014b5ea0 ssa_ast: 8d7224a5eb3282b9f07801543b959f73e79a3beb333ca35dcb05f12468393275 flattened_ast: 736617ec2177be8d49747b5f95d172844a2508a4153d2183780ef65757352e85 diff --git a/tests/expectations/compiler/integers/u32/min.out b/tests/expectations/compiler/integers/u32/min.out index 9ed77dc95f..377ff9e5b2 100644 --- a/tests/expectations/compiler/integers/u32/min.out +++ b/tests/expectations/compiler/integers/u32/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 7855c10e2bb4c8465d2442a521bec1343e02fa87ba208adc4a777501445ccdd8 - initial_ast: 0caa23949afde99c11491347a81134cf51c781dd239f979524b03f7948cbcbaf - unrolled_ast: 0caa23949afde99c11491347a81134cf51c781dd239f979524b03f7948cbcbaf + initial_ast: 61a6e70ab75a0ce20bc2cd92c4087a37f65fc7d4d066901acf06184771c39b6b + unrolled_ast: 61a6e70ab75a0ce20bc2cd92c4087a37f65fc7d4d066901acf06184771c39b6b ssa_ast: f37fc6870b956ea696cf1929156937d441695cd382244fdc41a068ee1b2ea427 flattened_ast: 6992869e93ceaa0089e35c82a58f0e89c445a366329b4ba5a53cc15d4548fe8b diff --git a/tests/expectations/compiler/integers/u32/operator_methods.out b/tests/expectations/compiler/integers/u32/operator_methods.out index 5076c515cc..f49485666c 100644 --- a/tests/expectations/compiler/integers/u32/operator_methods.out +++ b/tests/expectations/compiler/integers/u32/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: a607f74333b1f65f64d6c54e5874505b715c030ee06b73e2e07dc672a0d538df - initial_ast: 6e733be626b2785f610f61b4c04f34312328686579b0be15ffd9b8af505a0247 - unrolled_ast: 6e733be626b2785f610f61b4c04f34312328686579b0be15ffd9b8af505a0247 + initial_ast: 684ae65da8958a150b74619832cb2a6f469d85f1e0f368de171a3b0579972303 + unrolled_ast: 684ae65da8958a150b74619832cb2a6f469d85f1e0f368de171a3b0579972303 ssa_ast: d25e8474eb5ba147273563e3d71fab8a15049932442a474c7e5421fc953fab8b flattened_ast: c6aaa0db3eda3d2d6291151d5dc11c3362f7318134ab4f9d6dc799ad9faa2139 diff --git a/tests/expectations/compiler/integers/u32/ternary.out b/tests/expectations/compiler/integers/u32/ternary.out index 89142d0e58..4862739cdf 100644 --- a/tests/expectations/compiler/integers/u32/ternary.out +++ b/tests/expectations/compiler/integers/u32/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: e970e771ebe285ceb39e6677ee26ff2a1f845e217db6f5406ae4374ecbfda024 - initial_input_ast: ebed552413430d201f0ecd905cc423064d9f1c869e85650cc5231009a238ade9 - initial_ast: 1d7d9690c8a9dba1cd67957db65aae9d03e447519f7553793e1d896c901991f9 - unrolled_ast: 1d7d9690c8a9dba1cd67957db65aae9d03e447519f7553793e1d896c901991f9 + initial_ast: 4d95c67d0faf2cb90e52341980f2d54707067ca06d9d526392a7800c2e7e3917 + unrolled_ast: 4d95c67d0faf2cb90e52341980f2d54707067ca06d9d526392a7800c2e7e3917 ssa_ast: c715f0f757927dc9f13d29e4f10b941fd8caede3b59a0672bfcb050d408b6fb7 flattened_ast: ca938517ce015ad2df87e41ef8612c9e9174c3c9299f24d09e20121ecd64e38f diff --git a/tests/expectations/compiler/integers/u64/console_assert.out b/tests/expectations/compiler/integers/u64/console_assert.out index f846e1fdb1..0ac2d61a24 100644 --- a/tests/expectations/compiler/integers/u64/console_assert.out +++ b/tests/expectations/compiler/integers/u64/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 7f1729e4c0931b06ecd4e3c7d253eb806dcca0f20343ae891f89fe635798e88c - initial_ast: 44864933a8d6aca603e435a31eacf386a37c590ea5c22c70d8ceced9f67eea41 - unrolled_ast: 44864933a8d6aca603e435a31eacf386a37c590ea5c22c70d8ceced9f67eea41 + initial_ast: 19175562104836cb9c863c7619b68b55134fbb8767454b822002c9223a5d10ff + unrolled_ast: 19175562104836cb9c863c7619b68b55134fbb8767454b822002c9223a5d10ff ssa_ast: 0211f1d34808042d99daf3b3878de8d8f7818ff3d549fcb8da4af114c98c5d8e flattened_ast: ed3b9c9d627b7565fa26d006cb9928f22f332329f2d00ca1deb4556903fd3d37 diff --git a/tests/expectations/compiler/integers/u64/max.out b/tests/expectations/compiler/integers/u64/max.out index ba559bfa8a..bf69d3af68 100644 --- a/tests/expectations/compiler/integers/u64/max.out +++ b/tests/expectations/compiler/integers/u64/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: c30f96e2608bb0ec80f8aff5127034eda389d9335a067bdb81160346daea4dfb - initial_ast: 46153b010465de20b0bca1880adadf32b1758869e132c09ec8c977e51329ac52 - unrolled_ast: 46153b010465de20b0bca1880adadf32b1758869e132c09ec8c977e51329ac52 + initial_ast: be763f0bcb69a8f7d7676de60506c4dae347b0fcaa83ef603f673c12293cdde1 + unrolled_ast: be763f0bcb69a8f7d7676de60506c4dae347b0fcaa83ef603f673c12293cdde1 ssa_ast: 5a5177075883a97fb585f25cd1aaccb2cc7aa138c94a6ba778c9e3b85fe5c15f flattened_ast: 6f27e8a8333936a96736d19a44ec3e21a4e2b2ec3316795fd1a21994579e7bf7 diff --git a/tests/expectations/compiler/integers/u64/min.out b/tests/expectations/compiler/integers/u64/min.out index 5d30d72ada..ca9ab53d6f 100644 --- a/tests/expectations/compiler/integers/u64/min.out +++ b/tests/expectations/compiler/integers/u64/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 7855c10e2bb4c8465d2442a521bec1343e02fa87ba208adc4a777501445ccdd8 - initial_ast: 895669e5e78d16857033d34f1a7e06049becfbb618f91897bcfe51e0d84b337d - unrolled_ast: 895669e5e78d16857033d34f1a7e06049becfbb618f91897bcfe51e0d84b337d + initial_ast: ae17adcb59994d70258725c1aa6c2ff647b5e8f73dea55352d0bfcec81acdbc2 + unrolled_ast: ae17adcb59994d70258725c1aa6c2ff647b5e8f73dea55352d0bfcec81acdbc2 ssa_ast: fefb45072598accc2b1f1a519b7b5bad2b26261537b7ae40bb7a9ef9eb14d7a8 flattened_ast: 75aa1e5bee3f029d4d56838116528c979500180daa1035d36bc6839e9445eadd diff --git a/tests/expectations/compiler/integers/u64/operator_methods.out b/tests/expectations/compiler/integers/u64/operator_methods.out index a96022c64f..a2c0541897 100644 --- a/tests/expectations/compiler/integers/u64/operator_methods.out +++ b/tests/expectations/compiler/integers/u64/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 2bf89a79cdce37314c59a50aeee1214f6726dc1977d5134d7adeff1045353091 - initial_ast: fea0976a829ecab5aae873cebca85a20d33290004d673c83d74b636ece3ee356 - unrolled_ast: fea0976a829ecab5aae873cebca85a20d33290004d673c83d74b636ece3ee356 + initial_ast: 3055a26f6e86f855bfcb83626ee1882a6f8894ba6ed0d755eb4b4571d12f0aa9 + unrolled_ast: 3055a26f6e86f855bfcb83626ee1882a6f8894ba6ed0d755eb4b4571d12f0aa9 ssa_ast: fa47a7f8e3da9393a712df64f3cc69dc78f3a25d22eab7b7d701a4d9e8f06f45 flattened_ast: 813f7831e294fef36de57fd78ae45526a7ab5b9c34460fd0ff0a65d7e433c6dc diff --git a/tests/expectations/compiler/integers/u64/ternary.out b/tests/expectations/compiler/integers/u64/ternary.out index 47eba61ca3..43ba98ece7 100644 --- a/tests/expectations/compiler/integers/u64/ternary.out +++ b/tests/expectations/compiler/integers/u64/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: 1814e3d2e4deb3985ee5576252dc14e586b17bf2c1fdaf0a7a0cf4e99187dfdb - initial_input_ast: cc6020cf59fc91307527c266539ecbd6b769224a71a2ecf5dec0e9f570b637d5 - initial_ast: d320bc35f7e96a1518ef22cd5ea7e9eb27170e9bf0ee69b2b270bdbb7299d909 - unrolled_ast: d320bc35f7e96a1518ef22cd5ea7e9eb27170e9bf0ee69b2b270bdbb7299d909 + initial_ast: fe84c3c12b84b587deb6be9a27d48069a34f896a1fd48fd17bcc30c2370c04dd + unrolled_ast: fe84c3c12b84b587deb6be9a27d48069a34f896a1fd48fd17bcc30c2370c04dd ssa_ast: 3d0d2194c26c0612c24ccad2f4df0a2fa187005e3f96c732d9dd431053cbb841 flattened_ast: 8a1f47e22fc07ea4622dbdd110a99c80c5d44889d181682bf9cd42e9aacad987 diff --git a/tests/expectations/compiler/integers/u8/console_assert.out b/tests/expectations/compiler/integers/u8/console_assert.out index b29d22ea4e..6fd83bb039 100644 --- a/tests/expectations/compiler/integers/u8/console_assert.out +++ b/tests/expectations/compiler/integers/u8/console_assert.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 03478857540e5a7870c2744783a309ae3a250c149c1363795dc9edce7ccaa91f - initial_ast: a5582a7db08c19950e831beacc2f9388c298d3e3b951c6400ce30f9742514ece - unrolled_ast: a5582a7db08c19950e831beacc2f9388c298d3e3b951c6400ce30f9742514ece + initial_ast: e6ee962f034bd19921cfb271f7d5a6df54babd8db7caf79229341215b4947e7b + unrolled_ast: e6ee962f034bd19921cfb271f7d5a6df54babd8db7caf79229341215b4947e7b ssa_ast: 17b13af1c805f53b9b0bd6548230ee92afe5d635b9ee61546bb626e499247a8e flattened_ast: 49bd8d63766d3cb5d9de5bd7cc5d5acd72ccf82c82c9167d02229e1fea3d7fbc diff --git a/tests/expectations/compiler/integers/u8/max.out b/tests/expectations/compiler/integers/u8/max.out index c2689a7f66..7957660653 100644 --- a/tests/expectations/compiler/integers/u8/max.out +++ b/tests/expectations/compiler/integers/u8/max.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 7855c10e2bb4c8465d2442a521bec1343e02fa87ba208adc4a777501445ccdd8 - initial_ast: 4f28a389b4999fe4be39087f41c8f603f810c163f35fba0081b6fbdad4d5318d - unrolled_ast: 4f28a389b4999fe4be39087f41c8f603f810c163f35fba0081b6fbdad4d5318d + initial_ast: 195cda2b8d8de028b667941d089c8716e13a3bc69758125ef8be1262ebb08254 + unrolled_ast: 195cda2b8d8de028b667941d089c8716e13a3bc69758125ef8be1262ebb08254 ssa_ast: 173fb1716cc73efb410d1237cd8db511698171327847011fc44c8763ed428c7d flattened_ast: 505163d6dba3ae212fc67f2b3ef74e11c0330a257edad440cb29b968c8ee25ce diff --git a/tests/expectations/compiler/integers/u8/min.out b/tests/expectations/compiler/integers/u8/min.out index 04a24b3e5b..a529ee789c 100644 --- a/tests/expectations/compiler/integers/u8/min.out +++ b/tests/expectations/compiler/integers/u8/min.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 95f7687de6b5904597d7920ff226479af76769bcb37a81eb2b26bb147ec6a88f - initial_ast: 167d506d4e94af56e1eeb296aa19fdcbf8492ba5b78889ff266f415495182eed - unrolled_ast: 167d506d4e94af56e1eeb296aa19fdcbf8492ba5b78889ff266f415495182eed + initial_ast: ec3d4f3afad2ab5d39aa8950054d2ab363b4480aaff4bff2e2ab56cde9abae1b + unrolled_ast: ec3d4f3afad2ab5d39aa8950054d2ab363b4480aaff4bff2e2ab56cde9abae1b ssa_ast: 8e9d372feda85e5e6cfba79e7f8c7f12b8155d9f3519856b418c7ce728ef635a flattened_ast: 2ea5ac42e91558fdecb77ea658932d79428532296ce38d7b1a63178981be16d9 diff --git a/tests/expectations/compiler/integers/u8/operator_methods.out b/tests/expectations/compiler/integers/u8/operator_methods.out index b097e6d20a..7e5ee05dd8 100644 --- a/tests/expectations/compiler/integers/u8/operator_methods.out +++ b/tests/expectations/compiler/integers/u8/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 3ca131eb4456a52ee19fcd3509d37b511aa50a83e65112a17bc86be4c34ad752 - initial_ast: c0102b0055d1afdb249aa276dd5a7de8cee8302dbf8b153452b00423370919e1 - unrolled_ast: c0102b0055d1afdb249aa276dd5a7de8cee8302dbf8b153452b00423370919e1 + initial_ast: 2600b47e4bee1661e2acb3f2e0ad12134e761e6770ec8a3759f8cfa0ef7566f2 + unrolled_ast: 2600b47e4bee1661e2acb3f2e0ad12134e761e6770ec8a3759f8cfa0ef7566f2 ssa_ast: 25c8e8132338c23f6d8838f3e2dcb9e0551c70ec1a70bf9586c1e2cddadc67c9 flattened_ast: c25bd7d69d1e6fd3deba3077b77c0563f102ec4a6e7c24a520d1f79d1e68c379 diff --git a/tests/expectations/compiler/integers/u8/ternary.out b/tests/expectations/compiler/integers/u8/ternary.out index 6abd395812..3a4a737b00 100644 --- a/tests/expectations/compiler/integers/u8/ternary.out +++ b/tests/expectations/compiler/integers/u8/ternary.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: d2f2ca5139a6b3c700577462e6d90f04729533de953b80f9295685b716a5b462 - initial_input_ast: b7e2c1b6261ac4660adcc02322e237077084305ba1c223b1033da6580f5d9be4 - initial_ast: bc1172512313caec97e6cacbe0c898b58f75ed22d51350a34bc4c3f776e15284 - unrolled_ast: bc1172512313caec97e6cacbe0c898b58f75ed22d51350a34bc4c3f776e15284 + initial_ast: befcf4970520317baa3024005e2942908e5637836bacc2f723d56f1e73b36b8c + unrolled_ast: befcf4970520317baa3024005e2942908e5637836bacc2f723d56f1e73b36b8c ssa_ast: 8ce79d7e898e6c511af919ab74fba811ee3b8995c7a54ee5db24ecd794690503 flattened_ast: 3f7f59d8db1125049326873232e481c8818581a359d99efe9dae68a00bd638d1 diff --git a/tests/expectations/compiler/records/duplicate_circuit_name_fail.out b/tests/expectations/compiler/records/duplicate_circuit_name_fail.out index b0859ca90a..f62bfcfcd3 100644 --- a/tests/expectations/compiler/records/duplicate_circuit_name_fail.out +++ b/tests/expectations/compiler/records/duplicate_circuit_name_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372010]: record `Token` shadowed by\n --> compiler-test:13:5\n |\n 13 | struct Token { // This struct cannot have the same name as the record defined above it.\n 14 | x: u32,\n 15 | }\n | ^\n" + - "Error [EAST0372008]: record `Token` shadowed by\n --> compiler-test:13:5\n |\n 13 | struct Token { // This struct cannot have the same name as the record defined above it.\n 14 | x: u32,\n 15 | }\n | ^\n" diff --git a/tests/expectations/compiler/records/init_expression.out b/tests/expectations/compiler/records/init_expression.out index 6036955297..2f1a40213c 100644 --- a/tests/expectations/compiler/records/init_expression.out +++ b/tests/expectations/compiler/records/init_expression.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: e044b10eea978b0f1506c44ffccb956e11f02aed0467d0d42fc94a42082130ad - unrolled_ast: e044b10eea978b0f1506c44ffccb956e11f02aed0467d0d42fc94a42082130ad + initial_ast: 1fa0d43e2568d354957c08d0fa549d2d0b8128a260a6dfa474d518d49297c69b + unrolled_ast: 1fa0d43e2568d354957c08d0fa549d2d0b8128a260a6dfa474d518d49297c69b ssa_ast: 065f0a3e7fb52a46bfaca297198c01dab9ec17b3808a29beabec5d46b99cb224 flattened_ast: 178f7e272793e5e8b1da04123f2e47692d5c6c4b68699dadfb82b4227855e379 diff --git a/tests/expectations/compiler/records/init_expression_shorthand.out b/tests/expectations/compiler/records/init_expression_shorthand.out index 20c55f3ef3..582e4b9bcf 100644 --- a/tests/expectations/compiler/records/init_expression_shorthand.out +++ b/tests/expectations/compiler/records/init_expression_shorthand.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 5235efe9e27e10027c51c7f6290ecd4a02c38bb25c86bae1aaa6ff954caeacef - unrolled_ast: 5235efe9e27e10027c51c7f6290ecd4a02c38bb25c86bae1aaa6ff954caeacef + initial_ast: 9d8c549f4cdca03150af5c09294b48e642922cbdb4a1a6f4c9035d54b19dca66 + unrolled_ast: 9d8c549f4cdca03150af5c09294b48e642922cbdb4a1a6f4c9035d54b19dca66 ssa_ast: 42e8a5f658e5e44304f458704a01ea9004716a76065caeab3b947b0105b6edc5 flattened_ast: b8c34f9ef013e8c05cfd334924e9c4f9996e49cee15066255e681460d9940c29 diff --git a/tests/expectations/compiler/records/nested_record.out b/tests/expectations/compiler/records/nested_record.out index d74d090eea..4745887995 100644 --- a/tests/expectations/compiler/records/nested_record.out +++ b/tests/expectations/compiler/records/nested_record.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 5100c6c4a9a94dc53613ccb35c45373ce7c91d027e6fbd4a3cb393f9caeb8aeb - unrolled_ast: 5100c6c4a9a94dc53613ccb35c45373ce7c91d027e6fbd4a3cb393f9caeb8aeb + initial_ast: 5b253019c13c2629f521d25c7a85d4768ddbd1dfc762749c5761ae2d2a9eaa07 + unrolled_ast: 5b253019c13c2629f521d25c7a85d4768ddbd1dfc762749c5761ae2d2a9eaa07 ssa_ast: 630deed4ccb749972b97c6dfb6da506b2f5f2d5f2c33b19b08ba80105956e0b3 flattened_ast: 95e39f94aba74fdeedbf8c7cddc92d5f7d1b4cbb86c4b7cfc26e4eb1780cbb9f diff --git a/tests/expectations/compiler/records/nested_record_1_fail.out b/tests/expectations/compiler/records/nested_record_1_fail.out index 1f2e625b15..6256a4cd6a 100644 --- a/tests/expectations/compiler/records/nested_record_1_fail.out +++ b/tests/expectations/compiler/records/nested_record_1_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372030]: A struct or record cannot contain another record.\n --> compiler-test:13:9\n |\n 13 | foo: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Token`.\n" + - "Error [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:13:9\n |\n 13 | foo: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Token`.\n" diff --git a/tests/expectations/compiler/records/nested_record_2_fail.out b/tests/expectations/compiler/records/nested_record_2_fail.out index 8a8b51d3c2..1ff3e45459 100644 --- a/tests/expectations/compiler/records/nested_record_2_fail.out +++ b/tests/expectations/compiler/records/nested_record_2_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:8:14\n |\n 8 | foo: (Foo, Foo),\n | ^" + - "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\n" diff --git a/tests/expectations/compiler/records/nested_record_3_fail.out b/tests/expectations/compiler/records/nested_record_3_fail.out index bc874a9d33..a63b32f138 100644 --- a/tests/expectations/compiler/records/nested_record_3_fail.out +++ b/tests/expectations/compiler/records/nested_record_3_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372030]: A struct or record cannot contain another record.\n --> compiler-test:12:9\n |\n 12 | bar: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Bar`.\n" + - "Error [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:12:9\n |\n 12 | bar: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Bar`.\n" diff --git a/tests/expectations/compiler/records/nested_record_4_fail.out b/tests/expectations/compiler/records/nested_record_4_fail.out index 3c303a879e..61485f0ccc 100644 --- a/tests/expectations/compiler/records/nested_record_4_fail.out +++ b/tests/expectations/compiler/records/nested_record_4_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:7:14\n |\n 7 | bar: (Bar, Bar),\n | ^" + - "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | bar: (Bar, Bar),\n | ^^^\nError [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\n" diff --git a/tests/expectations/compiler/records/record_init_out_of_order.out b/tests/expectations/compiler/records/record_init_out_of_order.out index 9da8390ebd..27362428c1 100644 --- a/tests/expectations/compiler/records/record_init_out_of_order.out +++ b/tests/expectations/compiler/records/record_init_out_of_order.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: a32d804ffef1ad23cd6214ac3632de072d12afa31223316dc237f5f4377babd2 - unrolled_ast: a32d804ffef1ad23cd6214ac3632de072d12afa31223316dc237f5f4377babd2 + initial_ast: aed733b1202670e081e5816b06091c743a3a360d344faa85036eaa26e89185be + unrolled_ast: aed733b1202670e081e5816b06091c743a3a360d344faa85036eaa26e89185be ssa_ast: d710042293b5afce0040417d5c3ee8913c6c84f7a1a0c7e47d28c161b7b11938 flattened_ast: 1b434ae8791f03c10d241b4bf6d30a5090f3818c29886d9950838665a8f62512 diff --git a/tests/expectations/compiler/scalar/cmp.out b/tests/expectations/compiler/scalar/cmp.out index 6dd96828c0..8eae4b74e8 100644 --- a/tests/expectations/compiler/scalar/cmp.out +++ b/tests/expectations/compiler/scalar/cmp.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 8e82052fb9fd38c5600a98688690a6f56e365a7606d70906ae0280aa3fa84984 - initial_ast: 65fb347a31e454a3333015ff171da36698ec8a7ed2c21392d6613074743692fe - unrolled_ast: 65fb347a31e454a3333015ff171da36698ec8a7ed2c21392d6613074743692fe + initial_ast: f9ee2c87b82f57f8d15ebba664205344ff94107cf1c869c29e22ff402e3ed4e6 + unrolled_ast: f9ee2c87b82f57f8d15ebba664205344ff94107cf1c869c29e22ff402e3ed4e6 ssa_ast: ccdf46e25022d87afe6505af20977b97a50b15750031f4792bdfe024b8fe9f85 flattened_ast: 2933d5980b4880a0a241c64d31f2952b5d4fd6277da70a7556cc3a73c63bce10 diff --git a/tests/expectations/compiler/scalar/eq.out b/tests/expectations/compiler/scalar/eq.out index f609630d21..9c7252ec24 100644 --- a/tests/expectations/compiler/scalar/eq.out +++ b/tests/expectations/compiler/scalar/eq.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 2f7417c9396a3e952ae3a318ba8f34cdfc12d133fc68ff096c2774fc60d838cc - initial_ast: 2635c35fef23320cf0f6ddb32d688bdafe2070c867edc5f9d12618788035bb60 - unrolled_ast: 2635c35fef23320cf0f6ddb32d688bdafe2070c867edc5f9d12618788035bb60 + initial_ast: 5547b5b460502f9a6be5b43a5b6a47ef6964c723335ac7286e5ac1171bfa8e43 + unrolled_ast: 5547b5b460502f9a6be5b43a5b6a47ef6964c723335ac7286e5ac1171bfa8e43 ssa_ast: e3cd242a6bcd1b691ff3534c4aad002921dd09fbe29bb138da781f87e38d26d8 flattened_ast: 7c36f1de95157a8a2a725135e5ec1815c5609fd9214e96cf7f266358e70ce6c6 diff --git a/tests/expectations/compiler/scalar/operator_methods.out b/tests/expectations/compiler/scalar/operator_methods.out index 51550ad17c..86d87d3284 100644 --- a/tests/expectations/compiler/scalar/operator_methods.out +++ b/tests/expectations/compiler/scalar/operator_methods.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: ccc8c217b3cf92444c2a22bbdc1ef4dd7cca6ba7f7908acb55dcc5dd84486a93 - initial_ast: fb542bcffb743c1e2952468f8c0b75c861f8fe9573ccc2482bde6525b85b6b0a - unrolled_ast: fb542bcffb743c1e2952468f8c0b75c861f8fe9573ccc2482bde6525b85b6b0a + initial_ast: 76fae6b3ae515d928b66cb4b8f5a3c33ace5438754323cd8ebb4c57c94e48409 + unrolled_ast: 76fae6b3ae515d928b66cb4b8f5a3c33ace5438754323cd8ebb4c57c94e48409 ssa_ast: b33d7675524c6d87226c768954de8b7e0d68bcc0d10fa9fa9c7c2e0957a4c9e4 flattened_ast: 69b7f9a6286ea1d63f2f2fae1c6f7dd4b23ae40f1cd24532f595f6cef7a67221 diff --git a/tests/expectations/compiler/scalar/scalar.out b/tests/expectations/compiler/scalar/scalar.out index 684c11cb99..9686ec8f49 100644 --- a/tests/expectations/compiler/scalar/scalar.out +++ b/tests/expectations/compiler/scalar/scalar.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 9874e54f49f999052d883470e93a6ad8fc63eab9b94899112131307cb53eb03e - initial_ast: 1cf734308d9fd8a3c95f9ffc6dff09255c61d0d26c56de09e3b92b73d2202578 - unrolled_ast: 1cf734308d9fd8a3c95f9ffc6dff09255c61d0d26c56de09e3b92b73d2202578 + initial_ast: 3af6edf0d2a8815faa0a1fa177903fe765b28a8d764feb0a4383db6d4e4519a6 + unrolled_ast: 3af6edf0d2a8815faa0a1fa177903fe765b28a8d764feb0a4383db6d4e4519a6 ssa_ast: 5ade57322a86c2264f6458c17593c7db2969286aacb6baff07faa94a480a19dd flattened_ast: 6f5596a08b6faa5f64ece41e4903ff70d09015199dbb3786372cddad952c880c diff --git a/tests/expectations/compiler/statements/assign_ternary.out b/tests/expectations/compiler/statements/assign_ternary.out index 581039df99..0b965c1356 100644 --- a/tests/expectations/compiler/statements/assign_ternary.out +++ b/tests/expectations/compiler/statements/assign_ternary.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372003]: Expected type `boolean` but type `u32` was found\n --> compiler-test:5:30\n |\n 5 | let x: bool = true ? x: true;\n | ^\nError [EAST0372011]: variable `x` shadowed by\n --> compiler-test:5:9\n |\n 5 | let x: bool = true ? x: true;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Error [ETYC0372003]: Expected type `boolean` but type `u32` was found\n --> compiler-test:5:30\n |\n 5 | let x: bool = true ? x: true;\n | ^\nError [EAST0372009]: variable `x` shadowed by\n --> compiler-test:5:13\n |\n 5 | let x: bool = true ? x: true;\n | ^\n" diff --git a/tests/expectations/compiler/statements/block.out b/tests/expectations/compiler/statements/block.out index 76914064a8..d5c733f051 100644 --- a/tests/expectations/compiler/statements/block.out +++ b/tests/expectations/compiler/statements/block.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 4e897b984e34e406f493169dcd9fc2091acf670ff2b79e20c1ee910eca07a6f5 - initial_ast: 1347a47ac0f84a50372e9a8c5a291bb41a065b706e75d1e012a65415f60acde0 - unrolled_ast: 1347a47ac0f84a50372e9a8c5a291bb41a065b706e75d1e012a65415f60acde0 + initial_ast: 268618a5fe528dce6c36a1e5008adeab518f7cd1811a6d962eeccade7b908881 + unrolled_ast: 268618a5fe528dce6c36a1e5008adeab518f7cd1811a6d962eeccade7b908881 ssa_ast: b2c72a7684563ca9cc54f405ab82f96279b93a2fae78bf13b4fb6a1441f23160 flattened_ast: 8aa4e0be930e96ed8fc862ffbd413a16fade2e2fb09b5bb82459c194fa5be9d7 diff --git a/tests/expectations/compiler/statements/chain.out b/tests/expectations/compiler/statements/chain.out index fc3b72d49d..008b0dbd43 100644 --- a/tests/expectations/compiler/statements/chain.out +++ b/tests/expectations/compiler/statements/chain.out @@ -6,7 +6,7 @@ outputs: - initial_input_ast: 9dd77c354c9539ce0af8adc4bd4b861edd7d880367780ede22683ea93020151f - initial_input_ast: 3689aa273270c52a83dfdd089bb9a4340605ba946735e05785c2705c8c1fbc01 - initial_input_ast: a1e4c643a6ea77b5cd7d9bcaf47a672629a1fba45da54fd863a471e6f35fc00e - initial_ast: eeeb1c35de6f80e8f6361071488fceb72f5c0afb7ce0c732f0d4eac842442202 - unrolled_ast: eeeb1c35de6f80e8f6361071488fceb72f5c0afb7ce0c732f0d4eac842442202 + initial_ast: 7749b425391349986341cfbaf44bba974648b591f025160bb344ec0bdc97f55f + unrolled_ast: 7749b425391349986341cfbaf44bba974648b591f025160bb344ec0bdc97f55f ssa_ast: f96c3c11eda5c4c7bedc580308fc0853627833efa3d927ae108547122e4058c8 flattened_ast: 6291b4691f7660c36fc32f33e7747c08aecf38c00125ad63740a5e2f5ca17a99 diff --git a/tests/expectations/compiler/statements/duplicate_variable.out b/tests/expectations/compiler/statements/duplicate_variable.out index d995924fcc..de88f74650 100644 --- a/tests/expectations/compiler/statements/duplicate_variable.out +++ b/tests/expectations/compiler/statements/duplicate_variable.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372011]: variable `x` shadowed by\n --> compiler-test:6:8\n |\n 6 | \tlet x: bool = true;\n | ^^^^^^^^^^^^^^^^^^\n" + - "Error [EAST0372009]: variable `x` shadowed by\n --> compiler-test:6:12\n |\n 6 | \tlet x: bool = true;\n | ^\n" diff --git a/tests/expectations/compiler/statements/expr_statement.out b/tests/expectations/compiler/statements/expr_statement.out new file mode 100644 index 0000000000..0c159c636e --- /dev/null +++ b/tests/expectations/compiler/statements/expr_statement.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: c28f468593720c06ddad09b051dd5011a0060b5639dc261ea9a7bb53014e4fe0 + unrolled_ast: c28f468593720c06ddad09b051dd5011a0060b5639dc261ea9a7bb53014e4fe0 + ssa_ast: 404dfd8f09e6b5bc34aed38b49415b522817cd2e2b644f1fc4883e5d827b748a + flattened_ast: 118c0515b8bdc861c3870a15bb5a98662c888f0388715bb87298425321ccacf3 diff --git a/tests/expectations/compiler/statements/expr_statement_fail.out b/tests/expectations/compiler/statements/expr_statement_fail.out new file mode 100644 index 0000000000..affd90e42a --- /dev/null +++ b/tests/expectations/compiler/statements/expr_statement_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [EAST0372006]: function `foo` shadowed by\n --> compiler-test:9:46\n |\n 9 | transition foo(flag: bool, a: u8, b: u8, foo: Foo, i: i8) -> u8 {\n | ^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:10:9\n |\n 10 | a + b;\n | ^^^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:11:9\n |\n 11 | flag ? a : b;\n | ^^^^^^^^^^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:12:9\n |\n 12 | foo.a;\n | ^^^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:13:9\n |\n 13 | Foo {\n 14 | a: a,\n 15 | };\n | ^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:16:9\n |\n 16 | a;\n | ^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:17:9\n |\n 17 | 1u8;\n | ^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:18:9\n |\n 18 | -i8;\n | ^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:19:9\n |\n 19 | ();\n | ^^^\n" diff --git a/tests/expectations/compiler/statements/iteration_basic.out b/tests/expectations/compiler/statements/iteration_basic.out index f5de36d541..a7aaf480da 100644 --- a/tests/expectations/compiler/statements/iteration_basic.out +++ b/tests/expectations/compiler/statements/iteration_basic.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 92a66681ea06c8cb19dc215276ff554dcb4813ca2f5bbf7e7aa227c74de098b2 - initial_ast: de27fc3c04be86714eb07fe8de58b5a8eb7544eab8933ef409dba539507d773c - unrolled_ast: 55ed6efeecb4cf6329d8dd473a7f3110a4a37729655f395070ed986453165894 + initial_ast: 73497c23aef0e13377f02b99e09f4a9e4911d7e52bd983e17fc05d2887fceebd + unrolled_ast: cd30825cf4e68e75fb3c4f49f6c846d412177f76f66effb1b02228e88b6f8f95 ssa_ast: c029103de91dd22a54c5c08d9923145c31ed7c4c116e70997046a4df00000fc5 flattened_ast: e59dcf566811200c1471438a427284f82bcf92d0981daffdf77c327d31bc3a9b diff --git a/tests/expectations/compiler/statements/iteration_nested.out b/tests/expectations/compiler/statements/iteration_nested.out index 79baad9c25..72b7fece52 100644 --- a/tests/expectations/compiler/statements/iteration_nested.out +++ b/tests/expectations/compiler/statements/iteration_nested.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: 842937fc80909e9970d8a830f85a1f5e5b17c56d2c0cb5a56c8b3c281ee550fa - initial_ast: 275dd1138dcf87e55b35a45e9d401a143a33610b078c06528bbbe7484b960871 - unrolled_ast: 1456d713173b810ad5d2a437aa6d2d1072f3a216d6fc69dd3da1b00f98853fa9 + initial_ast: 1d64d7937be610f2728215dec3511fc2d01613536b8fee4dfcf6624dc46f9d32 + unrolled_ast: 2a96b96106c8c49a43c4600181a6516dd1fb2f1f15827bf186d5d09102208058 ssa_ast: a6f99ed424b9cfdd70cf2552e869466b824477e0827e9cc4c89d81ce890da531 flattened_ast: c6b5eed63e09a2cdf2f96c51ac457e1328fc017ac671066badcfc9589993ff1d diff --git a/tests/expectations/compiler/statements/loop_returns_fail.out b/tests/expectations/compiler/statements/loop_returns_fail.out index e406da69f4..d976ea12df 100644 --- a/tests/expectations/compiler/statements/loop_returns_fail.out +++ b/tests/expectations/compiler/statements/loop_returns_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372027]: Loop body contains a return statement or always returns.\n --> compiler-test:6:9\n |\n 6 | for i: u32 in 0u32..9u32 {\n 7 | return false;\n 8 | }\n | ^\n |\n = Remove the code in the loop body that always returns.\nError [ETYC0372027]: Loop body contains a return statement or always returns.\n --> compiler-test:10:9\n |\n 10 | for i: u32 in 0u32..9u32 {\n 11 | if (x == 0u32) {\n 12 | return false;\n 13 | } else {\n 14 | return true;\n 15 | }\n 16 | }\n | ^\n |\n = Remove the code in the loop body that always returns.\n" + - "Error [ETYC0372026]: Loop body contains a return statement or always returns.\n --> compiler-test:6:9\n |\n 6 | for i: u32 in 0u32..9u32 {\n 7 | return false;\n 8 | }\n | ^\n |\n = Remove the code in the loop body that always returns.\nError [ETYC0372026]: Loop body contains a return statement or always returns.\n --> compiler-test:10:9\n |\n 10 | for i: u32 in 0u32..9u32 {\n 11 | if (x == 0u32) {\n 12 | return false;\n 13 | } else {\n 14 | return true;\n 15 | }\n 16 | }\n | ^\n |\n = Remove the code in the loop body that always returns.\n" diff --git a/tests/expectations/compiler/statements/multiple_returns_in_one_block_fail.out b/tests/expectations/compiler/statements/multiple_returns_in_one_block_fail.out index 55390ff623..514d0652d9 100644 --- a/tests/expectations/compiler/statements/multiple_returns_in_one_block_fail.out +++ b/tests/expectations/compiler/statements/multiple_returns_in_one_block_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372026]: Cannot reach the following statement.\n --> compiler-test:6:9\n |\n 6 | let double: u32 = x + x;\n | ^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\nError [ETYC0372026]: Cannot reach the following statement.\n --> compiler-test:7:9\n |\n 7 | return double;\n | ^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\n" + - "Error [ETYC0372025]: Cannot reach the following statement.\n --> compiler-test:6:9\n |\n 6 | let double: u32 = x + x;\n | ^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\nError [ETYC0372025]: Cannot reach the following statement.\n --> compiler-test:7:9\n |\n 7 | return double;\n | ^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\n" diff --git a/tests/expectations/compiler/statements/mutate.out b/tests/expectations/compiler/statements/mutate.out index a3f71ebc83..e21b92bf53 100644 --- a/tests/expectations/compiler/statements/mutate.out +++ b/tests/expectations/compiler/statements/mutate.out @@ -5,7 +5,7 @@ outputs: - output: - initial_input_ast: cf067aa39b2d02156103dfcec8ce73d76ce51d01d40cc41176fec00a94c2bd36 - initial_input_ast: 9635be649cbca13d8940d3af98a7a080b96a5d32b7088b3df36da7331251e9e7 - initial_ast: 0462592ed4588f3885ec8fdad2f9cc616a434509565cd2e9342f8bf4a74f88b4 - unrolled_ast: 0462592ed4588f3885ec8fdad2f9cc616a434509565cd2e9342f8bf4a74f88b4 + initial_ast: cbb5faacc61c1dbf7d5a851ba03e0c29ae4dc7aadc89573f5203ec6dacd126f4 + unrolled_ast: cbb5faacc61c1dbf7d5a851ba03e0c29ae4dc7aadc89573f5203ec6dacd126f4 ssa_ast: 9e04991db50242a16982bf582ff480b8e03ef9fa726f6041dcd737067f86810c flattened_ast: 5a6b5b16dda9bcef56336aa10483dd877fb7d1a5c4564132134dffdd890e0e9a diff --git a/tests/expectations/compiler/statements/operations/add_assign.out b/tests/expectations/compiler/statements/operations/add_assign.out index 75ad36d3e6..4fac3fcf7f 100644 --- a/tests/expectations/compiler/statements/operations/add_assign.out +++ b/tests/expectations/compiler/statements/operations/add_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 107f1d0851dd5008c58a747662aaa43c831dd0e957d3318f1de969b18f667e73 - unrolled_ast: 107f1d0851dd5008c58a747662aaa43c831dd0e957d3318f1de969b18f667e73 + initial_ast: 150b9163618a01475bdc82142ecb2df8c5cf8e580fc3883c13161db94e9ac2a8 + unrolled_ast: 150b9163618a01475bdc82142ecb2df8c5cf8e580fc3883c13161db94e9ac2a8 ssa_ast: 3093d934b791b2278ec63791e81130ed84d3fd1980e8dcf7a0ab51ccd304dabb flattened_ast: 8ec8eca21f0268fb97c9c90eea4917c15bff4573804ca7f2a59774489ab6bab2 diff --git a/tests/expectations/compiler/statements/operations/and_assign.out b/tests/expectations/compiler/statements/operations/and_assign.out index 16154c1a26..01d90e7b8b 100644 --- a/tests/expectations/compiler/statements/operations/and_assign.out +++ b/tests/expectations/compiler/statements/operations/and_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: fa6fba42a7ea1a28e5f362e118e9490923caf2afab6c199b9a556f70042081a6 - unrolled_ast: fa6fba42a7ea1a28e5f362e118e9490923caf2afab6c199b9a556f70042081a6 + initial_ast: 14b7300bc5bd4df10ff574634984e0520fd5316e62aded91c60fdb48217e8eb2 + unrolled_ast: 14b7300bc5bd4df10ff574634984e0520fd5316e62aded91c60fdb48217e8eb2 ssa_ast: 417a8d7e5d2bd79a08af12552a3e2b6e83970788151951cb7cfd4903efde09f0 flattened_ast: 39c7c45c1c8799117f16bae4cef3c6ea99d61887353a849548117ce59553bee9 diff --git a/tests/expectations/compiler/statements/operations/bitand_assign.out b/tests/expectations/compiler/statements/operations/bitand_assign.out index 5f36ff2ab3..7b6ef1acc9 100644 --- a/tests/expectations/compiler/statements/operations/bitand_assign.out +++ b/tests/expectations/compiler/statements/operations/bitand_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: b5e0f12ce770b0a6a06eca9936417c1fa9a537b4f636ddde7806cb159e23a7b3 - unrolled_ast: b5e0f12ce770b0a6a06eca9936417c1fa9a537b4f636ddde7806cb159e23a7b3 + initial_ast: 3fe59fccf232d40e0de905e76b4f32f4f170a09f3fe26129742a688f5114cdd7 + unrolled_ast: 3fe59fccf232d40e0de905e76b4f32f4f170a09f3fe26129742a688f5114cdd7 ssa_ast: 1d31ae3b3ab7321a737221dae532299f05519a43974b3fd44c08d6905d557549 flattened_ast: ade104ce0e33ebffffc3e4345916fe3fb0930ff0ccf46998686d1fe749a32574 diff --git a/tests/expectations/compiler/statements/operations/bitor_assign.out b/tests/expectations/compiler/statements/operations/bitor_assign.out index 6851aafb62..ec0c461826 100644 --- a/tests/expectations/compiler/statements/operations/bitor_assign.out +++ b/tests/expectations/compiler/statements/operations/bitor_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: e7c2c4e3a2c5322e666b7bbc66d5daed255dc13b2c9b4e13ff6077d9ac8a9c01 - unrolled_ast: e7c2c4e3a2c5322e666b7bbc66d5daed255dc13b2c9b4e13ff6077d9ac8a9c01 + initial_ast: 1ad378e32cb427705b1f3f47b5fbca221d29941869c1d4b1f694f040b8312b23 + unrolled_ast: 1ad378e32cb427705b1f3f47b5fbca221d29941869c1d4b1f694f040b8312b23 ssa_ast: 452274a06f35bf909a78b1a5ed8f207c47f692b0befde3afe7f2b9d86a2e79a2 flattened_ast: 9b9c215f91404103f5f97df4ee1326729095bee1350f1105d86787e2424d1576 diff --git a/tests/expectations/compiler/statements/operations/bitxor_assign.out b/tests/expectations/compiler/statements/operations/bitxor_assign.out index 343d969768..4aed4c71ae 100644 --- a/tests/expectations/compiler/statements/operations/bitxor_assign.out +++ b/tests/expectations/compiler/statements/operations/bitxor_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 02f64ca67ce553da286921c70857505b87d52de6181c5ea3c4a9d0413f97e8e1 - unrolled_ast: 02f64ca67ce553da286921c70857505b87d52de6181c5ea3c4a9d0413f97e8e1 + initial_ast: 07205f63e62053186500c3a3c2dc7e9b2f9a4e81b9b4e41445344989eb0537fa + unrolled_ast: 07205f63e62053186500c3a3c2dc7e9b2f9a4e81b9b4e41445344989eb0537fa ssa_ast: e6024395c7335973bb24d58c1d95324fde37e11f717cd286af5e579b1b3c21d9 flattened_ast: 6d0cee0c27cd0908fa80e665aea65577e9fd0f78b956151c2691c322f19f2f16 diff --git a/tests/expectations/compiler/statements/operations/div_assign.out b/tests/expectations/compiler/statements/operations/div_assign.out index 3feb8f4318..f285f0c814 100644 --- a/tests/expectations/compiler/statements/operations/div_assign.out +++ b/tests/expectations/compiler/statements/operations/div_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 0f8425bd813bef7dc28ceb6ec2cbedb57c86b9344a426670eaa526b63e92aeb0 - unrolled_ast: 0f8425bd813bef7dc28ceb6ec2cbedb57c86b9344a426670eaa526b63e92aeb0 + initial_ast: 3fefee679403c0a00fda454cd5b228d42e7ada7c24b8971287baf56b6a8dec1d + unrolled_ast: 3fefee679403c0a00fda454cd5b228d42e7ada7c24b8971287baf56b6a8dec1d ssa_ast: 749453ac0f0a0fa9a53ca6fa24e86f551a739bee7822c12d84e116ce7e95689f flattened_ast: 47a2049c2ddacca872359c5fc47d05975256a6b594c344cf980949842fb8e996 diff --git a/tests/expectations/compiler/statements/operations/mul_assign.out b/tests/expectations/compiler/statements/operations/mul_assign.out index 0e0feac82f..3472d1c15f 100644 --- a/tests/expectations/compiler/statements/operations/mul_assign.out +++ b/tests/expectations/compiler/statements/operations/mul_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: af6fa05ec73d4162c5218a7468788356175b83d69aab5fd9fa10a29f71af55dd - unrolled_ast: af6fa05ec73d4162c5218a7468788356175b83d69aab5fd9fa10a29f71af55dd + initial_ast: 43a681d3cf1bcaafd701691d1a25f6cc3b9e6812bfad61980e4378c4783bc219 + unrolled_ast: 43a681d3cf1bcaafd701691d1a25f6cc3b9e6812bfad61980e4378c4783bc219 ssa_ast: 8ca2c7f4413d47ad14ad11e09579fc94f36d616c62907a56153c56e400c4a5ed flattened_ast: d5a74f41b5da1d7d53530af643f3b2aac378c44e69efbc16685630cf44c521e2 diff --git a/tests/expectations/compiler/statements/operations/or_assign.out b/tests/expectations/compiler/statements/operations/or_assign.out index 3252caf09d..eff72aac7f 100644 --- a/tests/expectations/compiler/statements/operations/or_assign.out +++ b/tests/expectations/compiler/statements/operations/or_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: cacf8eea85d3273ce20bdbe7886e7aed3b2b25145b0945ceb97b6eaff37711b7 - unrolled_ast: cacf8eea85d3273ce20bdbe7886e7aed3b2b25145b0945ceb97b6eaff37711b7 + initial_ast: 3c9a955fa9a0abe749c3e1a24864a908b4bf81671b3f2ec06e7077142db65cab + unrolled_ast: 3c9a955fa9a0abe749c3e1a24864a908b4bf81671b3f2ec06e7077142db65cab ssa_ast: 01d9668ede44f8b7bc644ec7aebeeeab84bf606717630e754fd2269c8338c28f flattened_ast: 0a5c7aebb01ea8cac1cf91d6ea0001c3b81243aad442e56b44305717847dddde diff --git a/tests/expectations/compiler/statements/operations/rem_assign.out b/tests/expectations/compiler/statements/operations/rem_assign.out index 71b92a0755..b8a4a276d8 100644 --- a/tests/expectations/compiler/statements/operations/rem_assign.out +++ b/tests/expectations/compiler/statements/operations/rem_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 841ab2c3977b6976a9b6536bf58788fe0c42ca996dfdb81924e9ac26f5703df1 - unrolled_ast: 841ab2c3977b6976a9b6536bf58788fe0c42ca996dfdb81924e9ac26f5703df1 + initial_ast: e9040c7d8425ac170c5173c0e2bdc44bcea1a26049505d90533132e32967f9e4 + unrolled_ast: e9040c7d8425ac170c5173c0e2bdc44bcea1a26049505d90533132e32967f9e4 ssa_ast: a050342950b8059663b3b80cf1ef857de802ae87f3c7e7278ee42d1ad4bf429f flattened_ast: 616960e5955533df6fd14f706f59df6d680ed1aabc8ffbfac404e925273d29ac diff --git a/tests/expectations/compiler/statements/operations/sub_assign.out b/tests/expectations/compiler/statements/operations/sub_assign.out index fb6271af38..c37519a4e8 100644 --- a/tests/expectations/compiler/statements/operations/sub_assign.out +++ b/tests/expectations/compiler/statements/operations/sub_assign.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: 560b8d2866c997f8b06e09d1b3ff912015443cafae2a30e5e1caca9d8963fee5 - unrolled_ast: 560b8d2866c997f8b06e09d1b3ff912015443cafae2a30e5e1caca9d8963fee5 + initial_ast: f06ed7a8ff1b8789fa06a870ecc79ecfd244709bab6ae433e7601612f23858b9 + unrolled_ast: f06ed7a8ff1b8789fa06a870ecc79ecfd244709bab6ae433e7601612f23858b9 ssa_ast: 703cae2315903e5bdfb921a350fbff3ff5634493e9c3c1f52c231d54d3d771bb flattened_ast: 56bb8d92fff4ed5d1075efc4cc2e47e7150bc9185a99dc84bde91230498dc811 diff --git a/tests/expectations/compiler/statements/statements_after_complete_conditional_return_fail.out b/tests/expectations/compiler/statements/statements_after_complete_conditional_return_fail.out index 51855f3edc..1a16438f40 100644 --- a/tests/expectations/compiler/statements/statements_after_complete_conditional_return_fail.out +++ b/tests/expectations/compiler/statements/statements_after_complete_conditional_return_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372026]: Cannot reach the following statement.\n --> compiler-test:10:9\n |\n 10 | let double: u32 = x + x;\n | ^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\nError [ETYC0372026]: Cannot reach the following statement.\n --> compiler-test:11:9\n |\n 11 | return double;\n | ^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\n" + - "Error [ETYC0372025]: Cannot reach the following statement.\n --> compiler-test:10:9\n |\n 10 | let double: u32 = x + x;\n | ^^^^^^^^^^^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\nError [ETYC0372025]: Cannot reach the following statement.\n --> compiler-test:11:9\n |\n 11 | return double;\n | ^^^^^^^^^^^^^\n |\n = Remove the unreachable code.\n" diff --git a/tests/expectations/compiler/structs/duplicate_name_context.out b/tests/expectations/compiler/structs/duplicate_name_context.out index 6fae0ba415..4fd598a3d8 100644 --- a/tests/expectations/compiler/structs/duplicate_name_context.out +++ b/tests/expectations/compiler/structs/duplicate_name_context.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372009]: struct `Bar` shadowed by\n --> compiler-test:9:9\n |\n 9 | const Bar: u32 = 66u32;\n | ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Error [EAST0372007]: struct `Bar` shadowed by\n --> compiler-test:9:15\n |\n 9 | const Bar: u32 = 66u32;\n | ^^^\n" diff --git a/tests/expectations/compiler/structs/inline.out b/tests/expectations/compiler/structs/inline.out index 6598867248..ec3558fdf2 100644 --- a/tests/expectations/compiler/structs/inline.out +++ b/tests/expectations/compiler/structs/inline.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: d9c09573d39ddbb58c5d8febfcda25692a2b2cef7a159229a936f72c72af14f8 - unrolled_ast: d9c09573d39ddbb58c5d8febfcda25692a2b2cef7a159229a936f72c72af14f8 + initial_ast: 17a33a274413c0ee4dc1a4b04fdc995eba799db8c3149467a0b5a228d47c51be + unrolled_ast: 17a33a274413c0ee4dc1a4b04fdc995eba799db8c3149467a0b5a228d47c51be ssa_ast: 9d577a590f2f6726565874c656f607c3515f266457944235e973aab16085d85a flattened_ast: 4911377ac4dace705ebf5d7f73917624882ea99a4f02553cf41649a42ae6b5dc diff --git a/tests/expectations/compiler/structs/inline_member_pass.out b/tests/expectations/compiler/structs/inline_member_pass.out index 058949f252..d0b86bb85c 100644 --- a/tests/expectations/compiler/structs/inline_member_pass.out +++ b/tests/expectations/compiler/structs/inline_member_pass.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372029]: Standard functions cannot have modes associated with their inputs.\n --> compiler-test:8:25\n |\n 8 | function main(const x: u8, y: bool) -> bool {\n | ^\n |\n = Consider removing the mode or using the keyword `transition` instead of `function`.\nError [ETYC0372005]: Unknown variable `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372004]: Could not determine the type of `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372003]: Expected type `u8` but type `no type` was found\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^^^^^^^^^^\n" + - "Error [ETYC0372028]: Standard functions cannot have modes associated with their inputs.\n --> compiler-test:8:25\n |\n 8 | function main(const x: u8, y: bool) -> bool {\n | ^\n |\n = Consider removing the mode or using the keyword `transition` instead of `function`.\nError [ETYC0372005]: Unknown variable `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372004]: Could not determine the type of `b`\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^\nError [ETYC0372003]: Expected type `u8` but type `no type` was found\n --> compiler-test:11:17\n |\n 11 | return (b.x == a.x) == y;\n | ^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/structs/member_variable.out b/tests/expectations/compiler/structs/member_variable.out index ad504b61e0..c0e2e3492e 100644 --- a/tests/expectations/compiler/structs/member_variable.out +++ b/tests/expectations/compiler/structs/member_variable.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: d65bec1b0631561409a63b534d5fd05dfc7137fe4a66bc2df854f0ee53e35d5c - initial_ast: a6abd2f768b5ade612fd51d1ed3ddcd8f9bbe4fe8816942ae7531c72d1dfb579 - unrolled_ast: a6abd2f768b5ade612fd51d1ed3ddcd8f9bbe4fe8816942ae7531c72d1dfb579 + initial_ast: 7f060dd13303ffad53ece6089e5ebe7fb12a9a8a03bc570acf613887cebe800e + unrolled_ast: 7f060dd13303ffad53ece6089e5ebe7fb12a9a8a03bc570acf613887cebe800e ssa_ast: 9c7729dc4105561c4c3acab633f93dbcc3a7d4f75c9fb9ba5c930158dc499589 flattened_ast: 11d7604f049bb027476d70bbd5dd3888e45b7dde7aad106dc7214f70c5c756bf diff --git a/tests/expectations/compiler/structs/struct_contains_record_fail.out b/tests/expectations/compiler/structs/struct_contains_record_fail.out index 337b106b1b..2eda725270 100644 --- a/tests/expectations/compiler/structs/struct_contains_record_fail.out +++ b/tests/expectations/compiler/structs/struct_contains_record_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372030]: A struct or record cannot contain another record.\n --> compiler-test:6:9\n |\n 6 | token: Token,\n | ^^^^^\n |\n = Remove the record `Token` from `Foo`.\n" + - "Error [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:6:9\n |\n 6 | token: Token,\n | ^^^^^\n |\n = Remove the record `Token` from `Foo`.\n" diff --git a/tests/expectations/compiler/structs/struct_function_namespace_conflict_fail.out b/tests/expectations/compiler/structs/struct_function_namespace_conflict_fail.out index 52649d8ca5..7905e3ca05 100644 --- a/tests/expectations/compiler/structs/struct_function_namespace_conflict_fail.out +++ b/tests/expectations/compiler/structs/struct_function_namespace_conflict_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372009]: struct `Foo` shadowed by\n --> compiler-test:8:5\n |\n 8 | function Foo() {}\n | ^^^^^^^^^^^^^^^^^\n" + - "Error [EAST0372007]: struct `Foo` shadowed by\n --> compiler-test:8:5\n |\n 8 | function Foo() {}\n | ^^^^^^^^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/structs/struct_init_out_of_order.out b/tests/expectations/compiler/structs/struct_init_out_of_order.out index 219d79d559..5302fc6af3 100644 --- a/tests/expectations/compiler/structs/struct_init_out_of_order.out +++ b/tests/expectations/compiler/structs/struct_init_out_of_order.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - output: - initial_input_ast: no input - initial_ast: ee77db4e7764e7549e811d72bdadfa7745c5aaf32ce5f14d249fe3e8b7d89c82 - unrolled_ast: ee77db4e7764e7549e811d72bdadfa7745c5aaf32ce5f14d249fe3e8b7d89c82 - ssa_ast: 889e963439cf40760d910204a6afbabe14fb851e9da43dd9ef66fece4950c500 - flattened_ast: 2aa67d2ef93312e93260502b9e3b303df53b7eff491c9cf2f893ac20df039bb2 + initial_ast: 059fe78a4c3d04727360a83c51e2f18a3eda6629300062adc0a351d6da1a095f + unrolled_ast: 059fe78a4c3d04727360a83c51e2f18a3eda6629300062adc0a351d6da1a095f + ssa_ast: 96afbdef0d611fd02c6305e47d5f6a08a442973d6bd993c8550199598a3ede35 + flattened_ast: e332cdf53f12fa4caeaa9d4c49b623d61b6d6975d0c8cbc9376398939b944eff diff --git a/tests/expectations/compiler/structs/unknown_member_type_fail.out b/tests/expectations/compiler/structs/unknown_member_type_fail.out index 765aed0d7e..fc3278db78 100644 --- a/tests/expectations/compiler/structs/unknown_member_type_fail.out +++ b/tests/expectations/compiler/structs/unknown_member_type_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372017]: The type `Bar` is not found in the current scope.\n --> compiler-test:4:5\n |\n 4 | struct Foo {\n 5 | a: u8,\n 6 | bar: Bar,\n 7 | }\n | ^\n" + - "Error [ETYC0372017]: The type `Bar` is not found in the current scope.\n --> compiler-test:6:9\n |\n 6 | bar: Bar,\n | ^^^\n" diff --git a/tests/expectations/compiler/tuple/access_negative_fail.out b/tests/expectations/compiler/tuple/access_negative_fail.out index 24ebcb77ec..eb62bf93a4 100644 --- a/tests/expectations/compiler/tuple/access_negative_fail.out +++ b/tests/expectations/compiler/tuple/access_negative_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:5:16\n |\n 5 | let t: (bool, bool) = (a, b);\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '-'\n --> compiler-test:7:24\n |\n 7 | return (t.0, t.-1); // Index `t.-1` is invalid.\n | ^" diff --git a/tests/expectations/compiler/tuple/access_out_of_bounds_fail.out b/tests/expectations/compiler/tuple/access_out_of_bounds_fail.out index 24ebcb77ec..2eb3a4232f 100644 --- a/tests/expectations/compiler/tuple/access_out_of_bounds_fail.out +++ b/tests/expectations/compiler/tuple/access_out_of_bounds_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:5:16\n |\n 5 | let t: (bool, bool) = (a, b);\n | ^" + - "Error [ETYC0372024]: Tuple index `2` out of range for a tuple with length `2`\n --> compiler-test:7:24\n |\n 7 | return (t.0, t.2); // Index `t.2` is out of bounds.\n | ^\nError [ETYC0372014]: t.2 is not a valid core function call.\n --> compiler-test:7:24\n |\n 7 | return (t.0, t.2); // Index `t.2` is out of bounds.\n | ^\n" diff --git a/tests/expectations/compiler/tuple/assign_unit_fail.out b/tests/expectations/compiler/tuple/assign_unit_fail.out new file mode 100644 index 0000000000..f09242f943 --- /dev/null +++ b/tests/expectations/compiler/tuple/assign_unit_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372062]: The left-hand side of a `DefinitionStatement` can only be an identifier or tuple. Note that a tuple must contain at least two elements.\n --> compiler-test:6:9\n |\n 6 | let b: () = ();\n | ^^^^^^^^^^^^^^\nError [ETYC0372063]: Unit expressions can only be used in return statements.\n --> compiler-test:6:21\n |\n 6 | let b: () = ();\n | ^^\nError [ETYC0372062]: The left-hand side of a `DefinitionStatement` can only be an identifier or tuple. Note that a tuple must contain at least two elements.\n --> compiler-test:11:9\n |\n 11 | let b: () = bar();\n | ^^^^^^^^^^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:11:21\n |\n 11 | let b: () = bar();\n | ^^^^^\nError [ETYC0372006]: Call expected `1` args, but got `0`\n --> compiler-test:11:21\n |\n 11 | let b: () = bar();\n | ^^^^^\n" diff --git a/tests/expectations/compiler/tuple/declare_fail.out b/tests/expectations/compiler/tuple/declare_fail.out index 843c2205e4..9c81abf0ef 100644 --- a/tests/expectations/compiler/tuple/declare_fail.out +++ b/tests/expectations/compiler/tuple/declare_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:5:16\n |\n 5 | let t: (bool, bool) = (a, 1u64); // We should be declaring to a boolean, not a u64.\n | ^" + - "Error [ETYC0372003]: Expected type `boolean` but type `u64` was found\n --> compiler-test:5:35\n |\n 5 | let t: (bool, bool) = (a, 1u64); // We should be declaring to a boolean, not a u64.\n | ^^^^\n" diff --git a/tests/expectations/compiler/tuple/function_call_returns_tuple.out b/tests/expectations/compiler/tuple/function_call_returns_tuple.out new file mode 100644 index 0000000000..9b73317dda --- /dev/null +++ b/tests/expectations/compiler/tuple/function_call_returns_tuple.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 5ab54cda0607e33168dc872a084b04060b6df6bd5adf082699f4442b433e28a8 + unrolled_ast: 5ab54cda0607e33168dc872a084b04060b6df6bd5adf082699f4442b433e28a8 + ssa_ast: b29e8acace1989abe352c27a226675f851545f088f7748a5aca8c2dd69171b0b + flattened_ast: ddf977a5d329dcc6859b86273da37f82d4db5b01500985414f37f2a8d7ec14dc diff --git a/tests/expectations/compiler/tuple/function_early_return.out b/tests/expectations/compiler/tuple/function_early_return.out index 1cc831ab45..c93146e80d 100644 --- a/tests/expectations/compiler/tuple/function_early_return.out +++ b/tests/expectations/compiler/tuple/function_early_return.out @@ -3,8 +3,8 @@ namespace: Compile expectation: Pass outputs: - output: - - initial_input_ast: 00dee470435062239e3deabf1c7c3a0d979cc6b9cb98cdddf9060f1d8f779a81 - initial_ast: b3c7e39db13677463ab2edcb27bc7343d948b32e7659a45d0d1d25ced3810027 - unrolled_ast: b3c7e39db13677463ab2edcb27bc7343d948b32e7659a45d0d1d25ced3810027 - ssa_ast: 0d7e0c27827db401c41bd932c72f1803de26131a614847afd99071f216013376 - flattened_ast: caa24d8c0d01ad12c0fabc8886e82108be990259784a74d4ab3324dd09cafd57 + - initial_input_ast: 4b76482a4ce430ee2bd89f30252c51cc9016ca24972760aae8e95563035c6598 + initial_ast: 97cefab0846003b7e1c75069738e8f029dd7c44dcd7f0e6b71c15058fb817fb8 + unrolled_ast: 97cefab0846003b7e1c75069738e8f029dd7c44dcd7f0e6b71c15058fb817fb8 + ssa_ast: bb043427c3299ae80b1c1bba7156f1e5d171e233eb87e0abe8dbb38de6b16caa + flattened_ast: 00a60f5f73bdcbc98eb6027326a115ea876edfa70649da0df89791f19bf306e6 diff --git a/tests/expectations/compiler/tuple/function_return.out b/tests/expectations/compiler/tuple/function_return.out index 73d1ee19b0..40cc56ea44 100644 --- a/tests/expectations/compiler/tuple/function_return.out +++ b/tests/expectations/compiler/tuple/function_return.out @@ -3,8 +3,8 @@ namespace: Compile expectation: Pass outputs: - output: - - initial_input_ast: 532e0e33d02b7938bde87f7ecb3ee198642e8bedc609664ed97f08d734aaa8f5 + - initial_input_ast: 5fbb592d735615d058af0faf65bfe562a11bd5a31beba7cfe2b883fc71defc8c initial_ast: 954b83c9c3c04f435be040729533102dbff38cbb6c938d0344925bc2c52ec3b2 unrolled_ast: 954b83c9c3c04f435be040729533102dbff38cbb6c938d0344925bc2c52ec3b2 - ssa_ast: fcc6ce3831f9a257bd64158e4876821c525effb27b24e08632dd378adfc06204 - flattened_ast: 7f698e1f9641c709449d9da05e15c5759939801bc9f470a202258e2af668486a + ssa_ast: 83bedff67ab9b4af29a77cd148b9498b0981fa14580e21716796e6926bd5285e + flattened_ast: 9ac24d219355060364019826a51f0713aa3918eb8a3db4471231440a0dd49fad diff --git a/tests/expectations/compiler/tuple/function_return_nothing.out b/tests/expectations/compiler/tuple/function_return_nothing.out new file mode 100644 index 0000000000..29d03e50a3 --- /dev/null +++ b/tests/expectations/compiler/tuple/function_return_nothing.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 1a81fc79fbd61a51db3d300d5eb64e9108b60f0c83abecf946ab6a43aa05abee + initial_ast: 2b8b08ac0834c20e30e5aac2d39f2a1d60aef024587b62209708638986053de1 + unrolled_ast: 2b8b08ac0834c20e30e5aac2d39f2a1d60aef024587b62209708638986053de1 + ssa_ast: 2b8b08ac0834c20e30e5aac2d39f2a1d60aef024587b62209708638986053de1 + flattened_ast: eaed8b8a1a24eb23ec384fbd27c885db1c2437a398c304bd2f9b6ed9de2e9fa5 diff --git a/tests/expectations/compiler/tuple/function_return_single_fail.out b/tests/expectations/compiler/tuple/function_return_single_fail.out index 0bcd0578a3..c3204cde49 100644 --- a/tests/expectations/compiler/tuple/function_return_single_fail.out +++ b/tests/expectations/compiler/tuple/function_return_single_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Failed to parse string. Parsing Error: VerboseError { errors: [(\"closure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n output r0 as boolean;\\n\\n\\n\", Nom(Tag)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n output r0 as boolean;\\n\\n\\n\", Nom(Alt)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n output r0 as boolean;\\n\\n\\n\", Nom(Many1))] }" + - "Error [EPAR0370030]: A tuple expression must have at least two elements.\n --> compiler-test:9:16\n |\n 9 | return (b,);\n | ^^^^" diff --git a/tests/expectations/compiler/tuple/function_return_unit.out b/tests/expectations/compiler/tuple/function_return_unit.out new file mode 100644 index 0000000000..ea6932e60c --- /dev/null +++ b/tests/expectations/compiler/tuple/function_return_unit.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: ba75ac7ea183c8a86596b63c2dcc42bdc2d7a02cfa8f1d2e16f3c2c33bfe4f2e + initial_ast: 2b8b08ac0834c20e30e5aac2d39f2a1d60aef024587b62209708638986053de1 + unrolled_ast: 2b8b08ac0834c20e30e5aac2d39f2a1d60aef024587b62209708638986053de1 + ssa_ast: 2b8b08ac0834c20e30e5aac2d39f2a1d60aef024587b62209708638986053de1 + flattened_ast: eaed8b8a1a24eb23ec384fbd27c885db1c2437a398c304bd2f9b6ed9de2e9fa5 diff --git a/tests/expectations/compiler/tuple/function_return_varying_modes.out b/tests/expectations/compiler/tuple/function_return_varying_modes.out new file mode 100644 index 0000000000..7f7f4ad0b5 --- /dev/null +++ b/tests/expectations/compiler/tuple/function_return_varying_modes.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 83b847eab54f967d44f321a5f0244c0912810eb277f5e590044bf716c7b6c734 + unrolled_ast: 83b847eab54f967d44f321a5f0244c0912810eb277f5e590044bf716c7b6c734 + ssa_ast: f14f674da8459d980fa06e0075fec29d29020204142e7a0b159e434926dd44f8 + flattened_ast: 45fbe9a7af2a427d9fa6914c5866ea16df0cb86207b694a51aecb814fec11354 diff --git a/tests/expectations/compiler/tuple/function_return_zero_fail.out b/tests/expectations/compiler/tuple/function_return_zero_fail.out deleted file mode 100644 index 53da785600..0000000000 --- a/tests/expectations/compiler/tuple/function_return_zero_fail.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Failed to parse string. Parsing Error: VerboseError { errors: [(\"closure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\\n\\n\", Nom(Tag)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\\n\\n\", Nom(Alt)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\\n\\n\", Nom(Many1))] }" diff --git a/tests/expectations/compiler/tuple/function_unit_input_fail.out b/tests/expectations/compiler/tuple/function_unit_input_fail.out new file mode 100644 index 0000000000..b9a9c692b4 --- /dev/null +++ b/tests/expectations/compiler/tuple/function_unit_input_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372063]: Unit expressions can only be used in return statements.\n --> compiler-test:10:13\n |\n 10 | foo(());\n | ^^\n" diff --git a/tests/expectations/compiler/tuple/return_statement_fail.out b/tests/expectations/compiler/tuple/return_statement_fail.out index 24ebcb77ec..5e3c5ad3c4 100644 --- a/tests/expectations/compiler/tuple/return_statement_fail.out +++ b/tests/expectations/compiler/tuple/return_statement_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:5:16\n |\n 5 | let t: (bool, bool) = (a, b);\n | ^" + - "Error [ETYC0372003]: Expected type `u64` but type `boolean` was found\n --> compiler-test:7:24\n |\n 7 | return (t.0, t.1); // The second element should be type u64 as in the function declaration.\n | ^\n" diff --git a/tests/expectations/compiler/tuple/return_with_different_modes.out b/tests/expectations/compiler/tuple/return_with_different_modes.out new file mode 100644 index 0000000000..a65b1568c8 --- /dev/null +++ b/tests/expectations/compiler/tuple/return_with_different_modes.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 50aaf721f09a37dbc40bb4b831dc99144a32acd2dfbb73c3e0a507c025ddeb3c + unrolled_ast: 50aaf721f09a37dbc40bb4b831dc99144a32acd2dfbb73c3e0a507c025ddeb3c + ssa_ast: bcc7213b1f7f67022a9954e6b0679acecd35abc9c39023263d373d469ed6d81f + flattened_ast: 153b3c7942b7e7d4b4b49a655249015703b5d6694b810a4f4cd86685b67eba74 diff --git a/tests/expectations/compiler/tuple/singleton_tuple_fail.out b/tests/expectations/compiler/tuple/singleton_tuple_fail.out new file mode 100644 index 0000000000..902c23ac65 --- /dev/null +++ b/tests/expectations/compiler/tuple/singleton_tuple_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [EPAR0370030]: A tuple type must have at least two elements.\n --> compiler-test:7:16\n |\n 7 | let c: (u8) = (a);\n | ^^^^" diff --git a/tests/expectations/compiler/tuple/tuple_access.out b/tests/expectations/compiler/tuple/tuple_access.out new file mode 100644 index 0000000000..092c17a0f9 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_access.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 22eee528fd6b53b5a9faaaff13295e210a1d94470cb1620d30ea7fde46b4153a + unrolled_ast: 22eee528fd6b53b5a9faaaff13295e210a1d94470cb1620d30ea7fde46b4153a + ssa_ast: 3ef50f2cfca9dd0d0af10810aa4f7767f3adf8fd4c3f54f6d1c503901510a6b7 + flattened_ast: 50f5304628172ecd7e6d19c53f4fc57a4df3f4e76df18152804f34f42ac81e7d diff --git a/tests/expectations/compiler/tuple/tuple_destructure.out b/tests/expectations/compiler/tuple/tuple_destructure.out new file mode 100644 index 0000000000..86c0b728e9 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_destructure.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: a15b74da5580b0792fe916efb0b9332e2b83f7522cd74fed237be6c6936fb668 + unrolled_ast: a15b74da5580b0792fe916efb0b9332e2b83f7522cd74fed237be6c6936fb668 + ssa_ast: f396ec6e85dd5a073f7b2e43b34e5f04b66b1451eef61fec0ed200b457a73ae3 + flattened_ast: 83b968486e146128379719eb58aa78b4082f9340c69b2e6363c6c1524711e5b2 diff --git a/tests/expectations/compiler/tuple/tuple_in_assignment.out b/tests/expectations/compiler/tuple/tuple_in_assignment.out new file mode 100644 index 0000000000..4a47c3e896 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_in_assignment.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 1de945d6536b91ba47781e5bbb9b15893ae4b9a24d5179055442fb1d5d08b520 + unrolled_ast: 1de945d6536b91ba47781e5bbb9b15893ae4b9a24d5179055442fb1d5d08b520 + ssa_ast: f13ee06db150eecf24ef65504fb8b36f055a962c328b1c1fbb7bd15edc6050bd + flattened_ast: 7152760b06956005659ff36441463b342a22cc27ece042f8be4c60b82e933de0 diff --git a/tests/expectations/compiler/tuple/tuple_in_definition.out b/tests/expectations/compiler/tuple/tuple_in_definition.out new file mode 100644 index 0000000000..d431b66075 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_in_definition.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 9ead3350277e64fe148ff915e1403f5014b3985579c0fa8465d39ba9dc6e824b + unrolled_ast: 9ead3350277e64fe148ff915e1403f5014b3985579c0fa8465d39ba9dc6e824b + ssa_ast: 7f40008e13afc929b3e59faa3733ed176b8e14d701c5252551d9f5f9e746dfdc + flattened_ast: 7b235acfaf20aaaa932ed8f4c70132c5aa8cb45e1b4072c876a09a82f355b71b diff --git a/tests/expectations/compiler/tuple/tuple_in_function_param.out b/tests/expectations/compiler/tuple/tuple_in_function_param.out new file mode 100644 index 0000000000..48c20b9668 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_in_function_param.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372056]: A function cannot take in a tuple as input.\n --> compiler-test:4:20\n |\n 4 | transition foo(a: (u8, u16)) -> (u8, u16) {\n | ^\n" diff --git a/tests/expectations/compiler/tuple/tuple_in_loop.out b/tests/expectations/compiler/tuple/tuple_in_loop.out new file mode 100644 index 0000000000..c31f20c980 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_in_loop.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 968511d5db21ddb5b15c32e39f4bdc09a660aa4451b635a9b39995164f02cc54 + unrolled_ast: 11991b57aead7a4ddbfc651381883fcd69d5d5fe7bf8c7bdb4271f99ab79f990 + ssa_ast: aa6613096954288dc6aa71612b29d25587f3494aaeca0820e197146f32bd5427 + flattened_ast: 5aec71dc4c8cd2b6c46e77d46e0c5aca9b3905fe694bf07afcf04d99450f4cee diff --git a/tests/expectations/compiler/tuple/tuple_in_record_fail.out b/tests/expectations/compiler/tuple/tuple_in_record_fail.out new file mode 100644 index 0000000000..1dae4627f2 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_in_record_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | amounts: (u64, u64),\n | ^^^^^^^\n" diff --git a/tests/expectations/compiler/tuple/tuple_in_return_type.out b/tests/expectations/compiler/tuple/tuple_in_return_type.out new file mode 100644 index 0000000000..3724da1c31 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_in_return_type.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372054]: A tuple type cannot contain a tuple.\n --> compiler-test:4:35\n |\n 4 | transition bar(a: u8) -> (u8, (u8, u8)) {\n | ^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:5:20\n |\n 5 | return (a, (a + a, a * a));\n | ^^^^^^^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:5:20\n |\n 5 | return (a, (a + a, a * a));\n | ^^^^^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/tuple/tuple_in_struct_fail.out b/tests/expectations/compiler/tuple/tuple_in_struct_fail.out new file mode 100644 index 0000000000..173191b051 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_in_struct_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:5:9\n |\n 5 | mem: (u8, u16)\n | ^^^\nError [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:9:9\n |\n 9 | mems: (A, A)\n | ^^^^\n" diff --git a/tests/expectations/compiler/tuple/tuple_not_allowed.out b/tests/expectations/compiler/tuple/tuple_not_allowed.out deleted file mode 100644 index f644080f30..0000000000 --- a/tests/expectations/compiler/tuple/tuple_not_allowed.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:8:21\n |\n 8 | function foo(a: (u8, u16)) -> (u8, u16) {\n | ^" diff --git a/tests/expectations/compiler/tuple/tuple_not_allowed_fail.out b/tests/expectations/compiler/tuple/tuple_not_allowed_fail.out new file mode 100644 index 0000000000..8c3f551d81 --- /dev/null +++ b/tests/expectations/compiler/tuple/tuple_not_allowed_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:22:9\n |\n 22 | mem: (u8, u16)\n | ^^^\nError [ETYC0372056]: A function cannot take in a tuple as input.\n --> compiler-test:8:18\n |\n 8 | function foo(a: (u8, u16)) -> (u8, u16) {\n | ^\nError [ETYC0372054]: A tuple type cannot contain a tuple.\n --> compiler-test:12:28\n |\n 12 | function bar() -> (u8, (u16, u32)) {\n | ^^^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `i8, i16, i32, i64, i128, u8, u16, u32, u64, u128`, but got `(u8,u16)`\n --> compiler-test:17:13\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:29\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:34\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\n" diff --git a/tests/expectations/compiler/tuple/type_fail.out b/tests/expectations/compiler/tuple/type_fail.out index bf06e90810..8dc2824c18 100644 --- a/tests/expectations/compiler/tuple/type_fail.out +++ b/tests/expectations/compiler/tuple/type_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found '('\n --> compiler-test:5:16\n |\n 5 | let t: (bool, u64) = (a, b); // We should expect a boolean, not a u64.\n | ^" + - "Error [ETYC0372003]: Expected type `u64` but type `boolean` was found\n --> compiler-test:5:34\n |\n 5 | let t: (bool, u64) = (a, b); // We should expect a boolean, not a u64.\n | ^\nError [ETYC0372003]: Expected type `boolean` but type `u64` was found\n --> compiler-test:7:24\n |\n 7 | return (t.0, t.1);\n | ^\n" diff --git a/tests/expectations/compiler/tuple/unit.out b/tests/expectations/compiler/tuple/unit.out new file mode 100644 index 0000000000..cf2e70d854 --- /dev/null +++ b/tests/expectations/compiler/tuple/unit.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 9667486318cf08b4a5c76d913a853564f3628104d16cd960cab04d37850a0185 + unrolled_ast: 9667486318cf08b4a5c76d913a853564f3628104d16cd960cab04d37850a0185 + ssa_ast: 9667486318cf08b4a5c76d913a853564f3628104d16cd960cab04d37850a0185 + flattened_ast: d24e68675c57fc9ed8b252e07a9ef50d5ee4a739b011cd127b5d552840aa0e71 diff --git a/tests/expectations/parser/finalize/decrement_fail.out b/tests/expectations/parser/finalize/decrement_fail.out index 403ce17be7..81358c4704 100644 --- a/tests/expectations/parser/finalize/decrement_fail.out +++ b/tests/expectations/parser/finalize/decrement_fail.out @@ -7,4 +7,3 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'identifier', found ')'\n --> test:1:11\n |\n 1 | decrement();\n | ^" - "Error [EPAR0370005]: expected , -- found ')'\n --> test:1:15\n |\n 1 | decrement(floo)\n | ^" - "Error [EPAR0370005]: expected ( -- found 'foo'\n --> test:1:11\n |\n 1 | decrement foo[bar] by baz;\n | ^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | decremet(foo, bar, baz);\n | ^^^^^^^^^^^^^^^^^^^^^^^^" diff --git a/tests/expectations/parser/finalize/finalize_statement_fail.out b/tests/expectations/parser/finalize/finalize_statement_fail.out index 0a1814dd73..80aaae1124 100644 --- a/tests/expectations/parser/finalize/finalize_statement_fail.out +++ b/tests/expectations/parser/finalize/finalize_statement_fail.out @@ -2,9 +2,9 @@ namespace: ParseStatement expectation: Fail outputs: - - "Error [EPAR0370026]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize(;\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." - - "Error [EPAR0370026]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize(foo, ,);\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." - - "Error [EPAR0370026]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize(foo, bar)\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." + - "Error [EPAR0370025]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize(;\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." + - "Error [EPAR0370025]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize(foo, ,);\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." + - "Error [EPAR0370025]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize(foo, bar)\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." - "Error [EPAR0370005]: expected finalize -- found 'async'\n --> test:1:7\n |\n 1 | async async finalize(foo);\n | ^^^^^" - - "Error [EPAR0370026]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize;\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." + - "Error [EPAR0370025]: A finalize statement must be preceded by the `async` keyword.\n --> test:1:1\n |\n 1 | finalize;\n | ^^^^^^^^\n |\n = Add the `async` keyword before the `finalize` keyword." - "Error [EPAR0370005]: expected ; -- found 'finalize'\n --> test:1:6\n |\n 1 | asyn finalize(foo);\n | ^^^^^^^^" diff --git a/tests/expectations/parser/finalize/increment_fail.out b/tests/expectations/parser/finalize/increment_fail.out index f286c769a2..0532074b14 100644 --- a/tests/expectations/parser/finalize/increment_fail.out +++ b/tests/expectations/parser/finalize/increment_fail.out @@ -7,4 +7,3 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'identifier', found ')'\n --> test:1:11\n |\n 1 | increment();\n | ^" - "Error [EPAR0370005]: expected , -- found ')'\n --> test:1:15\n |\n 1 | increment(floo)\n | ^" - "Error [EPAR0370005]: expected ( -- found 'foo'\n --> test:1:11\n |\n 1 | increment foo[bar] by baz;\n | ^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | incremet(foo, bar, baz);\n | ^^^^^^^^^^^^^^^^^^^^^^^^" diff --git a/tests/expectations/parser/functions/bounded_recursion.out b/tests/expectations/parser/functions/bounded_recursion.out index 10429f1aae..08d7b103e7 100644 --- a/tests/expectations/parser/functions/bounded_recursion.out +++ b/tests/expectations/parser/functions/bounded_recursion.out @@ -1,5 +1,155 @@ --- namespace: Parse -expectation: Fail +expectation: Pass outputs: - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:6:13\n |\n 6 | x(y+1u32);\n | ^^^^^^^^^^\nError [EPAR0370021]: Expression statements are not supported.\n --> test:11:9\n |\n 11 | x(1u32);\n | ^^^^^^^^" + - 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: + "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}": + annotations: [] + call_type: Standard + identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}" + input: + - Internal: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":50,\\\"hi\\\":51}\"}" + mode: Const + type_: + Integer: U32 + span: + lo: 50 + hi: 51 + output: + - Internal: + mode: None + type_: + Integer: U8 + span: + lo: 61 + hi: 63 + output_type: + Integer: U8 + block: + statements: + - Conditional: + condition: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":77,\\\"hi\\\":78}\"}" + right: + Literal: + Integer: + - U32 + - "5" + - span: + lo: 81 + hi: 85 + op: Lt + span: + lo: 77 + hi: 85 + then: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":100,\\\"hi\\\":101}\"}" + arguments: + - Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":102,\\\"hi\\\":103}\"}" + right: + Literal: + Integer: + - U32 + - "1" + - span: + lo: 104 + hi: 108 + op: Add + span: + lo: 102 + hi: 108 + external: ~ + span: + lo: 100 + hi: 109 + span: + lo: 100 + hi: 110 + span: + lo: 86 + hi: 120 + otherwise: ~ + span: + lo: 74 + hi: 120 + span: + lo: 64 + hi: 126 + finalize: ~ + span: + lo: 30 + hi: 126 + "{\"name\":\"main\",\"span\":\"{\\\"lo\\\":145,\\\"hi\\\":149}\"}": + annotations: [] + call_type: Standard + identifier: "{\"name\":\"main\",\"span\":\"{\\\"lo\\\":145,\\\"hi\\\":149}\"}" + input: + - Internal: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":150,\\\"hi\\\":151}\"}" + mode: None + type_: Boolean + span: + lo: 150 + hi: 151 + output: + - Internal: + mode: None + type_: Boolean + span: + lo: 162 + hi: 166 + output_type: Boolean + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":177,\\\"hi\\\":178}\"}" + arguments: + - Literal: + Integer: + - U32 + - "1" + - span: + lo: 179 + hi: 183 + external: ~ + span: + lo: 177 + hi: 184 + span: + lo: 177 + hi: 185 + - Return: + expression: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":201,\\\"hi\\\":202}\"}" + span: + lo: 194 + hi: 202 + span: + lo: 167 + hi: 209 + finalize: ~ + span: + lo: 136 + hi: 209 + span: + lo: 2 + hi: 211 diff --git a/tests/expectations/parser/functions/infinite_recursion.out b/tests/expectations/parser/functions/infinite_recursion.out index a86d6a34e3..866a475571 100644 --- a/tests/expectations/parser/functions/infinite_recursion.out +++ b/tests/expectations/parser/functions/infinite_recursion.out @@ -1,5 +1,99 @@ --- namespace: Parse -expectation: Fail +expectation: Pass outputs: - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:5:9\n |\n 5 | inf();\n | ^^^^^^\nError [EPAR0370021]: Expression statements are not supported.\n --> test:9:9\n |\n 9 | inf();\n | ^^^^^^" + - 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: + "{\"name\":\"inf\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":42}\"}": + annotations: [] + call_type: Standard + identifier: "{\"name\":\"inf\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":42}\"}" + input: [] + output: + - Internal: + mode: None + type_: + Integer: U8 + span: + lo: 48 + hi: 50 + output_type: + Integer: U8 + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"inf\",\"span\":\"{\\\"lo\\\":61,\\\"hi\\\":64}\"}" + arguments: [] + external: ~ + span: + lo: 61 + hi: 66 + span: + lo: 61 + hi: 67 + span: + lo: 51 + hi: 73 + finalize: ~ + span: + lo: 30 + hi: 73 + "{\"name\":\"main\",\"span\":\"{\\\"lo\\\":92,\\\"hi\\\":96}\"}": + annotations: [] + call_type: Standard + identifier: "{\"name\":\"main\",\"span\":\"{\\\"lo\\\":92,\\\"hi\\\":96}\"}" + input: + - Internal: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":97,\\\"hi\\\":98}\"}" + mode: None + type_: Boolean + span: + lo: 97 + hi: 98 + output: + - Internal: + mode: None + type_: Boolean + span: + lo: 109 + hi: 113 + output_type: Boolean + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"inf\",\"span\":\"{\\\"lo\\\":124,\\\"hi\\\":127}\"}" + arguments: [] + external: ~ + span: + lo: 124 + hi: 129 + span: + lo: 124 + hi: 130 + - Return: + expression: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":146,\\\"hi\\\":147}\"}" + span: + lo: 139 + hi: 147 + span: + lo: 114 + hi: 154 + finalize: ~ + span: + lo: 83 + hi: 154 + span: + lo: 2 + hi: 156 diff --git a/tests/expectations/parser/functions/mode_outside_tuple.out b/tests/expectations/parser/functions/mode_outside_tuple.out new file mode 100644 index 0000000000..348fca4532 --- /dev/null +++ b/tests/expectations/parser/functions/mode_outside_tuple.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '('\n --> test:4:15\n |\n 4 | transition(a: u8) -> public (u8, u8) {\n | ^" diff --git a/tests/expectations/parser/functions/spaced_annotation_fail.out b/tests/expectations/parser/functions/spaced_annotation_fail.out index 1a4ed88e31..dd4e4b7235 100644 --- a/tests/expectations/parser/functions/spaced_annotation_fail.out +++ b/tests/expectations/parser/functions/spaced_annotation_fail.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370025]: Illegal spacing in the annotation declaration.\n --> test:4:5\n |\n 4 | @ test\n | ^^^^^^\n |\n = Remove whitespace between the `@` symbol and the identifier." + - "Error [EPAR0370024]: Illegal spacing in the annotation declaration.\n --> test:4:5\n |\n 4 | @ test\n | ^^^^^^\n |\n = Remove whitespace between the `@` symbol and the identifier." diff --git a/tests/expectations/parser/program/circuit_deprecated_fail.out b/tests/expectations/parser/program/circuit_deprecated_fail.out index fe912d1d66..126fdef97a 100644 --- a/tests/expectations/parser/program/circuit_deprecated_fail.out +++ b/tests/expectations/parser/program/circuit_deprecated_fail.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370027]: The keyword `circuit` is deprecated.\n --> test:5:5\n |\n 5 | circuit Foo {\n | ^^^^^^^\n |\n = Use `struct` instead." + - "Error [EPAR0370026]: The keyword `circuit` is deprecated.\n --> test:5:5\n |\n 5 | circuit Foo {\n | ^^^^^^^\n |\n = Use `struct` instead." diff --git a/tests/expectations/parser/statement/definition.out b/tests/expectations/parser/statement/definition.out index 94c2741633..d40c90a982 100644 --- a/tests/expectations/parser/statement/definition.out +++ b/tests/expectations/parser/statement/definition.out @@ -4,7 +4,8 @@ expectation: Pass outputs: - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -14,7 +15,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U16 value: @@ -32,7 +34,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -49,7 +52,8 @@ outputs: hi: 15 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: String value: Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":20}\"}" @@ -58,7 +62,8 @@ outputs: hi: 20 - Definition: declaration_type: Const - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" type_: Integer: I8 value: @@ -68,7 +73,8 @@ outputs: hi: 18 - Definition: declaration_type: Const - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" type_: Integer: I16 value: @@ -86,7 +92,8 @@ outputs: hi: 18 - Definition: declaration_type: Const - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" type_: Integer: I8 value: @@ -103,7 +110,8 @@ outputs: hi: 17 - Definition: declaration_type: Const - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" type_: String value: Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":22}\"}" @@ -112,7 +120,8 @@ outputs: hi: 22 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U32 value: @@ -122,7 +131,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U32 value: @@ -140,7 +150,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U32 value: @@ -157,7 +168,8 @@ outputs: hi: 16 - Definition: declaration_type: Const - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" type_: Integer: U32 value: @@ -167,7 +179,8 @@ outputs: hi: 19 - Definition: declaration_type: Const - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" type_: Integer: U32 value: @@ -185,7 +198,8 @@ outputs: hi: 18 - Definition: declaration_type: Const - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" type_: Integer: U32 value: @@ -202,7 +216,8 @@ outputs: hi: 18 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Address value: Literal: diff --git a/tests/expectations/parser/statement/definition_fail.out b/tests/expectations/parser/statement/definition_fail.out index a5cf1a2e10..8b1d177348 100644 --- a/tests/expectations/parser/statement/definition_fail.out +++ b/tests/expectations/parser/statement/definition_fail.out @@ -22,18 +22,18 @@ outputs: - "Error [EPAR0370005]: expected : -- found 'x'\n --> test:1:11\n |\n 1 | const mut x: u32 = x+y;\n | ^" - "Error [EPAR0370005]: expected : -- found 'x'\n --> test:1:11\n |\n 1 | const mut x: u32 = (x,y);\n | ^" - "Error [EPAR0370005]: expected : -- found 'x'\n --> test:1:11\n |\n 1 | const mut x: u32 = x();\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '('\n --> test:1:5\n |\n 1 | let (x,y,,) = ();\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '('\n --> test:1:5\n |\n 1 | let (,x,y) = ();\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '('\n --> test:1:5\n |\n 1 | let (x,,y) = ();\n | ^" + - "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 'const'\n --> test:1:8\n |\n 1 | let x: const = expr;\n | ^^^^^" - "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found 'let'\n --> test:1:10\n |\n 1 | const x: let = expr;\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'identifier', found ''\n --> test:1:1\n |\n 1 | let\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 : -- found '='\n --> test:1:7\n |\n 1 | let x = (a, y]);\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '='\n --> test:1:5\n |\n 1 | let = 1u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'identifier', found ';'\n --> test:1:4\n |\n 1 | let;\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 | ^^" @@ -43,5 +43,5 @@ outputs: - "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 [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 [EPAR0370009]: unexpected string: expected 'identifier', found '('\n --> test:1:5\n |\n 1 | let (x) = ...;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '('\n --> test:1:5\n |\n 1 | let (x,) = ...;\n | ^" + - "Error [EPAR0370005]: expected : -- found '='\n --> test:1:9\n |\n 1 | let (x) = ...;\n | ^" + - "Error [EPAR0370030]: A tuple expression must have at least two elements.\n --> test:1:5\n |\n 1 | let (x,) = ...;\n | ^^^^" diff --git a/tests/expectations/parser/statement/expression.out b/tests/expectations/parser/statement/expression.out index 2e1b0fa18a..d1ea850aaa 100644 --- a/tests/expectations/parser/statement/expression.out +++ b/tests/expectations/parser/statement/expression.out @@ -1,7 +1,37 @@ --- namespace: ParseStatement -expectation: Fail +expectation: Pass outputs: - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | expr;\n | ^^^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x+y;\n | ^^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x();\n | ^^^^" + - Expression: + expression: + Identifier: "{\"name\":\"expr\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":4}\"}" + span: + lo: 0 + hi: 5 + - Expression: + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Add + span: + lo: 0 + hi: 3 + span: + lo: 0 + hi: 4 + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + arguments: [] + external: ~ + span: + lo: 0 + hi: 3 + span: + lo: 0 + hi: 4 diff --git a/tests/expectations/parser/unreachable/math_op_fail.out b/tests/expectations/parser/unreachable/math_op_fail.out index 884dc59e6a..a487ea664c 100644 --- a/tests/expectations/parser/unreachable/math_op_fail.out +++ b/tests/expectations/parser/unreachable/math_op_fail.out @@ -40,7 +40,7 @@ outputs: - "Error [EPAR0370005]: expected : -- found '='\n --> test:1:7\n |\n 1 | let x = a true b;\n | ^" - "Error [EPAR0370005]: expected : -- found '='\n --> test:1:7\n |\n 1 | let x = a false b;\n | ^" - "Error [EPAR0370005]: expected : -- found '='\n --> test:1:7\n |\n 1 | let x = a 0 b;\n | ^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x;=b;\n | ^^" + - "did not consume all input: '=' @ 1:3-4\n'b' @ 1:4-5\n';' @ 1:5-6\n" - "Error [EPAR0370009]: unexpected string: expected 'identifier', found '='\n --> test:1:3\n |\n 1 | x.=b;\n | ^" - "Error [EPAR0370005]: expected ; -- found ','\n --> test:1:2\n |\n 1 | x,=b; // 43\n | ^" - "Error [EPAR0370005]: expected ; -- found '['\n --> test:1:2\n |\n 1 | x[=b;\n | ^" @@ -56,8 +56,3 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', found '='\n --> test:1:4\n |\n 1 | x>==b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', found '='\n --> test:1:4\n |\n 1 | x<==b;\n | ^" - "Error [EPAR0370005]: expected ; -- found '..'\n --> test:1:2\n |\n 1 | x..=b;\n | ^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x==b;\n | ^^^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x!=b;\n | ^^^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x>=b;\n | ^^^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x<=b;\n | ^^^^^" - - "Error [EPAR0370021]: Expression statements are not supported.\n --> test:1:1\n |\n 1 | x>=b;\n | ^^^^^" diff --git a/tests/expectations/parser/unreachable/math_op_pass.out b/tests/expectations/parser/unreachable/math_op_pass.out index 41a3c21178..02847a7bdc 100644 --- a/tests/expectations/parser/unreachable/math_op_pass.out +++ b/tests/expectations/parser/unreachable/math_op_pass.out @@ -4,7 +4,8 @@ expectation: Pass outputs: - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -22,7 +23,8 @@ outputs: hi: 18 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -40,7 +42,8 @@ outputs: hi: 18 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -58,7 +61,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -76,7 +80,8 @@ outputs: hi: 18 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -94,7 +99,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -112,7 +118,8 @@ outputs: hi: 18 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: diff --git a/tests/expectations/parser/unreachable/postfix_pass.out b/tests/expectations/parser/unreachable/postfix_pass.out index 6765dc0c08..abfb038b75 100644 --- a/tests/expectations/parser/unreachable/postfix_pass.out +++ b/tests/expectations/parser/unreachable/postfix_pass.out @@ -4,7 +4,8 @@ expectation: Pass outputs: - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -14,7 +15,8 @@ outputs: hi: 19 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -24,7 +26,8 @@ outputs: hi: 14 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -34,7 +37,8 @@ outputs: hi: 15 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -44,7 +48,8 @@ outputs: hi: 20 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -54,7 +59,8 @@ outputs: hi: 18 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -64,7 +70,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -74,7 +81,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -84,7 +92,8 @@ outputs: hi: 15 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -94,7 +103,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -104,7 +114,8 @@ outputs: hi: 15 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -114,7 +125,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -124,7 +136,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -134,7 +147,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -144,7 +158,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -154,7 +169,8 @@ outputs: hi: 15 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -164,7 +180,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -174,7 +191,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -184,7 +202,8 @@ outputs: hi: 16 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -194,7 +213,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -204,7 +224,8 @@ outputs: hi: 19 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -214,7 +235,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -224,7 +246,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -234,7 +257,8 @@ outputs: hi: 17 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: @@ -244,7 +268,8 @@ outputs: hi: 18 - Definition: declaration_type: Let - variable_name: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" + place: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":4,\\\"hi\\\":5}\"}" type_: Integer: U8 value: diff --git a/tests/parser/finalize/decrement_fail.leo b/tests/parser/finalize/decrement_fail.leo index 31b73670d7..4677e5f56a 100644 --- a/tests/parser/finalize/decrement_fail.leo +++ b/tests/parser/finalize/decrement_fail.leo @@ -12,5 +12,3 @@ decrement(); decrement(floo) decrement foo[bar] by baz; - -decremet(foo, bar, baz); diff --git a/tests/parser/finalize/increment_fail.leo b/tests/parser/finalize/increment_fail.leo index e3a1b49b59..ab6ce16942 100644 --- a/tests/parser/finalize/increment_fail.leo +++ b/tests/parser/finalize/increment_fail.leo @@ -12,5 +12,3 @@ increment(); increment(floo) increment foo[bar] by baz; - -incremet(foo, bar, baz); diff --git a/tests/parser/functions/bounded_recursion.leo b/tests/parser/functions/bounded_recursion.leo index 37bb761e29..c6cbd19de6 100644 --- a/tests/parser/functions/bounded_recursion.leo +++ b/tests/parser/functions/bounded_recursion.leo @@ -1,6 +1,6 @@ /* namespace: Parse -expectation: Fail +expectation: Pass */ program test.aleo { diff --git a/tests/parser/functions/infinite_recursion.leo b/tests/parser/functions/infinite_recursion.leo index 2f8934f981..4648dec594 100644 --- a/tests/parser/functions/infinite_recursion.leo +++ b/tests/parser/functions/infinite_recursion.leo @@ -1,6 +1,6 @@ /* namespace: Parse -expectation: Fail +expectation: Pass */ program test.aleo { diff --git a/tests/parser/functions/mode_outside_tuple.leo b/tests/parser/functions/mode_outside_tuple.leo new file mode 100644 index 0000000000..a90679ba7f --- /dev/null +++ b/tests/parser/functions/mode_outside_tuple.leo @@ -0,0 +1,10 @@ +/* +namespace: Parse +expectation: Fail +*/ + +program test.aleo { + transition(a: u8) -> public (u8, u8) { + return (a + a, a * a); + } +} diff --git a/tests/parser/statement/expression.leo b/tests/parser/statement/expression.leo index 373f1ec756..f74b74819d 100644 --- a/tests/parser/statement/expression.leo +++ b/tests/parser/statement/expression.leo @@ -1,6 +1,6 @@ /* namespace: ParseStatement -expectation: Fail +expectation: Pass */ expr; diff --git a/tests/parser/unreachable/math_op_fail.leo b/tests/parser/unreachable/math_op_fail.leo index 34dee24d86..35343d25e7 100644 --- a/tests/parser/unreachable/math_op_fail.leo +++ b/tests/parser/unreachable/math_op_fail.leo @@ -111,13 +111,3 @@ x>==b; x<==b; x..=b; - -x==b; - -x!=b; - -x>=b; - -x<=b; - -x>=b;