diff --git a/Cargo.lock b/Cargo.lock index 7af375330d..2fd675137b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1150,7 +1150,7 @@ dependencies = [ "toml", "tracing", "tracing-subscriber", - "zip 0.6.0", + "zip", ] [[package]] @@ -1164,7 +1164,7 @@ dependencies = [ "toml", "tracing", "walkdir", - "zip 0.6.0", + "zip", ] [[package]] @@ -1719,9 +1719,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26aab6b48e2590e4a64d1ed808749ba06257882b461d01ca71baeb747074a6dd" +checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" dependencies = [ "memchr", ] @@ -2018,9 +2018,9 @@ dependencies = [ [[package]] name = "self_update" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc3e89793fe56c82104ddc103c998e4e94713cb975202207829e61031eb4be6" +checksum = "710b9f39843957861314222c3bad16b9138f664665125ba277a48930253c4ed5" dependencies = [ "hyper", "indicatif", @@ -2031,7 +2031,7 @@ dependencies = [ "semver 0.11.0", "serde_json", "tempfile", - "zip 0.5.13", + "zip", ] [[package]] @@ -2363,16 +2363,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "time" version = "0.3.7" @@ -2819,18 +2809,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "zip" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" -dependencies = [ - "byteorder", - "crc32fast", - "thiserror", - "time 0.1.43", -] - [[package]] name = "zip" version = "0.6.0" @@ -2846,7 +2824,7 @@ dependencies = [ "hmac", "pbkdf2", "sha1", - "time 0.3.7", + "time", "zstd", ] diff --git a/Cargo.toml b/Cargo.toml index 9064a12f60..7a0b36ba6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,7 +86,7 @@ version = "0.11.10" features = [ "blocking", "json", "multipart" ] [dependencies.self_update] -version = "0.28.0" +version = "0.29.0" features = [ "archive-zip" ] [dependencies.serde] diff --git a/compiler/ast-passes/src/lib.rs b/compiler/ast-passes/src/lib.rs index 0f9455d9de..3264d2240a 100644 --- a/compiler/ast-passes/src/lib.rs +++ b/compiler/ast-passes/src/lib.rs @@ -16,8 +16,10 @@ #![doc = include_str!("../README.md")] -pub mod canonicalization; +// disable +/* pub mod canonicalization; pub use canonicalization::*; + */ // Temporarily disable import resolution // until we migrate stdlib and then import resolution. diff --git a/compiler/ast/src/accesses/array_access.rs b/compiler/ast/src/accesses/array_access.rs deleted file mode 100644 index d457a9d4c4..0000000000 --- a/compiler/ast/src/accesses/array_access.rs +++ /dev/null @@ -1,49 +0,0 @@ -// 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 std::fmt; - -use serde::{Deserialize, Serialize}; - -/// An array element access expression `array[index]`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayAccess { - /// The expression, evaluating to an array, that is being indexed. - pub array: Box, - /// The index in `array` that is being accessed. - pub index: Box, - /// The span of the entire expression `array[index]`. - pub span: Span, -} - -impl fmt::Display for ArrayAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}[{}]", self.array, self.index) - } -} - -impl Node for ArrayAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/accesses/array_range_access.rs b/compiler/ast/src/accesses/array_range_access.rs deleted file mode 100644 index 57ce79798d..0000000000 --- a/compiler/ast/src/accesses/array_range_access.rs +++ /dev/null @@ -1,59 +0,0 @@ -// 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 std::fmt; - -use serde::{Deserialize, Serialize}; - -/// An access to a certain range of elements in an `array`. -/// -/// Examples include `array[0..3]`, `array[3..]`, `array[..3]`, and `array[..]`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayRangeAccess { - /// The array to extract a range of elements from. - pub array: Box, - /// The lower bound of the index-range, or the start of the array when `None`. - pub left: Option>, - /// The higher bound of the index-range, or the end of the array when `None`. - pub right: Option>, - /// A span for the entire expression `array[]`. - pub span: Span, -} - -impl fmt::Display for ArrayRangeAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "{}[{}..{}]", - self.array, - self.left.as_ref().map(|e| e.to_string()).unwrap_or_default(), - self.right.as_ref().map(|e| e.to_string()).unwrap_or_default() - ) - } -} - -impl Node for ArrayRangeAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/accesses/member_access.rs b/compiler/ast/src/accesses/member_access.rs deleted file mode 100644 index fb29783583..0000000000 --- a/compiler/ast/src/accesses/member_access.rs +++ /dev/null @@ -1,54 +0,0 @@ -// 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, Identifier, Node}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// A field access expression `inner.name` to some structure with *named fields*. -/// -/// For accesses to a positional fields in e.g., a tuple, see `TupleAccess`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct MemberAccess { - /// The structure that the field `name` is being extracted from. - pub inner: Box, - /// The name of the field to extract in `inner`. - pub name: Identifier, - /// The span covering all of `inner.name`. - pub span: Span, - // FIXME(Centril): Type information shouldn't be injected into an AST, - // so this field should eventually be removed. - pub type_: Option, -} - -impl fmt::Display for MemberAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}.{}", self.inner, self.name) - } -} - -impl Node for MemberAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/accesses/mod.rs b/compiler/ast/src/accesses/mod.rs deleted file mode 100644 index 70126db92c..0000000000 --- a/compiler/ast/src/accesses/mod.rs +++ /dev/null @@ -1,30 +0,0 @@ -// 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 . - -mod array_access; -pub use array_access::*; - -mod array_range_access; -pub use array_range_access::*; - -mod member_access; -pub use member_access::*; - -mod tuple_access; -pub use tuple_access::*; - -mod static_access; -pub use static_access::*; diff --git a/compiler/ast/src/accesses/static_access.rs b/compiler/ast/src/accesses/static_access.rs deleted file mode 100644 index c61d4976f1..0000000000 --- a/compiler/ast/src/accesses/static_access.rs +++ /dev/null @@ -1,54 +0,0 @@ -// 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, Identifier, Node, Type}; - -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// An access expression to a static member, e.g., a constant in a circuit. -/// An example would be `Foo::Const` or `Foo::function` in `Foo::function()`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct StaticAccess { - /// Represents the container for the static member to access. - /// Usually this is a circuit. - pub inner: Box, - /// The static member in `inner` that is being accessed. - pub name: Identifier, - /// An optional type initially None, it is later assigned during type inference snapshot if necessary. - // FIXME(Centril): Shouldn't be in an AST. Remove it as part of an architectural revamp. - pub type_: Option, - /// The span for the entire expression `inner::name`. - pub span: Span, -} - -impl fmt::Display for StaticAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}::{}", self.inner, self.name) - } -} - -impl Node for StaticAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/accesses/tuple_access.rs b/compiler/ast/src/accesses/tuple_access.rs deleted file mode 100644 index 89e8e1429e..0000000000 --- a/compiler/ast/src/accesses/tuple_access.rs +++ /dev/null @@ -1,49 +0,0 @@ -// 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, PositiveNumber}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// An tuple access expression, e.g., `tuple.index`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct TupleAccess { - /// An expression evaluating to some tuple type, e.g., `(5, 2)`. - pub tuple: Box, - /// The index to access in the tuple expression. E.g., `0` for `(5, 2)` would yield `5`. - pub index: PositiveNumber, - /// The span for the entire expression `tuple.index`. - pub span: Span, -} - -impl fmt::Display for TupleAccess { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}.{}", self.tuple, self.index) - } -} - -impl Node for TupleAccess { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/aliases/alias.rs b/compiler/ast/src/aliases/alias.rs deleted file mode 100644 index 17659ae657..0000000000 --- a/compiler/ast/src/aliases/alias.rs +++ /dev/null @@ -1,42 +0,0 @@ -// 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::{Identifier, Type}; -use leo_span::Span; - -use std::fmt; - -use serde::{Deserialize, Serialize}; - -/// A type alias `type name = represents;`. -/// -/// That is, `name` will become another name for `represents`. -/// This does not create a new type, that is, `name` is the same type as `represents`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct Alias { - /// The new name for `represents`. - pub name: Identifier, - /// A span for the entire `type name = represents;`. - pub span: Span, - /// The type that `name` will evaluate and is equal to. - pub represents: Type, -} - -impl fmt::Display for Alias { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{} : {}", self.name.name, self.represents) - } -} diff --git a/compiler/ast/src/aliases/mod.rs b/compiler/ast/src/aliases/mod.rs deleted file mode 100644 index 393212003a..0000000000 --- a/compiler/ast/src/aliases/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -// 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 . - -pub mod alias; -pub use self::alias::*; diff --git a/compiler/ast/src/annotation.rs b/compiler/ast/src/annotation.rs deleted file mode 100644 index 572c1191d3..0000000000 --- a/compiler/ast/src/annotation.rs +++ /dev/null @@ -1,52 +0,0 @@ -// 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::Identifier; -use leo_span::{sym, Span, Symbol}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// An annotation `@name (arguments)?`. -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] -pub struct Annotation { - /// The span including `name ( arguments )`. - pub span: Span, - /// The name of the annotation. - pub name: Identifier, - /// Arguments for the annotation, if any. - pub arguments: Vec, -} - -/// The set of allowed annotations. -const ALLOWED_ANNOTATIONS: &[Symbol] = &[sym::test]; - -impl Annotation { - /// Is the annotation valid? - pub fn is_valid_annotation(&self) -> bool { - ALLOWED_ANNOTATIONS.iter().any(|name| self.name.name == *name) - } -} - -impl fmt::Display for Annotation { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "@{:}(", self.name)?; - for arg in &self.arguments { - write!(f, "{:},", arg)?; - } - write!(f, ")") - } -} diff --git a/compiler/ast/src/chars/char_value.rs b/compiler/ast/src/chars/char_value.rs index 37b6fbd87f..18ed903bfb 100644 --- a/compiler/ast/src/chars/char_value.rs +++ b/compiler/ast/src/chars/char_value.rs @@ -53,6 +53,18 @@ impl fmt::Display for Char { } } +pub struct Chars(pub Vec); + +impl fmt::Display for Chars { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + for character in self.0.iter() { + write!(f, "{}", character)?; + } + + Ok(()) + } +} + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct CharValue { pub character: Char, diff --git a/compiler/ast/src/circuits/circuit.rs b/compiler/ast/src/circuits/circuit.rs deleted file mode 100644 index c5caf5185f..0000000000 --- a/compiler/ast/src/circuits/circuit.rs +++ /dev/null @@ -1,56 +0,0 @@ -// 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::{CircuitMember, Identifier}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// A record type definition, e.g., `circuit Foo { my_field: Bar }`. -/// In some languages these are called `struct`s. -/// -/// Type identity is decided by the full path including `circuit_name`, -/// as the record is nominal, not structural. -/// The fields are named so `circuit Foo(u8, u16)` is not allowed. -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct Circuit { - /// The name of the type in the type system in this module. - pub circuit_name: Identifier, - /// The fields, constant variables, and functions of this structure. - pub members: Vec, -} - -impl Circuit { - fn format(&self, f: &mut fmt::Formatter) -> fmt::Result { - writeln!(f, "circuit {} {{ ", self.circuit_name)?; - for field in self.members.iter() { - writeln!(f, " {}", field)?; - } - write!(f, "}}") - } -} - -impl fmt::Debug for Circuit { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.format(f) - } -} - -impl fmt::Display for Circuit { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.format(f) - } -} diff --git a/compiler/ast/src/circuits/circuit_implied_variable_definition.rs b/compiler/ast/src/circuits/circuit_implied_variable_definition.rs deleted file mode 100644 index a53a428d43..0000000000 --- a/compiler/ast/src/circuits/circuit_implied_variable_definition.rs +++ /dev/null @@ -1,25 +0,0 @@ -// 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, Identifier}; - -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitImpliedVariableDefinition { - pub identifier: Identifier, - pub expression: Option, -} diff --git a/compiler/ast/src/circuits/circuit_member.rs b/compiler/ast/src/circuits/circuit_member.rs deleted file mode 100644 index f594130a5a..0000000000 --- a/compiler/ast/src/circuits/circuit_member.rs +++ /dev/null @@ -1,63 +0,0 @@ -// 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, Function, Identifier, Type}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -#[allow(clippy::large_enum_variant)] -/// A member of a circuit definition. -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum CircuitMember { - /// A static constant in a circuit. - /// For example: `const foobar: u8 = 42;`. - CircuitConst( - /// The identifier of the constant. - Identifier, - /// The type the constant has. - Type, - /// The expression representing the constant's value. - /// Checked to be of the type above. - Expression, - ), - /// A varible definition in a circuit; - /// For example: `foobar: u8;`. - CircuitVariable( - /// The identifier of the constant. - Identifier, - /// The type the constant has. - Type, - ), - /// A function definition in a circuit. - /// For example: `function bar() -> u8 { return 2u8; }`. - CircuitFunction( - /// The function. - Box, - ), -} - -impl fmt::Display for CircuitMember { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CircuitMember::CircuitConst(ref identifier, ref type_, ref value) => { - write!(f, "{}: {} = {}", identifier, type_, value) - } - CircuitMember::CircuitVariable(ref identifier, ref type_) => write!(f, "{}: {}", identifier, type_), - CircuitMember::CircuitFunction(ref function) => write!(f, "{}", function), - } - } -} diff --git a/compiler/ast/src/circuits/circuit_variable_definition.rs b/compiler/ast/src/circuits/circuit_variable_definition.rs deleted file mode 100644 index 1ba0a0243a..0000000000 --- a/compiler/ast/src/circuits/circuit_variable_definition.rs +++ /dev/null @@ -1,25 +0,0 @@ -// 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, Identifier}; - -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitVariableDefinition { - pub identifier: Identifier, - pub expression: Expression, -} diff --git a/compiler/ast/src/circuits/mod.rs b/compiler/ast/src/circuits/mod.rs deleted file mode 100644 index 962196abb7..0000000000 --- a/compiler/ast/src/circuits/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -// 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 . - -pub mod circuit; -pub use circuit::*; - -pub mod circuit_member; -pub use circuit_member::*; diff --git a/compiler/ast/src/common/array_dimensions.rs b/compiler/ast/src/common/array_dimensions.rs deleted file mode 100644 index af5f879930..0000000000 --- a/compiler/ast/src/common/array_dimensions.rs +++ /dev/null @@ -1,86 +0,0 @@ -// 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::PositiveNumber; - -use serde::{ser::SerializeSeq, Deserialize, Serialize, Serializer}; -use smallvec::{smallvec, SmallVec}; -use std::{fmt, ops::Deref}; - -/// Specifies array dimensions for array [`Type`]s or in array initializer [`Expression`]s. -#[derive(Clone, Deserialize, Debug, PartialEq, Eq, Hash)] -pub struct ArrayDimensions(pub SmallVec<[PositiveNumber; 1]>); - -impl Deref for ArrayDimensions { - type Target = [PositiveNumber]; - - fn deref(&self) -> &Self::Target { - &*self.0 - } -} - -impl ArrayDimensions { - /// Returns a single-dimensional array dimension. - pub fn single(dim: PositiveNumber) -> Self { - Self(smallvec![dim]) - } - - /// Returns `true` if there is an array dimension equal to zero. - pub fn is_zero(&self) -> bool { - self.iter().any(|d| d.is_zero()) - } - - /// Attempts to remove the first dimension from the array, or returns `None` if it doesn't. - pub fn remove_first(&mut self) -> Option { - if self.is_empty() { - None - } else { - Some(self.0.remove(0)) - } - } - - /// Attempts to remove the last dimension from the array, or returns `None` if it doesn't. - pub fn remove_last(&mut self) -> Option { - self.0.pop() - } -} - -/// Custom Serializer for ArrayDimensions is required to ignore internal ArrayDimension nodes in the AST. -impl Serialize for ArrayDimensions { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let mut seq = serializer.serialize_seq(Some(self.0.len()))?; - for dim in self.0.iter() { - seq.serialize_element(&dim)?; - } - seq.end() - } -} - -impl fmt::Display for ArrayDimensions { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match &*self.0 { - [dim] => write!(f, "{}", dim), - dimensions => write!( - f, - "({})", - dimensions.iter().map(|x| x.to_string()).collect::>().join(", ") - ), - } - } -} diff --git a/compiler/ast/src/common/const_self_keyword.rs b/compiler/ast/src/common/const_self_keyword.rs deleted file mode 100644 index 1adbfbcdc7..0000000000 --- a/compiler/ast/src/common/const_self_keyword.rs +++ /dev/null @@ -1,46 +0,0 @@ -// 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::{Identifier, Node}; -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `self` keyword can view circuit values inside of a circuit function. -/// Circuit values cannot be modified. To modify values use the `mut self` [MutSelfKeyword]. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct ConstSelfKeyword { - /// Always `const self`. - pub identifier: Identifier, -} - -impl fmt::Display for ConstSelfKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "const self") - } -} - -impl Node for ConstSelfKeyword { - fn span(&self) -> &Span { - &self.identifier.span - } - - fn set_span(&mut self, span: Span) { - self.identifier.span = span; - } -} diff --git a/compiler/ast/src/common/mod.rs b/compiler/ast/src/common/mod.rs index 48ff68ede8..ad45846431 100644 --- a/compiler/ast/src/common/mod.rs +++ b/compiler/ast/src/common/mod.rs @@ -14,12 +14,6 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -pub mod array_dimensions; -pub use array_dimensions::*; - -pub mod const_self_keyword; -pub use const_self_keyword::*; - pub mod global_consts_json; pub mod identifier; @@ -28,16 +22,5 @@ pub use identifier::*; pub mod imported_modules; pub use imported_modules::*; -pub mod mut_self_keyword; -pub use mut_self_keyword::*; - pub mod positive_number; pub use positive_number::*; - -pub mod self_keyword; -pub use self_keyword::*; - -pub mod spread_or_expression; -pub use spread_or_expression::*; - -pub mod vec_tendril_json; diff --git a/compiler/ast/src/common/mut_self_keyword.rs b/compiler/ast/src/common/mut_self_keyword.rs deleted file mode 100644 index 633482d89f..0000000000 --- a/compiler/ast/src/common/mut_self_keyword.rs +++ /dev/null @@ -1,45 +0,0 @@ -// 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::{Identifier, Node}; -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `&self` keyword can view and modify circuit values inside of a circuit function. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct RefSelfKeyword { - /// Always `&self`. - pub identifier: Identifier, -} - -impl fmt::Display for RefSelfKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "&self") - } -} - -impl Node for RefSelfKeyword { - fn span(&self) -> &Span { - &self.identifier.span - } - - fn set_span(&mut self, span: Span) { - self.identifier.span = span; - } -} diff --git a/compiler/ast/src/common/self_keyword.rs b/compiler/ast/src/common/self_keyword.rs deleted file mode 100644 index 17a41e45c6..0000000000 --- a/compiler/ast/src/common/self_keyword.rs +++ /dev/null @@ -1,46 +0,0 @@ -// 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::{Identifier, Node}; -use leo_span::Span; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `self` keyword can view circuit values inside of a circuit function. -/// Circuit values cannot be modified. To modify values use the `mut self` [MutSelfKeyword]. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct SelfKeyword { - /// Always just `self`. - pub identifier: Identifier, -} - -impl fmt::Display for SelfKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "self") - } -} - -impl Node for SelfKeyword { - fn span(&self) -> &Span { - &self.identifier.span - } - - fn set_span(&mut self, span: Span) { - self.identifier.span = span; - } -} diff --git a/compiler/ast/src/common/spread_or_expression.rs b/compiler/ast/src/common/spread_or_expression.rs deleted file mode 100644 index fa6d6d9c1b..0000000000 --- a/compiler/ast/src/common/spread_or_expression.rs +++ /dev/null @@ -1,55 +0,0 @@ -// 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; - -/// Either a spread expression or a normal expression. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum SpreadOrExpression { - /// A spread expression, i.e., `...other_array`. - Spread(Expression), - /// A normal element expression. - Expression(Expression), -} - -impl fmt::Display for SpreadOrExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - SpreadOrExpression::Spread(ref spread) => write!(f, "...{}", spread), - SpreadOrExpression::Expression(ref expression) => write!(f, "{}", expression), - } - } -} - -impl Node for SpreadOrExpression { - fn span(&self) -> &Span { - use SpreadOrExpression::*; - match self { - Spread(expression) | Expression(expression) => expression.span(), - } - } - - fn set_span(&mut self, span: Span) { - use SpreadOrExpression::*; - match self { - Spread(expression) | Expression(expression) => expression.set_span(span), - } - } -} diff --git a/compiler/ast/src/common/vec_tendril_json.rs b/compiler/ast/src/common/vec_tendril_json.rs deleted file mode 100644 index 79c288428f..0000000000 --- a/compiler/ast/src/common/vec_tendril_json.rs +++ /dev/null @@ -1,34 +0,0 @@ -// 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 serde::{Deserialize, Deserializer, Serialize, Serializer}; -use tendril::StrTendril; - -#[allow(clippy::ptr_arg)] -pub fn serialize(tendril: &Vec, serializer: S) -> Result { - tendril - .iter() - .map(|x| x.as_ref()) - .collect::>() - .serialize(serializer) -} - -pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result, D::Error> { - Ok(Vec::::deserialize(deserializer)? - .into_iter() - .map(|x| x.into()) - .collect()) -} diff --git a/compiler/ast/src/expression/accesses.rs b/compiler/ast/src/expression/accesses.rs deleted file mode 100644 index 2bef95ce46..0000000000 --- a/compiler/ast/src/expression/accesses.rs +++ /dev/null @@ -1,73 +0,0 @@ -// 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::*; -use crate::accesses::*; - -/// An access expressions, extracting a smaller part out of a whole. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub enum AccessExpression { - /// An `array[index]` expression. - Array(ArrayAccess), - /// An expression accessing a range of an array. - ArrayRange(ArrayRangeAccess), - /// An expression accessing a field in a structure, e.g., `circuit_var.field`. - Member(MemberAccess), - /// Access to a tuple field using its position, e.g., `tuple.1`. - Tuple(TupleAccess), - /// Access to a member constant or a static function of a circuit. - Static(StaticAccess), -} - -impl fmt::Display for AccessExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use AccessExpression::*; - - match self { - Array(access) => access.fmt(f), - ArrayRange(access) => access.fmt(f), - Member(access) => access.fmt(f), - Tuple(access) => access.fmt(f), - Static(access) => access.fmt(f), - } - } -} - -impl Node for AccessExpression { - fn span(&self) -> &Span { - use AccessExpression::*; - - match &self { - Array(access) => access.span(), - ArrayRange(access) => access.span(), - Member(access) => access.span(), - Tuple(access) => access.span(), - Static(access) => access.span(), - } - } - - fn set_span(&mut self, span: Span) { - use AccessExpression::*; - - match self { - Array(access) => access.set_span(span), - ArrayRange(access) => access.set_span(span), - Member(access) => access.set_span(span), - Tuple(access) => access.set_span(span), - Static(access) => access.set_span(span), - } - } -} diff --git a/compiler/ast/src/expression/array_init.rs b/compiler/ast/src/expression/array_init.rs deleted file mode 100644 index 357559ff8b..0000000000 --- a/compiler/ast/src/expression/array_init.rs +++ /dev/null @@ -1,48 +0,0 @@ -// 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::*; - -/// An array initializer expression, e.g., `[42; 5]`. -/// constructing an array of `element` repeated according to `dimensions`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayInitExpression { - /// The expression that all elements in the array will evaluate to. - pub element: Box, - /// The dimensions of the array. - /// - /// This could be a multi-dimensional array, - /// e.g., `[42; (2, 2)]`, giving you a matrix `[[42, 42], [42, 42]]`. - pub dimensions: ArrayDimensions, - /// The span of the entire expression from `[` to `]`. - pub span: Span, -} - -impl fmt::Display for ArrayInitExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "[{}; {}]", self.element, self.dimensions) - } -} - -impl Node for ArrayInitExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/array_inline.rs b/compiler/ast/src/expression/array_inline.rs deleted file mode 100644 index 4e03912a4f..0000000000 --- a/compiler/ast/src/expression/array_inline.rs +++ /dev/null @@ -1,51 +0,0 @@ -// 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::*; - -/// An expression constructing an array by listing the individual elements inline, -/// for example `[4, 6, 5, 2]`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct ArrayInlineExpression { - /// A list, where a part can be either an element, - /// or list of elements to construct the array with. - pub elements: Vec, - /// The span of the entire expression from `[` to `]`. - pub span: Span, -} - -impl fmt::Display for ArrayInlineExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "[")?; - for (i, e) in self.elements.iter().enumerate() { - write!(f, "{}", e)?; - if i < self.elements.len() - 1 { - write!(f, ", ")?; - } - } - write!(f, "]") - } -} - -impl Node for ArrayInlineExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/cast.rs b/compiler/ast/src/expression/cast.rs deleted file mode 100644 index 525618996c..0000000000 --- a/compiler/ast/src/expression/cast.rs +++ /dev/null @@ -1,46 +0,0 @@ -// 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::Type; - -use super::*; - -/// A cast expression `e as U`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct CastExpression { - /// The expression `e` of a type `T` that is being cast to `U`. - pub inner: Box, - /// The type `U` to cast `e` to. - pub target_type: Type, - /// Span for the entire expression `e as U` to. - pub span: Span, -} - -impl fmt::Display for CastExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{} as {}", self.inner, self.target_type) - } -} - -impl Node for CastExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/circuit_init.rs b/compiler/ast/src/expression/circuit_init.rs deleted file mode 100644 index 6ddaad5fb6..0000000000 --- a/compiler/ast/src/expression/circuit_init.rs +++ /dev/null @@ -1,73 +0,0 @@ -// 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::*; - -/// An initializer for a single field / variable of a circuit initializer expression. -/// That is, in `Foo { bar: 42, baz }`, this is either `bar: 42`, or `baz`. -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitVariableInitializer { - /// The name of the field / variable to be initialized. - pub identifier: Identifier, - /// The expression to initialize the field with. - /// When `None`, a binding, in scope, with the name will be used instead. - pub expression: Option, -} - -impl fmt::Display for CircuitVariableInitializer { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(expr) = &self.expression { - write!(f, "{}: {}", self.identifier, expr) - } else { - write!(f, "{}", self.identifier) - } - } -} - -/// A circuit initialization expression, e.g., `Foo { bar: 42, baz }`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct CircuitInitExpression { - /// The name of the structure type to initialize. - pub name: Identifier, - /// Initializer expressions for each of the fields in the circuit. - /// - /// N.B. Any functions or member constants in the circuit definition - /// are excluded from this list. - pub members: Vec, - /// A span from `name` to `}`. - pub span: Span, -} - -impl fmt::Display for CircuitInitExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{} {{", self.name)?; - for member in self.members.iter() { - write!(f, "{}", member)?; - write!(f, ", ")?; - } - write!(f, "}}") - } -} - -impl Node for CircuitInitExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/expression/mod.rs b/compiler/ast/src/expression/mod.rs index d5c473954f..e4f0e7a117 100644 --- a/compiler/ast/src/expression/mod.rs +++ b/compiler/ast/src/expression/mod.rs @@ -14,35 +14,23 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ArrayDimensions, GroupValue, Identifier, IntegerType, Node, SpreadOrExpression}; +use crate::{GroupValue, Identifier, IntegerType, Node}; use leo_span::Span; use serde::{Deserialize, Serialize}; use std::fmt; -mod accesses; -pub use accesses::*; mod binary; pub use binary::*; mod unary; pub use unary::*; mod ternary; pub use ternary::*; -mod array_inline; -pub use array_inline::*; -mod array_init; -pub use array_init::*; -mod tuple_init; -pub use tuple_init::*; -mod circuit_init; -pub use circuit_init::*; mod value; pub use value::*; mod call; pub use call::*; -mod cast; -pub use cast::*; mod err; pub use err::*; @@ -59,19 +47,6 @@ pub enum Expression { Unary(UnaryExpression), /// A ternary conditional expression `cond ? if_expr : else_expr`. Ternary(TernaryExpression), - /// A cast expression `expr as type`. - Cast(CastExpression), - /// An access expression of some sort, e.g., `array[idx]` or `foo.bar`. - Access(AccessExpression), - /// An array expression where individual elements are listed inline, - /// for example `[4, 6, ...[5, 7], 2]`. - ArrayInline(ArrayInlineExpression), - /// An array-repeat expression, e.g., `[42; 3]` yielding `[42, 42, 42]`. - ArrayInit(ArrayInitExpression), - /// A tuple expression e.g., `(foo, 42, true)`. - TupleInit(TupleInitExpression), - /// An expression constructing a structure like `Foo { bar: 42, baz }`. - CircuitInit(CircuitInitExpression), /// A call expression like `my_fun(args)`. Call(CallExpression), /// An expression of type "error". @@ -88,13 +63,7 @@ impl Node for Expression { Binary(n) => n.span(), Unary(n) => n.span(), Ternary(n) => n.span(), - ArrayInline(n) => n.span(), - ArrayInit(n) => n.span(), - TupleInit(n) => n.span(), - CircuitInit(n) => n.span(), Call(n) => n.span(), - Cast(n) => n.span(), - Access(n) => n.span(), Err(n) => n.span(), } } @@ -107,13 +76,7 @@ impl Node for Expression { Binary(n) => n.set_span(span), Unary(n) => n.set_span(span), Ternary(n) => n.set_span(span), - ArrayInline(n) => n.set_span(span), - ArrayInit(n) => n.set_span(span), - TupleInit(n) => n.set_span(span), - CircuitInit(n) => n.set_span(span), Call(n) => n.set_span(span), - Cast(n) => n.set_span(span), - Access(n) => n.set_span(span), Err(n) => n.set_span(span), } } @@ -128,13 +91,7 @@ impl fmt::Display for Expression { Binary(n) => n.fmt(f), Unary(n) => n.fmt(f), Ternary(n) => n.fmt(f), - ArrayInline(n) => n.fmt(f), - ArrayInit(n) => n.fmt(f), - TupleInit(n) => n.fmt(f), - CircuitInit(n) => n.fmt(f), Call(n) => n.fmt(f), - Cast(n) => n.fmt(f), - Access(n) => n.fmt(f), Err(n) => n.fmt(f), } } diff --git a/compiler/ast/src/expression/tuple_init.rs b/compiler/ast/src/expression/tuple_init.rs deleted file mode 100644 index 7167b63300..0000000000 --- a/compiler/ast/src/expression/tuple_init.rs +++ /dev/null @@ -1,50 +0,0 @@ -// 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::*; - -/// A tuple construction expression, e.g., `(foo, false, 42)`. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct TupleInitExpression { - /// The elements of the tuple. - /// In the example above, it would be `foo`, `false`, and `42`. - pub elements: Vec, - /// The span from `(` to `)`. - pub span: Span, -} - -impl fmt::Display for TupleInitExpression { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "(")?; - for (i, member) in self.elements.iter().enumerate() { - write!(f, "{}", member)?; - if i < self.elements.len() - 1 { - write!(f, ", ")?; - } - } - write!(f, ")") - } -} - -impl Node for TupleInitExpression { - fn span(&self) -> &Span { - &self.span - } - - fn set_span(&mut self, span: Span) { - self.span = span; - } -} diff --git a/compiler/ast/src/functions/function.rs b/compiler/ast/src/functions/function.rs index 11b5686367..7ea381c72a 100644 --- a/compiler/ast/src/functions/function.rs +++ b/compiler/ast/src/functions/function.rs @@ -14,10 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Annotation, Block, FunctionInput, Identifier, Node, Type}; +use crate::{Block, FunctionInput, Identifier, Node, Type}; use leo_span::{sym, Span, Symbol}; -use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use std::cell::Cell; use std::fmt; @@ -25,8 +24,6 @@ use std::fmt; /// A function definition. #[derive(Clone, Serialize, Deserialize)] pub struct Function { - /// A map of all the annotations from their base names to the whole. - pub annotations: IndexMap, /// The function identifier, e.g., `foo` in `function foo(...) { ... }`. pub identifier: Identifier, /// The function's parameters. @@ -63,29 +60,6 @@ impl Function { self.name() == sym::main } - /// - /// Returns `true` if the function has input `self` or `mut self`. - /// Returns `false` otherwise. - /// - pub fn contains_self(&self) -> bool { - self.input.iter().any(|param| param.is_self()) - } - - /// - /// Returns `true` if the function has input `mut self`. - /// Returns `false` otherwise. - /// - pub fn contains_mut_self(&self) -> bool { - self.input.iter().any(|param| param.is_mut_self()) - } - - /// - /// Returns an iterator of [&FunctionInput] removing `self` and `mut self` inputs. - /// - pub fn filter_self_inputs(&self) -> impl Iterator { - self.input.iter().filter(|input| !input.is_self()) - } - /// /// Private formatting method used for optimizing [fmt::Debug] and [fmt::Display] implementations. /// diff --git a/compiler/ast/src/functions/input/input_variable.rs b/compiler/ast/src/functions/input/input_variable.rs index 0d92c41240..9317cb7b23 100644 --- a/compiler/ast/src/functions/input/input_variable.rs +++ b/compiler/ast/src/functions/input/input_variable.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::{ConstSelfKeyword, FunctionInputVariable, Node, RefSelfKeyword, SelfKeyword}; +use crate::{FunctionInputVariable, Node}; use leo_span::Span; use serde::{Deserialize, Serialize}; @@ -23,74 +23,24 @@ use std::fmt; /// Enumerates the possible inputs to a function. #[derive(Clone, Serialize, Deserialize)] pub enum FunctionInput { - /// A `self` parameter. - SelfKeyword(SelfKeyword), - /// A `const self` parameter. - ConstSelfKeyword(ConstSelfKeyword), - /// A `&self` parameter. - RefSelfKeyword(RefSelfKeyword), /// A normal function parameter. Variable(FunctionInputVariable), } impl FunctionInput { - /// - /// Returns `true` if the function input is the `self` or `mut self` keyword. - /// Returns `false` otherwise. - /// - pub fn is_self(&self) -> bool { - match self { - FunctionInput::SelfKeyword(_) => true, - FunctionInput::ConstSelfKeyword(_) => true, - FunctionInput::RefSelfKeyword(_) => true, - FunctionInput::Variable(_) => false, - } - } - - /// - /// Returns `true` if the function input is the `const self` keyword. - /// Returns `false` otherwise. - /// - pub fn is_const_self(&self) -> bool { - match self { - FunctionInput::SelfKeyword(_) => false, - FunctionInput::ConstSelfKeyword(_) => true, - FunctionInput::RefSelfKeyword(_) => false, - FunctionInput::Variable(_) => false, - } - } - - /// - /// Returns `true` if the function input is the `mut self` keyword. - /// Returns `false` otherwise. - /// - pub fn is_mut_self(&self) -> bool { - match self { - FunctionInput::SelfKeyword(_) => false, - FunctionInput::ConstSelfKeyword(_) => false, - FunctionInput::RefSelfKeyword(_) => true, - FunctionInput::Variable(_) => false, - } - } - /// /// Returns Option with FunctionInputVariable if the input is a variable. /// Returns None otherwise. /// - pub fn get_variable(&self) -> Option<&FunctionInputVariable> { - if let FunctionInput::Variable(var) = self { - Some(var) - } else { - None + pub fn get_variable(&self) -> &FunctionInputVariable { + match self { + Self::Variable(var) => var, } } /// Formats the parameter to `f`. fn format(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - FunctionInput::SelfKeyword(keyword) => write!(f, "{}", keyword), - FunctionInput::ConstSelfKeyword(keyword) => write!(f, "{}", keyword), - FunctionInput::RefSelfKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::Variable(function_input) => write!(f, "{}", function_input), } } @@ -112,11 +62,7 @@ impl PartialEq for FunctionInput { /// Returns true if `self == other`. Does not compare spans. fn eq(&self, other: &Self) -> bool { match (self, other) { - (FunctionInput::SelfKeyword(_), FunctionInput::SelfKeyword(_)) => true, - (FunctionInput::ConstSelfKeyword(_), FunctionInput::ConstSelfKeyword(_)) => true, - (FunctionInput::RefSelfKeyword(_), FunctionInput::RefSelfKeyword(_)) => true, (FunctionInput::Variable(left), FunctionInput::Variable(right)) => left.eq(right), - _ => false, } } } @@ -127,9 +73,6 @@ impl Node for FunctionInput { fn span(&self) -> &Span { use FunctionInput::*; match self { - SelfKeyword(keyword) => &keyword.identifier.span, - ConstSelfKeyword(keyword) => &keyword.identifier.span, - RefSelfKeyword(keyword) => &keyword.identifier.span, Variable(variable) => &variable.span, } } @@ -137,9 +80,6 @@ impl Node for FunctionInput { fn set_span(&mut self, span: Span) { use FunctionInput::*; match self { - SelfKeyword(keyword) => keyword.identifier.span = span, - ConstSelfKeyword(keyword) => keyword.identifier.span = span, - RefSelfKeyword(keyword) => keyword.identifier.span = span, Variable(variable) => variable.span = span, } } diff --git a/compiler/ast/src/imports/mod.rs b/compiler/ast/src/imports/mod.rs deleted file mode 100644 index 0abc99f168..0000000000 --- a/compiler/ast/src/imports/mod.rs +++ /dev/null @@ -1,119 +0,0 @@ -// 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::Identifier; -use leo_span::{Span, Symbol}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// Represents an import statement in a Leo program. -#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)] -pub struct ImportStatement { - /// The tree specifying what items or packages to import. - pub tree: ImportTree, - /// The span, excluding the `;`. - pub span: Span, -} - -impl ImportStatement { - /// Returns the the package file name of the self import statement. - pub fn get_file_name(&self) -> Symbol { - self.tree.base.first().unwrap().name - } -} - -impl fmt::Display for ImportStatement { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "import {};", self.tree) - } -} - -impl fmt::Debug for ImportStatement { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(self, f) - } -} - -/// An import tree specifies item(s) to import. -#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)] -pub struct ImportTree { - /// A path to the base item or package to import or import from. - /// The list is always non-empty. - pub base: Vec, - /// Specifies the kind of import and the meaning of `base`. - /// This includes plain imports, renames, globs (`*`), and nested imports. - pub kind: ImportTreeKind, - /// The span for the import excluding `import` and `;`. - pub span: Span, -} - -impl fmt::Display for ImportTree { - /// Formats `self` to `f`. - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // Format the path. - for (i, part) in self.base.iter().enumerate() { - write!(f, "{}", part)?; - if i < self.base.len() - 1 { - write!(f, ".")?; - } - } - - // Format the kind. - match &self.kind { - ImportTreeKind::Glob { .. } => write!(f, ".*"), - ImportTreeKind::Leaf { alias: None } => Ok(()), - ImportTreeKind::Leaf { alias: Some(alias) } => write!(f, "as {}", alias), - ImportTreeKind::Nested { tree } => { - write!(f, ".(")?; - for (i, node) in tree.iter().enumerate() { - write!(f, "{}", node)?; - if i < tree.len() - 1 { - write!(f, ", ")?; - } - } - write!(f, ")") - } - } - } -} - -impl fmt::Debug for ImportTree { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(self, f) - } -} - -/// Specifies the import kind and the meaning of `base`. -#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)] -pub enum ImportTreeKind { - /// A glob import `*`. - Glob { - /// The span for the `*`. - span: Span, - }, - /// A leaf package to import. - Leaf { - /// When specified, the package is imported under a different name. - /// Otherwise, the `base` name is used as in the `ImportTree`. - alias: Option, - }, - /// A nested import of items or sub-packages. - Nested { - /// The sub-tree specifying what to import from the `base`. - tree: Vec, - }, -} diff --git a/compiler/ast/src/input/input_value.rs b/compiler/ast/src/input/input_value.rs index 782b6dec25..e31121079d 100644 --- a/compiler/ast/src/input/input_value.rs +++ b/compiler/ast/src/input/input_value.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::{CharValue, Expression, GroupValue, IntegerType, Node, SpreadOrExpression, Type, ValueExpression}; +use crate::{CharValue, Expression, GroupValue, IntegerType, Node, Type, ValueExpression}; use leo_errors::{InputError, LeoError, ParserError, Result}; use serde::{Deserialize, Serialize}; @@ -28,8 +28,6 @@ pub enum InputValue { Field(String), Group(GroupValue), Integer(IntegerType, String), - Array(Vec), - Tuple(Vec), } impl TryFrom<(Type, Expression)> for InputValue { @@ -56,89 +54,11 @@ impl TryFrom<(Type, Expression)> for InputValue { return Err(InputError::unexpected_type(expected.to_string(), actual, &span).into()); } } - (Type::Array(type_, _), ValueExpression::String(string, span)) => { - if !matches!(*type_, Type::Char) { - return Err(InputError::string_is_array_of_chars(type_, &span).into()); - } - - Self::Array( - string - .into_iter() - .map(|c| { - Self::Char(CharValue { - character: c, - span: span.clone(), - }) - }) - .collect(), - ) - } (x, y) => { return Err(InputError::unexpected_type(x, &y, y.span()).into()); } } } - (Type::Array(type_, type_dimensions), Expression::ArrayInit(mut array_init)) => { - let span = array_init.span.clone(); - - if type_dimensions != array_init.dimensions || array_init.dimensions.is_zero() { - return Err(InputError::invalid_array_dimension_size(&span).into()); - } - - if let Some(dimension) = array_init.dimensions.remove_first() { - let size = dimension.value.parse::().unwrap(); - let mut values = Vec::with_capacity(size); - - // For when Dimensions are specified in a canonical way: [[u8; 3], 2]; - // Else treat as math notation: [u8; (2, 3)]; - if array_init.dimensions.len() == 0 { - for _ in 0..size { - values.push(InputValue::try_from((*type_.clone(), *array_init.element.clone()))?); - } - // Faking canonical array init is relatively easy: instead of using a straightforward - // recursion, with each iteration we manually modify ArrayInitExpression cutting off - // dimension by dimension. - } else { - for _ in 0..size { - values.push(InputValue::try_from(( - Type::Array(type_.clone(), array_init.dimensions.clone()), - Expression::ArrayInit(array_init.clone()), - ))?); - } - }; - - Self::Array(values) - } else { - unreachable!("dimensions are checked for zero"); - } - } - (Type::Tuple(types), Expression::TupleInit(tuple_init)) => { - let size = tuple_init.elements.len(); - let mut elements = Vec::with_capacity(size); - - if size != types.len() { - return Err(InputError::tuple_length_mismatch(size, types.len(), tuple_init.span()).into()); - } - - for (i, element) in tuple_init.elements.into_iter().enumerate() { - elements.push(Self::try_from((types[i].clone(), element))?); - } - - Self::Tuple(elements) - } - (Type::Array(element_type, _dimensions), Expression::ArrayInline(array_inline)) => { - let mut elements = Vec::with_capacity(array_inline.elements.len()); - let span = array_inline.span().clone(); - - for element in array_inline.elements.into_iter() { - if let SpreadOrExpression::Expression(value_expression) = element { - elements.push(Self::try_from((*element_type.clone(), value_expression))?); - } else { - return Err(InputError::array_spread_is_not_allowed(&span).into()); - } - } - Self::Array(elements) - } (_type_, expr) => return Err(InputError::illegal_expression(&expr, expr.span()).into()), }) } @@ -153,14 +73,6 @@ impl fmt::Display for InputValue { InputValue::Group(ref group) => write!(f, "{}", group), InputValue::Field(ref field) => write!(f, "{}", field), InputValue::Integer(ref type_, ref number) => write!(f, "{}{:?}", number, type_), - InputValue::Array(ref array) => { - let values = array.iter().map(|x| x.to_string()).collect::>().join(", "); - write!(f, "array [{}]", values) - } - InputValue::Tuple(ref tuple) => { - let values = tuple.iter().map(|x| x.to_string()).collect::>().join(", "); - write!(f, "({})", values) - } } } } diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index 52e817c2ff..b988b348cd 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -22,18 +22,6 @@ #![doc = include_str!("../README.md")] -pub mod accesses; -pub use self::accesses::*; - -pub mod aliases; -pub use self::aliases::*; - -pub mod annotation; -pub use self::annotation::*; - -pub mod circuits; -pub use self::circuits::*; - pub mod chars; pub use self::chars::*; @@ -49,9 +37,6 @@ pub use self::functions::*; pub mod groups; pub use self::groups::*; -pub mod imports; -pub use self::imports::*; - pub mod input; pub use self::input::*; diff --git a/compiler/ast/src/program.rs b/compiler/ast/src/program.rs index 40ef1e0d00..02dd7ad60d 100644 --- a/compiler/ast/src/program.rs +++ b/compiler/ast/src/program.rs @@ -17,9 +17,7 @@ //! A Leo program consists of import, circuit, and function definitions. //! Each defined type consists of ast statements and expressions. -use crate::{Alias, Circuit, CircuitMember, DefinitionStatement, Function, FunctionInput, Identifier, ImportStatement}; - -use leo_span::{sym, Symbol}; +use crate::{Function, FunctionInput, Identifier}; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; @@ -34,18 +32,6 @@ pub struct Program { /// Expected main function inputs. /// Empty after parsing. pub expected_input: Vec, - /// The collected import statements. - pub import_statements: Vec, - #[serde(with = "crate::common::imported_modules")] - /// A map from paths to injected programs. - pub imports: IndexMap, Program>, - /// A map from alias names to type aliases. - pub aliases: IndexMap, - /// A map from circuit names to circuit definitions. - pub circuits: IndexMap, - /// A map from constant names to their definitions. - #[serde(with = "crate::common::global_consts_json")] - pub global_consts: IndexMap, DefinitionStatement>, /// A map from function names to their definitions. pub functions: IndexMap, } @@ -58,26 +44,6 @@ impl AsRef for Program { impl fmt::Display for Program { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for import in self.import_statements.iter() { - import.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; - for (_, alias) in self.aliases.iter() { - alias.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; - for (_, import) in self.imports.iter() { - import.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; - for (_, circuit) in self.circuits.iter() { - circuit.fmt(f)?; - writeln!(f,)?; - } - writeln!(f,)?; for (_, function) in self.functions.iter() { function.fmt(f)?; writeln!(f,)?; @@ -92,47 +58,10 @@ impl Program { Self { name, expected_input: vec![], - import_statements: vec![], - imports: IndexMap::new(), - aliases: IndexMap::new(), - circuits: IndexMap::new(), - global_consts: IndexMap::new(), functions: IndexMap::new(), } } - /// Handles all internal annotations like `@CoreFunction` and `@AlwaysConst`. - pub fn handle_internal_annotations(&mut self) { - self.circuits - .iter_mut() - .flat_map(|(_, circuit)| &mut circuit.members) - .filter_map(|member| { - if let CircuitMember::CircuitFunction(function) = member { - Some(function) - } else { - None - } - }) - .for_each(|function| { - function.annotations.retain(|name, core_map| { - match *name { - sym::CoreFunction => { - let new = core_map.arguments.get(0).copied().or(Some(function.identifier.name)); - function.core_mapping.replace(new); - false - } - sym::AlwaysConst => { - function.const_ = true; - false - } - // Could still be a valid annotation. - // Carry on and let ASG handle. - _ => true, - } - }) - }); - } - /// Extract the name of the program. pub fn get_name(&self) -> String { self.name.to_string() diff --git a/compiler/ast/src/reducer/reconstructing_director.rs b/compiler/ast/src/reducer/reconstructing_director.rs index e40dc08cad..06161ac65c 100644 --- a/compiler/ast/src/reducer/reconstructing_director.rs +++ b/compiler/ast/src/reducer/reconstructing_director.rs @@ -20,7 +20,7 @@ use crate::*; use leo_errors::{AstError, Result}; -use leo_span::{Span, Symbol}; +use leo_span::Span; use indexmap::IndexMap; @@ -35,15 +35,6 @@ impl ReconstructingDirector { pub fn reduce_type(&mut self, type_: &Type, span: &Span) -> Result { let new = match type_ { - Type::Array(type_, dimensions) => Type::Array(Box::new(self.reduce_type(type_, span)?), dimensions.clone()), - Type::Tuple(types) => { - let mut reduced_types = vec![]; - for type_ in types.iter() { - reduced_types.push(self.reduce_type(type_, span)?); - } - - Type::Tuple(reduced_types) - } Type::Identifier(identifier) => Type::Identifier(self.reduce_identifier(identifier)?), _ => type_.clone(), }; @@ -59,16 +50,6 @@ impl ReconstructingDirector { Expression::Binary(binary) => Expression::Binary(self.reduce_binary(binary)?), Expression::Unary(unary) => Expression::Unary(self.reduce_unary(unary)?), Expression::Ternary(ternary) => Expression::Ternary(self.reduce_ternary(ternary)?), - Expression::Cast(cast) => Expression::Cast(self.reduce_cast(cast)?), - Expression::Access(access) => Expression::Access(self.reduce_access(access)?), - - Expression::ArrayInline(array_inline) => Expression::ArrayInline(self.reduce_array_inline(array_inline)?), - Expression::ArrayInit(array_init) => Expression::ArrayInit(self.reduce_array_init(array_init)?), - - Expression::TupleInit(tuple_init) => Expression::TupleInit(self.reduce_tuple_init(tuple_init)?), - - Expression::CircuitInit(circuit_init) => Expression::CircuitInit(self.reduce_circuit_init(circuit_init)?), - Expression::Call(call) => Expression::Call(self.reduce_call(call)?), Expression::Err(s) => Expression::Err(s.clone()), }; @@ -130,140 +111,6 @@ impl ReconstructingDirector { self.reducer.reduce_ternary(ternary, condition, if_true, if_false) } - pub fn reduce_cast(&mut self, cast: &CastExpression) -> Result { - let inner = self.reduce_expression(&cast.inner)?; - let target_type = self.reduce_type(&cast.target_type, &cast.span)?; - - self.reducer.reduce_cast(cast, inner, target_type) - } - - pub fn reduce_array_access(&mut self, array_access: &ArrayAccess) -> Result { - let array = self.reduce_expression(&array_access.array)?; - let index = self.reduce_expression(&array_access.index)?; - - self.reducer.reduce_array_access(array_access, array, index) - } - - pub fn reduce_array_range_access(&mut self, array_range_access: &ArrayRangeAccess) -> Result { - let array = self.reduce_expression(&array_range_access.array)?; - let left = array_range_access - .left - .as_ref() - .map(|left| self.reduce_expression(left)) - .transpose()?; - let right = array_range_access - .right - .as_ref() - .map(|right| self.reduce_expression(right)) - .transpose()?; - - self.reducer - .reduce_array_range_access(array_range_access, array, left, right) - } - - pub fn reduce_member_access(&mut self, member_access: &MemberAccess) -> Result { - let inner = self.reduce_expression(&member_access.inner)?; - let name = self.reduce_identifier(&member_access.name)?; - let type_ = member_access - .type_ - .as_ref() - .map(|type_| self.reduce_type(type_, &member_access.span)) - .transpose()?; - - self.reducer.reduce_member_access(member_access, inner, name, type_) - } - - pub fn reduce_tuple_access(&mut self, tuple_access: &TupleAccess) -> Result { - let tuple = self.reduce_expression(&tuple_access.tuple)?; - - self.reducer.reduce_tuple_access(tuple_access, tuple) - } - - pub fn reduce_static_access(&mut self, static_access: &StaticAccess) -> Result { - let value = self.reduce_expression(&static_access.inner)?; - let name = self.reduce_identifier(&static_access.name)?; - let type_ = static_access - .type_ - .as_ref() - .map(|type_| self.reduce_type(type_, &static_access.span)) - .transpose()?; - - self.reducer.reduce_static_access(static_access, value, type_, name) - } - - pub fn reduce_access(&mut self, access: &AccessExpression) -> Result { - use AccessExpression::*; - - let new = match access { - Array(access) => Array(self.reduce_array_access(access)?), - ArrayRange(access) => ArrayRange(self.reduce_array_range_access(access)?), - Member(access) => Member(self.reduce_member_access(access)?), - Tuple(access) => Tuple(self.reduce_tuple_access(access)?), - Static(access) => Static(self.reduce_static_access(access)?), - }; - - Ok(new) - } - - pub fn reduce_array_inline(&mut self, array_inline: &ArrayInlineExpression) -> Result { - let mut elements = vec![]; - for element in array_inline.elements.iter() { - let reduced_element = match element { - SpreadOrExpression::Expression(expression) => { - SpreadOrExpression::Expression(self.reduce_expression(expression)?) - } - SpreadOrExpression::Spread(expression) => { - SpreadOrExpression::Spread(self.reduce_expression(expression)?) - } - }; - - elements.push(reduced_element); - } - - self.reducer.reduce_array_inline(array_inline, elements) - } - - pub fn reduce_array_init(&mut self, array_init: &ArrayInitExpression) -> Result { - let element = self.reduce_expression(&array_init.element)?; - - self.reducer.reduce_array_init(array_init, element) - } - - pub fn reduce_tuple_init(&mut self, tuple_init: &TupleInitExpression) -> Result { - let mut elements = vec![]; - for element in tuple_init.elements.iter() { - elements.push(self.reduce_expression(element)?); - } - - self.reducer.reduce_tuple_init(tuple_init, elements) - } - - pub fn reduce_circuit_variable_initializer( - &mut self, - variable: &CircuitVariableInitializer, - ) -> Result { - let identifier = self.reduce_identifier(&variable.identifier)?; - let expression = variable - .expression - .as_ref() - .map(|expr| self.reduce_expression(expr)) - .transpose()?; - - self.reducer - .reduce_circuit_variable_initializer(variable, identifier, expression) - } - - pub fn reduce_circuit_init(&mut self, circuit_init: &CircuitInitExpression) -> Result { - let name = self.reduce_identifier(&circuit_init.name)?; - - let mut members = vec![]; - for member in circuit_init.members.iter() { - members.push(self.reduce_circuit_variable_initializer(member)?); - } - - self.reducer.reduce_circuit_init(circuit_init, name, members) - } - pub fn reduce_call(&mut self, call: &CallExpression) -> Result { let function = self.reduce_expression(&call.function)?; @@ -422,57 +269,12 @@ impl ReconstructingDirector { inputs.push(self.reduce_function_input(input)?); } - let mut import_statements = vec![]; - for import in program.import_statements.iter() { - import_statements.push(self.reduce_import_statement(import)?); - } - - let mut imports = IndexMap::new(); - for (identifier, program) in program.imports.iter() { - let (ident, import) = self.reduce_import(identifier, program)?; - imports.insert(ident, import); - } - - let mut aliases = IndexMap::new(); - for (name, alias) in program.aliases.iter() { - let represents = self.reduce_type(&alias.represents, &alias.name.span)?; - aliases.insert( - name.clone(), - Alias { - name: alias.name.clone(), - span: alias.span.clone(), - represents, - }, - ); - } - - let mut circuits = IndexMap::new(); - self.reducer.swap_in_circuit(); - for (name, circuit) in program.circuits.iter() { - circuits.insert(name.clone(), self.reduce_circuit(circuit)?); - } - self.reducer.swap_in_circuit(); - let mut functions = IndexMap::new(); for (name, function) in program.functions.iter() { functions.insert(name.clone(), self.reduce_function(function)?); } - let mut global_consts = IndexMap::new(); - for (name, definition) in program.global_consts.iter() { - global_consts.insert(name.clone(), self.reduce_definition(definition)?); - } - - self.reducer.reduce_program( - program, - inputs, - import_statements, - imports, - aliases, - circuits, - functions, - global_consts, - ) + self.reducer.reduce_program(program, inputs, functions) } pub fn reduce_function_input_variable( @@ -490,91 +292,14 @@ impl ReconstructingDirector { FunctionInput::Variable(function_input_variable) => { FunctionInput::Variable(self.reduce_function_input_variable(function_input_variable)?) } - _ => input.clone(), }; self.reducer.reduce_function_input(input, new) } - pub fn reduce_import_tree(&mut self, tree: &ImportTree) -> Result { - let new = ImportTree { - base: tree - .base - .iter() - .map(|i| self.reduce_identifier(i)) - .collect::>()?, - - kind: match &tree.kind { - ImportTreeKind::Glob { .. } | ImportTreeKind::Leaf { alias: None } => tree.kind.clone(), - ImportTreeKind::Leaf { alias: Some(alias) } => { - let alias = self.reduce_identifier(alias)?; - ImportTreeKind::Leaf { alias: Some(alias) } - } - ImportTreeKind::Nested { tree } => ImportTreeKind::Nested { - tree: tree.iter().map(|n| self.reduce_import_tree(n)).collect::>()?, - }, - }, - span: tree.span.clone(), - }; - - self.reducer.reduce_import_tree(tree, new) - } - - pub fn reduce_import_statement(&mut self, import: &ImportStatement) -> Result { - let tree = self.reduce_import_tree(&import.tree)?; - self.reducer.reduce_import_statement(import, tree) - } - - pub fn reduce_import(&mut self, identifier: &[Symbol], import: &Program) -> Result<(Vec, Program)> { - let new_identifer = identifier.to_vec(); - let new_import = self.reduce_program(import)?; - self.reducer.reduce_import(new_identifer, new_import) - } - - pub fn reduce_circuit_member(&mut self, circuit_member: &CircuitMember) -> Result { - let new = match circuit_member { - CircuitMember::CircuitConst(identifier, type_, value) => CircuitMember::CircuitConst( - self.reduce_identifier(identifier)?, - self.reduce_type(type_, &identifier.span)?, - self.reduce_expression(value)?, - ), - CircuitMember::CircuitVariable(identifier, type_) => CircuitMember::CircuitVariable( - self.reduce_identifier(identifier)?, - self.reduce_type(type_, &identifier.span)?, - ), - CircuitMember::CircuitFunction(function) => { - CircuitMember::CircuitFunction(Box::new(self.reduce_function(function)?)) - } - }; - - self.reducer.reduce_circuit_member(circuit_member, new) - } - - pub fn reduce_circuit(&mut self, circuit: &Circuit) -> Result { - let circuit_name = self.reduce_identifier(&circuit.circuit_name)?; - - let mut members = vec![]; - for member in circuit.members.iter() { - members.push(self.reduce_circuit_member(member)?); - } - - self.reducer.reduce_circuit(circuit, circuit_name, members) - } - - fn reduce_annotation(&mut self, annotation: &Annotation) -> Result { - let name = self.reduce_identifier(&annotation.name)?; - - self.reducer.reduce_annotation(annotation, name) - } - pub fn reduce_function(&mut self, function: &Function) -> Result { let identifier = self.reduce_identifier(&function.identifier)?; - let mut annotations = IndexMap::new(); - for (name, annotation) in function.annotations.iter() { - annotations.insert(*name, self.reduce_annotation(annotation)?); - } - let mut inputs = vec![]; for input in function.input.iter() { inputs.push(self.reduce_function_input(input)?); @@ -588,14 +313,7 @@ impl ReconstructingDirector { let block = self.reduce_block(&function.block)?; - self.reducer.reduce_function( - function, - identifier, - annotations, - inputs, - function.const_, - output, - block, - ) + self.reducer + .reduce_function(function, identifier, inputs, function.const_, output, block) } } diff --git a/compiler/ast/src/reducer/reconstructing_reducer.rs b/compiler/ast/src/reducer/reconstructing_reducer.rs index 73ea29f35c..9521010288 100644 --- a/compiler/ast/src/reducer/reconstructing_reducer.rs +++ b/compiler/ast/src/reducer/reconstructing_reducer.rs @@ -113,136 +113,6 @@ pub trait ReconstructingReducer { }) } - fn reduce_cast(&mut self, cast: &CastExpression, inner: Expression, target_type: Type) -> Result { - Ok(CastExpression { - inner: Box::new(inner), - target_type, - span: cast.span.clone(), - }) - } - - fn reduce_array_access( - &mut self, - array_access: &ArrayAccess, - array: Expression, - index: Expression, - ) -> Result { - Ok(ArrayAccess { - array: Box::new(array), - index: Box::new(index), - span: array_access.span.clone(), - }) - } - - fn reduce_array_range_access( - &mut self, - array_rage_access: &ArrayRangeAccess, - array: Expression, - left: Option, - right: Option, - ) -> Result { - Ok(ArrayRangeAccess { - array: Box::new(array), - left: left.map(|expr| Box::new(expr)), - right: right.map(|expr| Box::new(expr)), - span: array_rage_access.span.clone(), - }) - } - - fn reduce_member_access( - &mut self, - member_access: &MemberAccess, - inner: Expression, - name: Identifier, - type_: Option, - ) -> Result { - Ok(MemberAccess { - inner: Box::new(inner), - name, - span: member_access.span.clone(), - type_, - }) - } - - fn reduce_tuple_access(&mut self, tuple_access: &TupleAccess, tuple: Expression) -> Result { - Ok(TupleAccess { - tuple: Box::new(tuple), - index: tuple_access.index.clone(), - span: tuple_access.span.clone(), - }) - } - - fn reduce_static_access( - &mut self, - static_access: &StaticAccess, - value: Expression, - type_: Option, - name: Identifier, - ) -> Result { - Ok(StaticAccess { - inner: Box::new(value), - name, - type_, - span: static_access.span.clone(), - }) - } - - fn reduce_array_inline( - &mut self, - array_inline: &ArrayInlineExpression, - elements: Vec, - ) -> Result { - Ok(ArrayInlineExpression { - elements, - span: array_inline.span.clone(), - }) - } - - fn reduce_array_init( - &mut self, - array_init: &ArrayInitExpression, - element: Expression, - ) -> Result { - Ok(ArrayInitExpression { - element: Box::new(element), - dimensions: array_init.dimensions.clone(), - span: array_init.span.clone(), - }) - } - - fn reduce_tuple_init( - &mut self, - tuple_init: &TupleInitExpression, - elements: Vec, - ) -> Result { - Ok(TupleInitExpression { - elements, - span: tuple_init.span.clone(), - }) - } - - fn reduce_circuit_variable_initializer( - &mut self, - _variable: &CircuitVariableInitializer, - identifier: Identifier, - expression: Option, - ) -> Result { - Ok(CircuitVariableInitializer { identifier, expression }) - } - - fn reduce_circuit_init( - &mut self, - circuit_init: &CircuitInitExpression, - name: Identifier, - members: Vec, - ) -> Result { - Ok(CircuitInitExpression { - name, - members, - span: circuit_init.span.clone(), - }) - } - fn reduce_call( &mut self, call: &CallExpression, @@ -387,22 +257,12 @@ pub trait ReconstructingReducer { &mut self, program: &Program, expected_input: Vec, - import_statements: Vec, - imports: IndexMap, Program>, - aliases: IndexMap, - circuits: IndexMap, functions: IndexMap, - global_consts: IndexMap, DefinitionStatement>, ) -> Result { Ok(Program { name: program.name.clone(), expected_input, - import_statements, - imports, - aliases, - circuits, functions, - global_consts, }) } @@ -425,48 +285,15 @@ pub trait ReconstructingReducer { Ok(new) } - fn reduce_import_tree(&mut self, _tree: &ImportTree, new: ImportTree) -> Result { - Ok(new) - } - - fn reduce_import_statement(&mut self, import: &ImportStatement, tree: ImportTree) -> Result { - Ok(ImportStatement { - tree, - span: import.span.clone(), - }) - } - fn reduce_import(&mut self, identifier: Vec, import: Program) -> Result<(Vec, Program)> { Ok((identifier, import)) } - fn reduce_circuit_member(&mut self, _circuit_member: &CircuitMember, new: CircuitMember) -> Result { - Ok(new) - } - - fn reduce_circuit( - &mut self, - _circuit: &Circuit, - circuit_name: Identifier, - members: Vec, - ) -> Result { - Ok(Circuit { circuit_name, members }) - } - - fn reduce_annotation(&mut self, annotation: &Annotation, name: Identifier) -> Result { - Ok(Annotation { - span: annotation.span.clone(), - name, - arguments: annotation.arguments.clone(), - }) - } - #[allow(clippy::too_many_arguments)] fn reduce_function( &mut self, function: &Function, identifier: Identifier, - annotations: IndexMap, input: Vec, const_: bool, output: Option, @@ -474,7 +301,6 @@ pub trait ReconstructingReducer { ) -> Result { Ok(Function { identifier, - annotations, input, const_, output, diff --git a/compiler/ast/src/types/type_.rs b/compiler/ast/src/types/type_.rs index 2a24921690..0c19983eee 100644 --- a/compiler/ast/src/types/type_.rs +++ b/compiler/ast/src/types/type_.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::{ArrayDimensions, Identifier, IntegerType}; +use crate::{Identifier, IntegerType}; use serde::{Deserialize, Serialize}; use std::fmt; @@ -36,32 +36,15 @@ pub enum Type { /// An integer type. IntegerType(IntegerType), - // Data type wrappers - /// An array type `[element; dimensions]`. - Array(Box, ArrayDimensions), - - /// A tuple type `(T_0, T_1, ...)` made up of a list of types. - Tuple(Vec), - /// A reference to either a nominal type (e.g., a `circuit`) or a type alias. Identifier(Identifier), - /// The `Self` type, allowed within `circuit` definitions. - SelfType, - /// Placeholder for a type that could not be resolved or was not well-formed. /// Will eventually lead to a compile error. Err, } impl Type { - /// - /// Returns `true` if the self `Type` is the `SelfType`. - /// - pub fn is_self(&self) -> bool { - matches!(self, Type::SelfType) - } - /// /// Returns `true` if the self `Type` is a `Circuit`. /// @@ -83,32 +66,7 @@ impl Type { (Type::Group, Type::Group) => true, (Type::IntegerType(left), Type::IntegerType(right)) => left.eq(right), (Type::Identifier(left), Type::Identifier(right)) => left.eq(right), - (Type::SelfType, Type::SelfType) => true, - (Type::Array(left_type, left_dims), Type::Array(right_type, right_dims)) => { - // Convert array dimensions to owned. - let mut left_dims = left_dims.to_owned(); - let mut right_dims = right_dims.to_owned(); - // Remove the first element from both dimensions. - let left_first = left_dims.remove_first(); - let right_first = right_dims.remove_first(); - - // Compare the first dimensions. - if left_first.ne(&right_first) { - return false; - } - - // Create a new array type from the remaining array dimensions. - let left_new_type = inner_array_type(*left_type.to_owned(), left_dims); - let right_new_type = inner_array_type(*right_type.to_owned(), right_dims); - - // Call eq_flat() on the new left and right types. - left_new_type.eq_flat(&right_new_type) - } - (Type::Tuple(left), Type::Tuple(right)) => left - .iter() - .zip(right) - .all(|(left_type, right_type)| left_type.eq_flat(right_type)), _ => false, } } @@ -124,32 +82,7 @@ impl fmt::Display for Type { Type::Group => write!(f, "group"), Type::IntegerType(ref integer_type) => write!(f, "{}", integer_type), Type::Identifier(ref variable) => write!(f, "circuit {}", variable), - Type::SelfType => write!(f, "SelfType"), - Type::Array(ref array, ref dimensions) => write!(f, "[{}; {}]", *array, dimensions), - Type::Tuple(ref tuple) => { - let types = tuple.iter().map(|x| x.to_string()).collect::>().join(", "); - - write!(f, "({})", types) - } Type::Err => write!(f, "error"), } } } - -/// Returns the type of the inner array given an array element and array dimensions. -/// -/// If the array has no dimensions, then an inner array does not exist. Simply return the given -/// element type. -/// -/// If the array has dimensions, then an inner array exists. Create a new type for the -/// inner array. The element type of the new array should be the same as the old array. The -/// dimensions of the new array should be the old array dimensions with the first dimension removed. -pub fn inner_array_type(element_type: Type, dimensions: ArrayDimensions) -> Type { - if dimensions.is_empty() { - // The array has one dimension. - element_type - } else { - // The array has multiple dimensions. - Type::Array(Box::new(element_type), dimensions) - } -} diff --git a/compiler/compiler/src/lib.rs b/compiler/compiler/src/lib.rs index a391709356..1402f11c0a 100644 --- a/compiler/compiler/src/lib.rs +++ b/compiler/compiler/src/lib.rs @@ -23,7 +23,6 @@ #![doc = include_str!("../README.md")] pub use leo_ast::Ast; -use leo_ast::AstPass; use leo_errors::emitter::Handler; use leo_errors::{CompilerError, Result}; use leo_span::symbol::create_session_if_not_set_then; @@ -76,18 +75,18 @@ impl<'a> Compiler<'a> { .map_err(|e| CompilerError::file_read_error(self.main_file_path.clone(), e))?; // Use the parser to construct the abstract syntax tree (ast). - let mut ast: leo_ast::Ast = leo_parser::parse_ast( + let ast: leo_ast::Ast = leo_parser::parse_ast( self.handler, self.main_file_path.to_str().unwrap_or_default(), program_string, )?; // Write the AST snapshot post parsing. - ast.to_json_file_without_keys(self.output_directory.clone(), "initial_ast.json", &["span"])?; + ast.to_json_file_without_keys(self.output_directory, "initial_ast.json", &["span"])?; // Canonicalize the AST. - ast = leo_ast_passes::Canonicalizer::do_pass(Default::default(), ast.into_repr())?; + // ast = leo_ast_passes::Canonicalizer::do_pass(Default::default(), ast.into_repr())?; // Write the AST snapshot post parsing - ast.to_json_file_without_keys(self.output_directory, "canonicalization_ast.json", &["span"])?; + // ast.to_json_file_without_keys(self.output_directory, "canonicalization_ast.json", &["span"])?; Ok(ast) } diff --git a/compiler/parser/src/parser/context.rs b/compiler/parser/src/parser/context.rs index 55abbf3ba0..7a0fe064d8 100644 --- a/compiler/parser/src/parser/context.rs +++ b/compiler/parser/src/parser/context.rs @@ -30,8 +30,8 @@ pub struct ParserContext<'a> { pub(crate) handler: &'a Handler, tokens: Vec, end_span: Span, - // true if parsing an expression for an if statement -- means circuit inits are not legal - pub(crate) fuzzy_struct_state: bool, + // true if parsing an expression for if and loop statements -- means circuit inits are not legal + pub(crate) disallow_circuit_construction: bool, } impl Iterator for ParserContext<'_> { @@ -61,7 +61,7 @@ impl<'a> ParserContext<'a> { .map(|x| x.span.clone()) .unwrap_or_default(), tokens, - fuzzy_struct_state: false, + disallow_circuit_construction: false, } } @@ -196,7 +196,7 @@ impl<'a> ParserContext<'a> { }; Ok(matches!( (first, next), - (Token::Function | Token::At, _) | (Token::Const, Token::Function) + (Token::Function, _) | (Token::Const, Token::Function) )) } diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 58d0b4a4c2..2e9409e10a 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -41,16 +41,16 @@ impl ParserContext<'_> { /// pub fn parse_expression(&mut self) -> Result { // Store current parser state. - let prior_fuzzy_state = self.fuzzy_struct_state; + let prior_fuzzy_state = self.disallow_circuit_construction; // Allow circuit init expressions. - self.fuzzy_struct_state = false; + self.disallow_circuit_construction = false; // Parse expression. let result = self.parse_conditional_expression(); // Restore prior parser state. - self.fuzzy_struct_state = prior_fuzzy_state; + self.disallow_circuit_construction = prior_fuzzy_state; result } @@ -199,9 +199,9 @@ impl ParserContext<'_> { /// Returns an [`Expression`] AST node if the next tokens represent a /// binary exponentiation expression. /// - /// Otherwise, tries to parse the next token using [`parse_cast_expression`]. + /// Otherwise, tries to parse the next token using [`parse_unary_expression`]. pub fn parse_exponential_expression(&mut self) -> Result { - let mut expr = self.parse_cast_expression()?; + let mut expr = self.parse_unary_expression()?; if self.eat(Token::Exp).is_some() { let right = self.parse_exponential_expression()?; @@ -211,25 +211,6 @@ impl ParserContext<'_> { Ok(expr) } - /// - /// Returns an [`Expression`] AST node if the next tokens represent a - /// type cast expression. - /// - /// Otherwise, tries to parse the next token using [`parse_unary_expression`]. - /// - pub fn parse_cast_expression(&mut self) -> Result { - let mut expr = self.parse_unary_expression()?; - while self.eat(Token::As).is_some() { - let (type_, type_span) = self.parse_type()?; - expr = Expression::Cast(CastExpression { - span: expr.span() + &type_span, - inner: Box::new(expr), - target_type: type_, - }) - } - Ok(expr) - } - /// /// Returns an [`Expression`] AST node if the next tokens represent a /// unary not, negate, or bitwise not expression. @@ -248,16 +229,6 @@ impl ParserContext<'_> { Token::Minus => UnaryOperation::Negate, _ => unreachable!("parse_unary_expression_ shouldn't produce this"), }; - // hack for const signed integer overflow issues - if matches!(operation, UnaryOperation::Negate) { - if let Expression::Value(ValueExpression::Integer(type_, value, span)) = inner { - inner = Expression::Value(ValueExpression::Integer(type_, format!("-{}", value), &op.span + &span)); - continue; - } else if let Expression::Value(ValueExpression::Implicit(value, span)) = inner { - inner = Expression::Value(ValueExpression::Implicit(format!("-{}", value), &op.span + &span)); - continue; - } - } inner = Expression::Unary(UnaryExpression { span: &op.span + inner.span(), op: operation, @@ -278,68 +249,11 @@ impl ParserContext<'_> { // the ABNF states. Rather the primary expression already // handle those. The ABNF is more specific for language reasons. let mut expr = self.parse_primary_expression()?; - while let Some(token) = self.eat_any(&[Token::LeftSquare, Token::Dot, Token::LeftParen, Token::DoubleColon]) { + while let Some(token) = self.eat_any(&[Token::Dot, Token::LeftParen]) { match token.token { - Token::LeftSquare => { - if self.eat(Token::DotDot).is_some() { - let right = if self.peek_token().as_ref() != &Token::RightSquare { - Some(Box::new(self.parse_expression()?)) - } else { - None - }; - - let end = self.expect(Token::RightSquare)?; - expr = Expression::Access(AccessExpression::ArrayRange(ArrayRangeAccess { - span: expr.span() + &end, - array: Box::new(expr), - left: None, - right, - })); - continue; - } - - let left = self.parse_expression()?; - if self.eat(Token::DotDot).is_some() { - let right = if self.peek_token().as_ref() != &Token::RightSquare { - Some(Box::new(self.parse_expression()?)) - } else { - None - }; - - let end = self.expect(Token::RightSquare)?; - expr = Expression::Access(AccessExpression::ArrayRange(ArrayRangeAccess { - span: expr.span() + &end, - array: Box::new(expr), - left: Some(Box::new(left)), - right, - })); - } else { - let end = self.expect(Token::RightSquare)?; - expr = Expression::Access(AccessExpression::Array(ArrayAccess { - span: expr.span() + &end, - array: Box::new(expr), - index: Box::new(left), - })); - } - } Token::Dot => { - if let Some(ident) = self.eat_identifier() { - expr = Expression::Access(AccessExpression::Member(MemberAccess { - span: expr.span() + &ident.span, - inner: Box::new(expr), - name: ident, - type_: None, - })); - } else if let Some((num, span)) = self.eat_int() { - expr = Expression::Access(AccessExpression::Tuple(TupleAccess { - span: expr.span() + &span, - tuple: Box::new(expr), - index: num, - })); - } else { - let next = self.peek()?; - return Err(ParserError::unexpected_str(&next.token, "int or ident", &next.span).into()); - } + let next = self.peek()?; + return Err(ParserError::unexpected_str(&next.token, "int or ident", &next.span).into()); } Token::LeftParen => { let mut arguments = Vec::new(); @@ -361,51 +275,12 @@ impl ParserContext<'_> { arguments, }); } - Token::DoubleColon => { - let ident = self.expect_ident()?; - expr = Expression::Access(AccessExpression::Static(StaticAccess { - span: expr.span() + &ident.span, - inner: Box::new(expr), - type_: None, - name: ident, - })); - } _ => unreachable!("parse_postfix_expression_ shouldn't produce this"), } } Ok(expr) } - /// - /// Returns a [`SpreadOrExpression`] AST node if the next tokens represent a - /// spread or expression. - /// - /// This method should only be called in the context of an array construction expression. - /// - pub fn parse_spread_or_expression(&mut self) -> Result { - Ok(if self.eat(Token::DotDotDot).is_some() { - SpreadOrExpression::Spread(self.parse_expression()?) - } else { - SpreadOrExpression::Expression(self.parse_expression()?) - }) - } - - /// Returns an [`Expression`] AST node if the next tokens represent a - /// circuit initialization expression. - pub fn parse_circuit_expression(&mut self, identifier: Identifier) -> Result { - let (members, _, span) = self.parse_list(Token::LeftCurly, Token::RightCurly, Token::Comma, |p| { - Ok(Some(CircuitVariableInitializer { - identifier: p.expect_ident()?, - expression: p.eat(Token::Colon).map(|_| p.parse_expression()).transpose()?, - })) - })?; - Ok(Expression::CircuitInit(CircuitInitExpression { - span: &identifier.span + &span, - name: identifier, - members, - })) - } - /// /// Returns an [`Expression`] AST node if the next tokens represent a /// tuple initialization expression or an affine group literal. @@ -438,67 +313,7 @@ impl ParserContext<'_> { if args.len() == 1 { Ok(args.remove(0)) } else { - Ok(Expression::TupleInit(TupleInitExpression { - span: span + &end_span, - elements: args, - })) - } - } - - /// - /// Returns an [`Expression`] AST node if the next tokens represent an - /// array initialization expression. - /// - pub fn parse_array_expression(&mut self, span: &Span) -> Result { - if let Some(end) = self.eat(Token::RightSquare) { - return Ok(Expression::ArrayInline(ArrayInlineExpression { - elements: Vec::new(), - span: span + &end.span, - })); - } - let first = self.parse_spread_or_expression()?; - if self.eat(Token::Semicolon).is_some() { - let dimensions = self - .parse_array_dimensions() - .map_err(|_| ParserError::unable_to_parse_array_dimensions(span))?; - let end = self.expect(Token::RightSquare)?; - let first = match first { - SpreadOrExpression::Spread(first) => { - let span = span + first.span(); - return Err(ParserError::spread_in_array_init(&span).into()); - } - SpreadOrExpression::Expression(x) => x, - }; - Ok(Expression::ArrayInit(ArrayInitExpression { - span: span + &end, - element: Box::new(first), - dimensions, - })) - } else { - let end_span; - let mut elements = vec![first]; - loop { - if let Some(token) = self.eat(Token::RightSquare) { - end_span = token.span; - break; - } - if elements.len() == 1 { - self.expect(Token::Comma)?; - if let Some(token) = self.eat(Token::RightSquare) { - end_span = token.span; - break; - } - } - elements.push(self.parse_spread_or_expression()?); - if self.eat(Token::Comma).is_none() { - end_span = self.expect(Token::RightSquare)?; - break; - } - } - Ok(Expression::ArrayInline(ArrayInlineExpression { - elements, - span: span + &end_span, - })) + Err(ParserError::unexpected("A tuple expression.", "A valid expression.", &(span + &end_span)).into()) } } @@ -554,30 +369,10 @@ impl ParserContext<'_> { })), Token::StringLit(value) => Expression::Value(ValueExpression::String(value, span)), Token::LeftParen => self.parse_tuple_expression(&span)?, - Token::LeftSquare => self.parse_array_expression(&span)?, Token::Ident(name) => { let ident = Identifier { name, span }; - if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly { - self.parse_circuit_expression(ident)? - } else { - Expression::Identifier(ident) - } + Expression::Identifier(ident) } - Token::BigSelf => { - let ident = Identifier { - name: sym::SelfUpper, - span, - }; - if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly { - self.parse_circuit_expression(ident)? - } else { - Expression::Identifier(ident) - } - } - Token::LittleSelf => Expression::Identifier(Identifier { - name: sym::SelfLower, - span, - }), Token::Input => Expression::Identifier(Identifier { name: sym::input, span }), t if crate::type_::TYPE_TOKENS.contains(&t) => Expression::Identifier(Identifier { name: t.keyword_to_symbol().unwrap(), diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index 6318e66600..207711b1d5 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -15,7 +15,6 @@ // along with the Leo library. If not, see . use super::*; -use crate::KEYWORD_TOKENS; use leo_errors::{ParserError, Result}; use leo_span::sym; @@ -25,372 +24,50 @@ impl ParserContext<'_> { /// Returns a [`Program`] AST if all tokens can be consumed and represent a valid Leo program. /// pub fn parse_program(&mut self) -> Result { - let mut import_statements = Vec::new(); - let mut aliases = IndexMap::new(); - let mut circuits = IndexMap::new(); let mut functions = IndexMap::new(); - let mut global_consts = IndexMap::new(); - // let mut tests = IndexMap::new(); while self.has_next() { let token = self.peek()?; match &token.token { - Token::Import => { - import_statements.push(self.parse_import_statement()?); - } - Token::Circuit => { - self.expect(Token::Circuit)?; - let (id, circuit) = self.parse_circuit()?; - circuits.insert(id, circuit); - } - Token::Ident(ident) => match *ident { - sym::test => return Err(ParserError::test_function(&token.span).into()), - kw @ (sym::Struct | sym::Class) => { - self.emit_err(ParserError::unexpected(kw, "circuit", &token.span)); - self.bump().unwrap(); - let (id, circuit) = self.parse_circuit()?; - circuits.insert(id, circuit); - } - _ => return Err(Self::unexpected_item(token).into()), - }, + Token::Ident(sym::test) => return Err(ParserError::test_function(&token.span).into()), // Const functions share the first token with the global Const. Token::Const if self.peek_is_function()? => { let (id, function) = self.parse_function_declaration()?; functions.insert(id, function); } - Token::Const => { - let (name, global_const) = self.parse_global_const_declaration()?; - global_consts.insert(name, global_const); - } - Token::Function | Token::At => { + Token::Function => { let (id, function) = self.parse_function_declaration()?; functions.insert(id, function); } - Token::Type => { - let (name, alias) = self.parse_type_alias()?; - aliases.insert(name, alias); - } _ => return Err(Self::unexpected_item(token).into()), } } Ok(Program { name: String::new(), expected_input: Vec::new(), - import_statements, - imports: IndexMap::new(), - aliases, - circuits, functions, - global_consts, }) } fn unexpected_item(token: &SpannedToken) -> ParserError { ParserError::unexpected( &token.token, - [ - Token::Import, - Token::Circuit, - Token::Function, - Token::Ident(sym::test), - Token::At, - ] - .iter() - .map(|x| format!("'{}'", x)) - .collect::>() - .join(", "), + [Token::Function, Token::Ident(sym::test)] + .iter() + .map(|x| format!("'{}'", x)) + .collect::>() + .join(", "), &token.span, ) } - /// Returns an [`Annotation`] AST node if the next tokens represent a supported annotation. - pub fn parse_annotation(&mut self) -> Result { - let start = self.expect(Token::At)?; - let name = self.parse_annotation_name()?; - - assert_no_whitespace(&start, &name.span, &name.name.as_str(), "@")?; - - let (end_span, arguments) = if self.peek_is_left_par() { - let (args, _, span) = self.parse_paren_comma_list(|p| { - Ok(if let Some(ident) = p.eat_identifier() { - Some(ident.name) - } else { - let token = p.expect_any()?; - p.emit_err(ParserError::unexpected_str(&token.token, "ident", &token.span)); - None - }) - })?; - (span, args) - } else { - (name.span.clone(), Vec::new()) - }; - Ok(Annotation { - name, - arguments, - span: start + end_span, - }) - } - - /// Parses `foo` in an annotation `@foo . That is, the name of the annotation. - fn parse_annotation_name(&mut self) -> Result { - let mut name = self.expect_ident()?; - - // Recover `context` instead of `test`. - if name.name == sym::context { - self.emit_err(ParserError::context_annotation(&name.span)); - name.name = sym::test; - } - - Ok(name) - } - - /// Returns an [`Identifier`] AST node if the next tokens represent a valid package name. - pub fn parse_package_name(&mut self) -> Result { - // Build the package name, starting with valid characters up to a dash `-` (Token::Minus). - let base = self.expect_loose_identifier()?; - - // Return an error if the package name contains a keyword. - if let Some(token) = KEYWORD_TOKENS.iter().find(|x| x.keyword_to_symbol() == Some(base.name)) { - self.emit_err(ParserError::unexpected_str(token, "package name", &base.span)); - } - - // Return the package name. - Ok(base) - } - - /// Returns an [`ImportTree`] AST node if the next tokens represent a valid package import - /// with accesses. - // Public solely for writing import parsing tests. - pub fn parse_import_tree(&mut self) -> Result { - // Parse the first part of the path. - let first_name = self.parse_package_name()?; - let start = first_name.span.clone(); - let mut base = vec![first_name]; - - let make = |base, end, kind| { - let span = start + end; - ImportTree { base, span, kind } - }; - - // Paths are separated by `.`s. - while self.eat(Token::Dot).is_some() { - if self.peek_is_left_par() { - // Encountered `.(`, so we have a nested import. Recurse! - let (tree, _, end) = self.parse_paren_comma_list(|p| p.parse_import_tree().map(Some))?; - - if tree.is_empty() { - self.emit_err(ParserError::invalid_import_list(&end)); - } - - return Ok(make(base, end, ImportTreeKind::Nested { tree })); - } else if let Some(SpannedToken { span, .. }) = self.eat(Token::Mul) { - // Encountered `.*`, so we have a glob import. - return Ok(make(base, span.clone(), ImportTreeKind::Glob { span })); - } - - // Parse another path segment. - base.push(self.parse_package_name()?); - } - - let (end, alias) = if self.eat(Token::As).is_some() { - // Encountered `as`, so interpret as `path as rename`. - let alias = self.expect_ident()?; - (alias.span.clone(), Some(alias)) - } else { - (base.last().unwrap().span.clone(), None) - }; - Ok(make(base, end, ImportTreeKind::Leaf { alias })) - } - - /// Returns a [`ImportStatement`] AST node if the next tokens represent an import statement. - pub fn parse_import_statement(&mut self) -> Result { - self.expect(Token::Import)?; - let tree = self.parse_import_tree()?; - self.expect(Token::Semicolon)?; - Ok(ImportStatement { - span: tree.span.clone(), - tree, - }) - } - - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable - /// or circuit member function or circuit member constant. - pub fn parse_circuit_declaration(&mut self) -> Result> { - let mut members = Vec::new(); - - let (mut semi_colons, mut commas) = (false, false); - - while self.eat(Token::RightCurly).is_none() { - members.push(if self.peek_is_function()? { - // function - self.parse_member_function_declaration()? - } else if *self.peek_token() == Token::Static { - // static const - self.parse_const_member_variable_declaration()? - } else { - // variable - let variable = self.parse_member_variable_declaration()?; - - if let Some(semi) = self.eat(Token::Semicolon) { - if commas { - self.emit_err(ParserError::mixed_commas_and_semicolons(&semi.span)); - } - semi_colons = true; - } - - if let Some(comma) = self.eat(Token::Comma) { - if semi_colons { - self.emit_err(ParserError::mixed_commas_and_semicolons(&comma.span)); - } - commas = true; - } - - variable - }); - } - - self.ban_mixed_member_order(&members); - - Ok(members) - } - - /// Emits errors if order isn't `consts variables functions`. - fn ban_mixed_member_order(&self, members: &[CircuitMember]) { - let mut had_var = false; - let mut had_fun = false; - for member in members { - match member { - CircuitMember::CircuitConst(id, _, e) if had_var => { - self.emit_err(ParserError::member_const_after_var(&(id.span() + e.span()))); - } - CircuitMember::CircuitConst(id, _, e) if had_fun => { - self.emit_err(ParserError::member_const_after_fun(&(id.span() + e.span()))); - } - CircuitMember::CircuitVariable(id, _) if had_fun => { - self.emit_err(ParserError::member_var_after_fun(id.span())); - } - CircuitMember::CircuitConst(..) => {} - CircuitMember::CircuitVariable(..) => had_var = true, - CircuitMember::CircuitFunction(..) => had_fun = true, - } - } - } - - /// Parses `IDENT: TYPE`. - fn parse_typed_field_name(&mut self) -> Result<(Identifier, Type)> { - let name = self.expect_ident()?; - self.expect(Token::Colon)?; - let type_ = self.parse_type()?.0; - - Ok((name, type_)) - } - - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member static constant. - pub fn parse_const_member_variable_declaration(&mut self) -> Result { - self.expect(Token::Static)?; - self.expect(Token::Const)?; - - // `IDENT: TYPE = EXPR`: - let (name, type_) = self.parse_typed_field_name()?; - self.expect(Token::Assign)?; - let literal = self.parse_primary_expression()?; - - self.expect(Token::Semicolon)?; - - Ok(CircuitMember::CircuitConst(name, type_, literal)) - } - - /// - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable. - /// - pub fn parse_member_variable_declaration(&mut self) -> Result { - let (name, type_) = self.parse_typed_field_name()?; - - Ok(CircuitMember::CircuitVariable(name, type_)) - } - - /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member function. - pub fn parse_member_function_declaration(&mut self) -> Result { - let peeked = self.peek()?.clone(); - if self.peek_is_function()? { - let function = self.parse_function_declaration()?; - Ok(CircuitMember::CircuitFunction(Box::new(function.1))) - } else { - return Err(ParserError::unexpected( - &peeked.token, - [Token::Function, Token::At, Token::Const] - .iter() - .map(|x| format!("'{}'", x)) - .collect::>() - .join(", "), - &peeked.span, - ) - .into()); - } - } - - /// - /// Returns an [`(Identifier, Circuit)`] tuple of AST nodes if the next tokens represent a - /// circuit name and definition statement. - /// - pub fn parse_circuit(&mut self) -> Result<(Identifier, Circuit)> { - let name = if let Some(ident) = self.eat_identifier() { - ident - } else if let Some(scalar_type) = self.eat_any(crate::type_::TYPE_TOKENS) { - Identifier { - name: scalar_type.token.keyword_to_symbol().unwrap(), - span: scalar_type.span, - } - } else { - let next = self.peek()?; - return Err(ParserError::unexpected_str(&next.token, "ident", &next.span).into()); - }; - - self.expect(Token::LeftCurly)?; - let members = self.parse_circuit_declaration()?; - - Ok(( - name.clone(), - Circuit { - circuit_name: name, - members, - }, - )) - } - /// /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. /// - pub fn parse_function_parameters(&mut self, first: bool) -> Result { + pub fn parse_function_parameters(&mut self) -> Result { let const_ = self.eat(Token::Const); let mutable = self.eat(Token::Mut); - let reference = self.eat(Token::Ampersand); - let mut name = if let Some(token) = self.eat(Token::LittleSelf) { - Identifier { - name: sym::SelfLower, - span: token.span, - } - } else { - self.expect_ident()? - }; - if name.name == sym::SelfLower { - if !first { - return Err(ParserError::parser_self_outside_first_argument().into()); - } else if let Some(mutable) = &mutable { - self.emit_err(ParserError::mut_self_parameter(&(&mutable.span + &name.span))); - return Ok(Self::build_ref_self(name, mutable)); - } else if let Some(reference) = &reference { - // Handle `&self`. - return Ok(Self::build_ref_self(name, reference)); - } else if let Some(const_) = &const_ { - // Handle `const self`. - name.span = &const_.span + &name.span; - name.name = Symbol::intern("const self"); - return Ok(FunctionInput::ConstSelfKeyword(ConstSelfKeyword { identifier: name })); - } - // Handle `self`. - return Ok(FunctionInput::SelfKeyword(SelfKeyword { identifier: name })); - } + let name = self.expect_ident()?; if let Some(mutable) = &mutable { self.emit_err(ParserError::mut_function_input(&(&mutable.span + &name.span))); @@ -407,24 +84,9 @@ impl ParserContext<'_> { })) } - /// Builds a function parameter `&self`. - fn build_ref_self(mut name: Identifier, reference: &SpannedToken) -> FunctionInput { - name.span = &reference.span + &name.span; - // FIXME(Centril): This should be *two* tokens, NOT one! - name.name = Symbol::intern("&self"); - FunctionInput::RefSelfKeyword(RefSelfKeyword { identifier: name }) - } - /// Returns an [`(Identifier, Function)`] AST node if the next tokens represent a function name /// and function definition. pub fn parse_function_declaration(&mut self) -> Result<(Identifier, Function)> { - // Parse any annotations. - let mut annotations = IndexMap::new(); - while self.peek_token().as_ref() == &Token::At { - let annotation = self.parse_annotation()?; - annotations.insert(annotation.name.name, annotation); - } - // Parse optional const modifier. let const_ = self.eat(Token::Const).is_some(); @@ -433,12 +95,7 @@ impl ParserContext<'_> { let name = self.expect_ident()?; // Parse parameters. - let mut first = true; - let (inputs, ..) = self.parse_paren_comma_list(|p| { - let param = p.parse_function_parameters(first).map(Some); - first = false; - param - })?; + let (inputs, ..) = self.parse_paren_comma_list(|p| p.parse_function_parameters().map(Some))?; // Parse return type. let output = if self.eat(Token::Arrow).is_some() { @@ -453,7 +110,6 @@ impl ParserContext<'_> { Ok(( name.clone(), Function { - annotations, identifier: name, input: inputs, const_, @@ -479,17 +135,4 @@ impl ParserContext<'_> { Ok((variable_names, statement)) } - - /// - /// Returns a [`(String, Alias)`] AST node if the next tokens represent a type alias declaration. - /// - pub fn parse_type_alias(&mut self) -> Result<(Identifier, Alias)> { - let start = self.expect(Token::Type)?; - let name = self.expect_ident()?; - self.expect(Token::Assign)?; - let (represents, _) = self.parse_type()?; - let span = start + self.expect(Token::Semicolon)?; - - Ok((name.clone(), Alias { represents, span, name })) - } } diff --git a/compiler/parser/src/parser/mod.rs b/compiler/parser/src/parser/mod.rs index 89020f61b6..60f041cbdf 100644 --- a/compiler/parser/src/parser/mod.rs +++ b/compiler/parser/src/parser/mod.rs @@ -24,7 +24,7 @@ use crate::{tokenizer::*, Token}; use leo_ast::*; use leo_errors::emitter::Handler; use leo_errors::{ParserError, Result}; -use leo_span::{Span, Symbol}; +use leo_span::Span; use indexmap::IndexMap; use std::unreachable; diff --git a/compiler/parser/src/parser/statement.rs b/compiler/parser/src/parser/statement.rs index 3155a0b633..ce2fdaa0a6 100644 --- a/compiler/parser/src/parser/statement.rs +++ b/compiler/parser/src/parser/statement.rs @@ -33,36 +33,11 @@ impl ParserContext<'_> { /// Returns an [`Identifier`] AST node if the given [`Expression`] AST node evaluates to an /// identifier access. The access is stored in the given accesses. /// - pub fn construct_assignee_access(expr: Expression, accesses: &mut Vec) -> Result { - let identifier; + pub fn construct_assignee_access(expr: Expression, _accesses: &mut Vec) -> Result { match expr { - Expression::Access(access) => match access { - AccessExpression::Member(expr) => { - identifier = Self::construct_assignee_access(*expr.inner, accesses)?; - accesses.push(AssigneeAccess::Member(expr.name)); - } - AccessExpression::Tuple(expr) => { - identifier = Self::construct_assignee_access(*expr.tuple, accesses)?; - accesses.push(AssigneeAccess::Tuple(expr.index, expr.span)); - } - AccessExpression::ArrayRange(expr) => { - identifier = Self::construct_assignee_access(*expr.array, accesses)?; - accesses.push(AssigneeAccess::ArrayRange( - expr.left.map(|x| *x), - expr.right.map(|x| *x), - )); - } - AccessExpression::Array(expr) => { - identifier = Self::construct_assignee_access(*expr.array, accesses)?; - accesses.push(AssigneeAccess::ArrayIndex(*expr.index)); - } - _ => return Err(ParserError::invalid_assignment_target(access.span()).into()), - }, - - Expression::Identifier(id) => identifier = id, + Expression::Identifier(id) => Ok(id), _ => return Err(ParserError::invalid_assignment_target(expr.span()).into()), } - Ok(identifier) } /// @@ -167,9 +142,9 @@ impl ParserContext<'_> { /// Returns a [`ConditionalStatement`] AST node if the next tokens represent a conditional statement. pub fn parse_conditional_statement(&mut self) -> Result { let start = self.expect(Token::If)?; - self.fuzzy_struct_state = true; + self.disallow_circuit_construction = true; let expr = self.parse_conditional_expression()?; - self.fuzzy_struct_state = false; + self.disallow_circuit_construction = false; let body = self.parse_block()?; let next = if self.eat(Token::Else).is_some() { let s = self.parse_statement()?; @@ -199,9 +174,9 @@ impl ParserContext<'_> { let start = self.parse_expression()?; self.expect(Token::DotDot)?; let inclusive = self.eat(Token::Assign).is_some(); - self.fuzzy_struct_state = true; + self.disallow_circuit_construction = true; let stop = self.parse_conditional_expression()?; - self.fuzzy_struct_state = false; + self.disallow_circuit_construction = false; let block = self.parse_block()?; diff --git a/compiler/parser/src/parser/type_.rs b/compiler/parser/src/parser/type_.rs index 1d4f100581..4b8caefb07 100644 --- a/compiler/parser/src/parser/type_.rs +++ b/compiler/parser/src/parser/type_.rs @@ -15,9 +15,7 @@ // along with the Leo library. If not, see . use super::*; -use leo_errors::{ParserError, Result}; - -use smallvec::smallvec; +use leo_errors::Result; pub(crate) const TYPE_TOKENS: &[Token] = &[ Token::I8, @@ -57,48 +55,12 @@ impl ParserContext<'_> { }) } - /// Returns an [`ArrayDimensions`] AST node if the next tokens represent dimensions for an array type. - pub fn parse_array_dimensions(&mut self) -> Result { - Ok(if let Some((dim, _)) = self.eat_int() { - ArrayDimensions(smallvec![dim]) - } else { - let mut had_item_err = false; - let (dims, _, span) = self.parse_paren_comma_list(|p| { - Ok(if let Some((dim, _)) = p.eat_int() { - Some(dim) - } else { - let token = p.expect_any()?; - p.emit_err(ParserError::unexpected_str(&token.token, "int", &token.span)); - had_item_err = true; - None - }) - })?; - if dims.is_empty() && !had_item_err { - self.emit_err(ParserError::array_tuple_dimensions_empty(&span)); - } else if dims.len() == 1 { - self.emit_err(ParserError::invalid_parens_around_single_array_dimension_size(&span)); - } - ArrayDimensions(dims.into()) - }) - } - /// Returns a [`(Type, Span)`] tuple of AST nodes if the next token represents a type. /// Also returns the span of the parsed token. pub fn parse_type(&mut self) -> Result<(Type, Span)> { - Ok(if let Some(token) = self.eat(Token::BigSelf) { - (Type::SelfType, token.span) - } else if let Some(ident) = self.eat_identifier() { + Ok(if let Some(ident) = self.eat_identifier() { let span = ident.span.clone(); (Type::Identifier(ident), span) - } else if self.peek_is_left_par() { - let (types, _, span) = self.parse_paren_comma_list(|p| p.parse_type().map(|t| Some(t.0)))?; - (Type::Tuple(types), span) - } else if let Some(token) = self.eat(Token::LeftSquare) { - let (inner, _) = self.parse_type()?; - self.expect(Token::Semicolon)?; - let dimensions = self.parse_array_dimensions()?; - let end_span = self.expect(Token::RightSquare)?; - (Type::Array(Box::new(inner), dimensions), token.span + end_span) } else { let token = self.expect_oneof(TYPE_TOKENS)?; ( diff --git a/compiler/parser/src/test.rs b/compiler/parser/src/test.rs index 12bdf89074..1fa2de3273 100644 --- a/compiler/parser/src/test.rs +++ b/compiler/parser/src/test.rs @@ -111,27 +111,6 @@ impl Namespace for ParseExpressionNamespace { } } -struct ParseImportNamespace; - -impl Namespace for ParseImportNamespace { - fn parse_type(&self) -> ParseType { - ParseType::ContinuousLines - } - - fn run_test(&self, test: Test) -> Result { - create_session_if_not_set_then(|_| { - let tokenizer = tokenize(test)?; - if all_are_comments(&tokenizer) { - return Ok(yaml_or_fail(Statement::Expression(ExpressionStatement { - expression: implicit_value_expr(), - span: Span::default(), - }))); - } - with_handler(tokenizer, |p| p.parse_import_statement()).map(yaml_or_fail) - }) - } -} - struct ParseStatementNamespace; impl Namespace for ParseStatementNamespace { @@ -248,7 +227,6 @@ impl Runner for TestRunner { fn resolve_namespace(&self, name: &str) -> Option> { Some(match name { "Parse" => Box::new(ParseNamespace), - "ParseImport" => Box::new(ParseImportNamespace), "ParseExpression" => Box::new(ParseExpressionNamespace), "ParseStatement" => Box::new(ParseStatementNamespace), "Serialize" => Box::new(SerializeNamespace), diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 233ea4d0a0..f8f87ae77c 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -209,7 +209,7 @@ impl Token { return Ok((len + 2, Token::StringLit(string))); } - return Err(ParserError::lexer_string_not_closed(string).into()); + return Err(ParserError::lexer_string_not_closed(leo_ast::Chars(string)).into()); } Some('\'') => { input.next(); @@ -244,7 +244,7 @@ impl Token { if input.next_if_eq(&'&').is_some() { return Ok((2, Token::And)); } - return Ok((1, Token::Ampersand)); + return Err(ParserError::lexer_empty_input_tendril().into()); } Some('(') => { input.next(); @@ -293,11 +293,7 @@ impl Token { Some('.') => { input.next(); if input.next_if_eq(&'.').is_some() { - if input.next_if_eq(&'.').is_some() { - return Ok((3, Token::DotDotDot)); - } else { - return Ok((2, Token::DotDot)); - } + return Ok((2, Token::DotDot)); } return Ok((1, Token::Dot)); } @@ -344,11 +340,7 @@ impl Token { } Some(':') => { input.next(); - if input.next_if_eq(&':').is_some() { - return Ok((2, Token::DoubleColon)); - } else { - return Ok((1, Token::Colon)); - } + return Ok((1, Token::Colon)); } Some(';') => { input.next(); @@ -375,10 +367,6 @@ impl Token { } return Ok((1, Token::Assign)); } - Some('@') => { - input.next(); - return Ok((1, Token::At)); - } Some('[') => { input.next(); return Ok((1, Token::LeftSquare)); @@ -413,10 +401,8 @@ impl Token { match &*ident { x if x.starts_with("aleo1") => Token::AddressLit(ident), "address" => Token::Address, - "as" => Token::As, "bool" => Token::Bool, "char" => Token::Char, - "circuit" => Token::Circuit, "console" => Token::Console, "const" => Token::Const, "else" => Token::Else, @@ -431,15 +417,11 @@ impl Token { "i64" => Token::I64, "i128" => Token::I128, "if" => Token::If, - "import" => Token::Import, "in" => Token::In, "input" => Token::Input, "let" => Token::Let, "mut" => Token::Mut, "return" => Token::Return, - "Self" => Token::BigSelf, - "self" => Token::LittleSelf, - "static" => Token::Static, "true" => Token::True, "type" => Token::Type, "u8" => Token::U8, diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index 7b6d8fd23d..69fce18a11 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -124,9 +124,7 @@ mod tests { test_ident 12345 address - as bool - circuit const else false @@ -140,14 +138,11 @@ mod tests { i16 i8 if - import in input let mut - & return - static string test true @@ -156,8 +151,6 @@ mod tests { u32 u16 u8 - self - Self console ! != @@ -177,11 +170,9 @@ mod tests { _ . .. - ... / /= : - :: ; < <= @@ -189,7 +180,6 @@ mod tests { == > >= - @ [ ] {{ @@ -209,7 +199,7 @@ mod tests { assert_eq!( output, - r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address as bool circuit const else false field for function group i128 i64 i32 i16 i8 if import in input let mut & return static string test true u128 u64 u32 u16 u8 self Self console ! != && ( ) * ** **= *= + += , - -= -> _ . .. ... / /= : :: ; < <= = == > >= @ [ ] { { } } || ? // test + r#"'a' '😭' "test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 test_ident 12345 address bool const else false field for function group i128 i64 i32 i16 i8 if in input let mut return string test true u128 u64 u32 u16 u8 console ! != && ( ) * ** **= *= + += , - -= -> _ . .. / /= : ; < <= = == > >= [ ] { { } } || ? // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 167fd04dff..f4f3fed866 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -61,7 +61,6 @@ pub enum Token { WhiteSpace, // Symbols - At, Not, And, Or, @@ -91,10 +90,8 @@ pub enum Token { Comma, Dot, DotDot, - DotDotDot, Semicolon, Colon, - DoubleColon, Question, Arrow, Underscore, @@ -116,18 +113,11 @@ pub enum Token { Bool, Address, Char, - BigSelf, // primary expresion Input, - LittleSelf, - - // Import - Import, // Regular Keywords - As, - Circuit, Console, /// Const variable and a const function. Const, @@ -138,11 +128,7 @@ pub enum Token { In, Let, Mut, - /// Represents `&`. - /// Used for `Reference` and `BitAnd`. - Ampersand, Return, - Static, Type, // Meta Tokens @@ -152,10 +138,8 @@ pub enum Token { /// Represents all valid Leo keyword tokens. pub const KEYWORD_TOKENS: &[Token] = &[ Token::Address, - Token::As, Token::Bool, Token::Char, - Token::Circuit, Token::Console, Token::Const, Token::Else, @@ -170,16 +154,11 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::I64, Token::I128, Token::If, - Token::Import, Token::In, Token::Input, Token::Let, Token::Mut, - Token::Ampersand, Token::Return, - Token::BigSelf, - Token::LittleSelf, - Token::Static, Token::True, Token::Type, Token::U8, @@ -199,11 +178,8 @@ impl Token { pub fn keyword_to_symbol(&self) -> Option { Some(match self { Token::Address => sym::address, - Token::As => sym::As, - Token::At => sym::At, Token::Bool => sym::bool, Token::Char => sym::char, - Token::Circuit => sym::circuit, Token::Console => sym::console, Token::Const => sym::Const, Token::Else => sym::Else, @@ -218,16 +194,11 @@ impl Token { Token::I64 => sym::i64, Token::I128 => sym::i128, Token::If => sym::If, - Token::Import => sym::import, Token::In => sym::In, Token::Input => sym::input, Token::Let => sym::Let, Token::Mut => sym::Mut, - Token::Ampersand => sym::Ampersand, Token::Return => sym::Return, - Token::BigSelf => sym::SelfUpper, - Token::LittleSelf => sym::SelfLower, - Token::Static => sym::Static, Token::True => sym::True, Token::Type => sym::Type, Token::U8 => sym::u8, @@ -261,8 +232,6 @@ impl fmt::Display for Token { CharLit(s) => write!(f, "'{}'", s), WhiteSpace => write!(f, "whitespace"), - At => write!(f, "@"), - Not => write!(f, "!"), And => write!(f, "&&"), Or => write!(f, "||"), @@ -292,10 +261,8 @@ impl fmt::Display for Token { Comma => write!(f, ","), Dot => write!(f, "."), DotDot => write!(f, ".."), - DotDotDot => write!(f, "..."), Semicolon => write!(f, ";"), Colon => write!(f, ":"), - DoubleColon => write!(f, "::"), Question => write!(f, "?"), Arrow => write!(f, "->"), Underscore => write!(f, "_"), @@ -315,15 +282,9 @@ impl fmt::Display for Token { Bool => write!(f, "bool"), Address => write!(f, "address"), Char => write!(f, "char"), - BigSelf => write!(f, "Self"), Input => write!(f, "input"), - LittleSelf => write!(f, "self"), - Import => write!(f, "import"), - - As => write!(f, "as"), - Circuit => write!(f, "circuit"), Console => write!(f, "console"), Const => write!(f, "const"), Else => write!(f, "else"), @@ -333,9 +294,7 @@ impl fmt::Display for Token { In => write!(f, "in"), Let => write!(f, "let"), Mut => write!(f, "mut"), - Ampersand => write!(f, "&"), // Used for `Reference` and `BitAnd` Return => write!(f, "return"), - Static => write!(f, "static"), Type => write!(f, "type"), Eof => write!(f, ""), } diff --git a/docs/grammar/README.md b/docs/grammar/README.md index b22408b78d..40f6173c50 100644 Binary files a/docs/grammar/README.md and b/docs/grammar/README.md differ diff --git a/leo/errors/src/parser/parser_errors.rs b/leo/errors/src/parser/parser_errors.rs index 64afc7e82d..9ce55319ca 100644 --- a/leo/errors/src/parser/parser_errors.rs +++ b/leo/errors/src/parser/parser_errors.rs @@ -235,8 +235,8 @@ create_errors!( /// When a string is not properly closed. @backtraced lexer_string_not_closed { - args: (input: impl Debug), - msg: format!("Expected a closed string but found `{:?}`.", input), + args: (input: impl Display), + msg: format!("Expected a closed string but found `{}`.", input), help: None, } diff --git a/leo/span/src/symbol.rs b/leo/span/src/symbol.rs index 0c7f0068e1..7f5bbe42b0 100644 --- a/leo/span/src/symbol.rs +++ b/leo/span/src/symbol.rs @@ -101,14 +101,10 @@ macro_rules! symbols { symbols! { address, AlwaysConst, - Ampersand: "&", array, - As: "as", assert, - At: "@", bool, char, - circuit, Class: "class", context, constants, @@ -128,7 +124,6 @@ symbols! { i64, i128, If: "if", - import, In: "in", input, Let: "let", @@ -137,11 +132,8 @@ symbols! { Mut: "mut", prelude, Return: "return", - SelfLower: "self", - SelfUpper: "Self", Star: "*", std, - Static: "static", Struct: "struct", test, True: "true", diff --git a/tests/expectations/parser/parser/circuits/consts.leo.out b/tests/expectations/parser/parser/circuits/consts.leo.out index 84c302700b..b641879948 100644 --- a/tests/expectations/parser/parser/circuits/consts.leo.out +++ b/tests/expectations/parser/parser/circuits/consts.leo.out @@ -37,5 +37,129 @@ outputs: col_stop: 28 path: "" content: " static const y: u32 = 5;" + - CircuitConst: + - "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}" + - IntegerType: U8 + - Identifier: "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}" + - CircuitConst: + - "{\"name\":\"FOO\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}" + - Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":23,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}" + - CircuitInit: + name: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}" + members: [] + span: + line_start: 7 + line_stop: 7 + col_start: 29 + col_stop: 35 + path: "" + content: " static const FOO: Foo = Foo {};" + - CircuitConst: + - "{\"name\":\"INDEXED\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}" + - Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":27,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}" + - Access: + Array: + array: + Identifier: "{\"name\":\"A\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}" + index: + Value: + Implicit: + - "0" + - span: + line_start: 8 + line_stop: 8 + col_start: 35 + col_stop: 36 + path: "" + content: " static const INDEXED: Foo = A[0];" + span: + line_start: 8 + line_stop: 8 + col_start: 33 + col_stop: 37 + path: "" + content: " static const INDEXED: Foo = A[0];" + - CircuitConst: + - "{\"name\":\"TINDEXED\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":18,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}" + - Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":28,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}" + - Access: + Tuple: + tuple: + Identifier: "{\"name\":\"T\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}" + index: + value: "0" + span: + line_start: 9 + line_stop: 9 + col_start: 34 + col_stop: 37 + path: "" + content: " static const TINDEXED: Foo = T.0;" + - CircuitConst: + - "{\"name\":\"TWO\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TWO: i8 = 1i8 + 1i8;\\\"}\"}" + - IntegerType: I8 + - Binary: + left: + Value: + Integer: + - I8 + - "1" + - span: + line_start: 10 + line_stop: 10 + col_start: 28 + col_stop: 31 + path: "" + content: " static const TWO: i8 = 1i8 + 1i8;" + right: + Value: + Integer: + - I8 + - "1" + - span: + line_start: 10 + line_stop: 10 + col_start: 34 + col_stop: 37 + path: "" + content: " static const TWO: i8 = 1i8 + 1i8;" + op: Add + span: + line_start: 10 + line_stop: 10 + col_start: 28 + col_stop: 37 + path: "" + content: " static const TWO: i8 = 1i8 + 1i8;" + - CircuitConst: + - "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}" + - IntegerType: I8 + - Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":29,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}" + op: Mul + span: + line_start: 11 + line_stop: 11 + col_start: 29 + col_stop: 34 + path: "" + content: " static const mult: i8 = x * y;" + - CircuitConst: + - "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}" + - IntegerType: I8 + - Call: + function: + Identifier: "{\"name\":\"one\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}" + arguments: [] + span: + line_start: 12 + line_stop: 12 + col_start: 29 + col_stop: 34 + path: "" + content: " static const mult: i8 = one();" global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/consts_fail.leo.out b/tests/expectations/parser/parser/circuits/consts_fail.leo.out new file mode 100644 index 0000000000..9614d661e4 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/consts_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370000]: Function calls not allowed in circuit members.\n --> test:4:27\n |\n 4 | static const x: u32 = foo();\n | ^^^^^" diff --git a/tests/expectations/parser/parser/circuits/token_circuit_name.leo.out b/tests/expectations/parser/parser/circuits/token_circuit_name.leo.out new file mode 100644 index 0000000000..cb22bdf26f --- /dev/null +++ b/tests/expectations/parser/parser/circuits/token_circuit_name.leo.out @@ -0,0 +1,15 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: + "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit u32 {}\\\"}\"}": + circuit_name: "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit u32 {}\\\"}\"}" + members: [] + global_consts: {} + functions: {} diff --git a/tests/expectations/parser/parser/circuits/types_fail.leo.out b/tests/expectations/parser/parser/circuits/types_fail.leo.out new file mode 100644 index 0000000000..da52e8669f --- /dev/null +++ b/tests/expectations/parser/parser/circuits/types_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'address'\n --> test:3:9\n |\n 3 | circuit address {}\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/expression/access/array_access.leo.out b/tests/expectations/parser/parser/expression/access/array_access.leo.out index 045d403df6..5d9ff7c8fc 100644 --- a/tests/expectations/parser/parser/expression/access/array_access.leo.out +++ b/tests/expectations/parser/parser/expression/access/array_access.leo.out @@ -215,41 +215,6 @@ outputs: col_stop: 7 path: "" content: "x()[0]" - - Call: - function: - Access: - Static: - inner: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - arguments: - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x(y)::y(x)" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x(y)::y(x)" - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x(y)::y(x)" - Access: Array: array: diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out index eb541b94a7..51bf44b889 100644 --- a/tests/expectations/parser/parser/expression/access/call.leo.out +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -63,107 +63,3 @@ outputs: col_stop: 11 path: "" content: "x(x, y, z)" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x::y()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y(x)" - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x::y(x)" - - Call: - function: - Access: - Tuple: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0(x) - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: x.0(x) - - Call: - function: - Access: - Array: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" - index: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0](x)" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0](x)" - arguments: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0](x)" diff --git a/tests/expectations/parser/parser/expression/access/circuit.leo.out b/tests/expectations/parser/parser/expression/access/circuit.leo.out index 19b5bb9c4a..0314c4ef11 100644 --- a/tests/expectations/parser/parser/expression/access/circuit.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit.leo.out @@ -101,37 +101,3 @@ outputs: col_stop: 6 path: "" content: x.y.0 - - Access: - Array: - array: - Access: - Member: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.y[1]" - type_: ~ - index: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.y[1]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x.y[1]" diff --git a/tests/expectations/parser/parser/expression/array_init_fail.leo.out b/tests/expectations/parser/parser/expression/array_init_fail.leo.out index 17ad75389c..80ea97fbc2 100644 --- a/tests/expectations/parser/parser/expression/array_init_fail.leo.out +++ b/tests/expectations/parser/parser/expression/array_init_fail.leo.out @@ -2,7 +2,7 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^^^^^^^" - - "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0; 1]\n | ^^^^^" - - "Error [EPAR0370022]: Array dimensions specified as a tuple cannot be empty.\n --> test:1:5\n |\n 1 | [0; ()]\n | ^^" - - "Error [EPAR0370039]: do not put parens around single dimension array size\n --> test:1:5\n |\n 1 | [0; (1)]\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [...0; 1]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [0; ()]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [0; (1)]\n | ^" diff --git a/tests/expectations/parser/parser/expression/array_inline_fail.leo.out b/tests/expectations/parser/parser/expression/array_inline_fail.leo.out index dd15703185..ddff3711a8 100644 --- a/tests/expectations/parser/parser/expression/array_inline_fail.leo.out +++ b/tests/expectations/parser/parser/expression/array_inline_fail.leo.out @@ -2,8 +2,8 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,,]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:4\n |\n 1 | [0,,]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,0]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | [,0,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [0,,]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,0]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [,0,]\n | ^" diff --git a/tests/expectations/parser/parser/expression/binary/exp.leo.out b/tests/expectations/parser/parser/expression/binary/exp.leo.out index 9ec292c313..7a6342565c 100644 --- a/tests/expectations/parser/parser/expression/binary/exp.leo.out +++ b/tests/expectations/parser/parser/expression/binary/exp.leo.out @@ -116,141 +116,3 @@ outputs: col_stop: 12 path: "" content: 1 ** 2 ** 3 - - Binary: - left: - Cast: - inner: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: 1 as i8 ** 3 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: 1 as i8 ** 3 as i8 - right: - Cast: - inner: - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: 1 as i8 ** 3 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 19 - path: "" - content: 1 as i8 ** 3 as i8 - op: Pow - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: 1 as i8 ** 3 as i8 - - Binary: - left: - Cast: - inner: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - right: - Binary: - left: - Cast: - inner: - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 19 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - right: - Cast: - inner: - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 24 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - target_type: - IntegerType: I8 - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 30 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - op: Pow - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 30 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 - op: Pow - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 30 - path: "" - content: 1 as i8 ** 3 as i8 ** 5 as i8 diff --git a/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out b/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out index 9a08737239..4d5ba89431 100644 --- a/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out +++ b/tests/expectations/parser/parser/expression/circuit_init_fail.leo.out @@ -2,15 +2,15 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:3\n |\n 1 | x {\n | ^" + - "did not consume all input: '{' @ 1:3-4\n" - "did not consume all input: '}' @ 1:3-4\n" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:5\n |\n 1 | x { , }\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:6\n |\n 1 | x {x,,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,x}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,x}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:8\n |\n 1 | x {x:y,,}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,x:y}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,x:y}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:6\n |\n 1 | x {x:}\n | ^" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n'}' @ 1:5-6\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:5-6\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n',' @ 1:5-6\n',' @ 1:6-7\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n'x' @ 1:4-5\n',' @ 1:5-6\n',' @ 1:6-7\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n',' @ 1:5-6\n'x' @ 1:6-7\n'}' @ 1:7-8\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n'x' @ 1:5-6\n'}' @ 1:6-7\n" + - "did not consume all input: '{' @ 1:3-4\n'x' @ 1:4-5\n':' @ 1:5-6\n'y' @ 1:6-7\n',' @ 1:7-8\n',' @ 1:8-9\n'}' @ 1:9-10\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n',' @ 1:5-6\n'x' @ 1:6-7\n':' @ 1:7-8\n'y' @ 1:8-9\n'}' @ 1:9-10\n" + - "did not consume all input: '{' @ 1:3-4\n',' @ 1:4-5\n'x' @ 1:5-6\n':' @ 1:6-7\n'y' @ 1:7-8\n'}' @ 1:8-9\n" + - "did not consume all input: '{' @ 1:3-4\n'x' @ 1:4-5\n':' @ 1:5-6\n'}' @ 1:6-7\n" diff --git a/tests/expectations/parser/parser/expression/literal/access.leo.out b/tests/expectations/parser/parser/expression/literal/access.leo.out index e2dbf60e24..7dcf1796a5 100644 --- a/tests/expectations/parser/parser/expression/literal/access.leo.out +++ b/tests/expectations/parser/parser/expression/literal/access.leo.out @@ -44,29 +44,6 @@ outputs: col_stop: 71 path: "" content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"address\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"address::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"address::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "address::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "address::call()" - Value: Implicit: - "" @@ -109,29 +86,6 @@ outputs: col_stop: 12 path: "" content: true.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"bool\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"bool::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"bool::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "bool::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "bool::call()" - Value: Implicit: - "" @@ -175,29 +129,6 @@ outputs: col_stop: 11 path: "" content: "'a'.call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"char\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"char::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"char::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "char::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "char::call()" - Value: Implicit: - "" @@ -240,29 +171,6 @@ outputs: col_stop: 14 path: "" content: 1field.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"field\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"field::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"field::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "field::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "field::call()" - Value: Implicit: - "" @@ -358,29 +266,6 @@ outputs: col_stop: 19 path: "" content: "(0, 1)group.call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"group\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"group::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"group::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "group::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "group::call()" - Value: Implicit: - "" @@ -556,121 +441,6 @@ outputs: col_stop: 13 path: "" content: 1i128.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i8\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i8::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i8::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "i8::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "i8::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i16\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i16::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i16::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "i16::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "i16::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i32::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i32::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "i32::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "i32::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i64\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i64::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i64::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "i64::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "i64::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"i128\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i128::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i128::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "i128::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "i128::call()" - Value: Implicit: - "" @@ -846,118 +616,3 @@ outputs: col_stop: 13 path: "" content: 1u128.call() - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u8\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u8::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u8::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "u8::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "u8::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u16\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u16::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u16::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "u16::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "u16::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u32::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u32::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "u32::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "u32::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u64\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u64::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u64::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "u64::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "u64::call()" - - Call: - function: - Access: - Static: - inner: - Identifier: "{\"name\":\"u128\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u128::call()\\\"}\"}" - name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u128::call()\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "u128::call()" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "u128::call()" diff --git a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out index 4c79c63c00..f429609540 100644 --- a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out @@ -8,6 +8,7 @@ outputs: - "Error [EPAR0370030]: Could not lex the following content: `\\n`." - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370023]: Expected more characters to lex but found none." + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370031]: Expected a valid hex character but found `'`." - "Error [EPAR0370031]: Expected a valid hex character but found `'`." - "Error [EPAR0370031]: Expected a valid hex character but found `9A`." @@ -44,5 +45,6 @@ outputs: - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`." - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`." - "Error [EPAR0370034]: The escaped unicode char `110000` is greater than 0x10FFFF." + - "Error [EPAR0370033]: The escaped unicode char `1234567890` is not within valid length of [1, 6]." - "Error [EPAR0370026]: Expected a closed char but found `򻮻`." - "Error [EPAR0370026]: Expected a closed char but found `😭`." diff --git a/tests/expectations/parser/parser/expression/literal/comment.leo.out b/tests/expectations/parser/parser/expression/literal/comment.leo.out index 0b21f6a280..bc50235bda 100644 --- a/tests/expectations/parser/parser/expression/literal/comment.leo.out +++ b/tests/expectations/parser/parser/expression/literal/comment.leo.out @@ -4,9 +4,4 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/expression/literal/group_fail.leo.out b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out index 4114e3fa46..929acf4609 100644 --- a/tests/expectations/parser/parser/expression/literal/group_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out @@ -2,15 +2,15 @@ namespace: ParseExpression expectation: Fail outputs: - - "did not consume all input: 'group' @ 1:3-8\n" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | ()group\n | ^^" - "did not consume all input: 'group' @ 1:6-11\n" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | (,)group\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+'\n --> test:1:2\n |\n 1 | (+, -,)group\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | (,+, -)group\n | ^" - - "did not consume all input: 'group' @ 1:6-11\n" - - "did not consume all input: 'group' @ 1:12-17\n" - - "did not consume all input: 'group' @ 1:15-20\n" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (x,y)group\n | ^^^^^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123,456u8)group\n | ^^^^^^^^^^^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123,456field)group\n | ^^^^^^^^^^^^^^" - "Error [EPAR0370004]: Unexpected white space between terms (123,456) and group\n --> test:1:10\n |\n 1 | (123, 456) group\n | ^" - "did not consume all input: 'group' @ 1:8-13\n" - - "did not consume all input: 'group' @ 1:16-21\n" - - "did not consume all input: 'bool' @ 1:11-15\n" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123, 456, 789)group\n | ^^^^^^^^^^^^^^^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (123, 456)bool\n | ^^^^^^^^^^" diff --git a/tests/expectations/parser/parser/expression/literal/static_fail.leo.out b/tests/expectations/parser/parser/expression/literal/static_fail.leo.out new file mode 100644 index 0000000000..424ff34fa8 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/static_fail.leo.out @@ -0,0 +1,19 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'address'\n --> test:1:1\n |\n 1 | address::call()\n | ^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'bool'\n --> test:1:1\n |\n 1 | bool::call()\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'char'\n --> test:1:1\n |\n 1 | char::call()\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'field'\n --> test:1:1\n |\n 1 | field::call()\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'group'\n --> test:1:1\n |\n 1 | group::call()\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i8'\n --> test:1:1\n |\n 1 | i8::call()\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i16'\n --> test:1:1\n |\n 1 | i16::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i32'\n --> test:1:1\n |\n 1 | i32::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i64'\n --> test:1:1\n |\n 1 | i64::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i128'\n --> test:1:1\n |\n 1 | i128::call()\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u8'\n --> test:1:1\n |\n 1 | u8::call()\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u16'\n --> test:1:1\n |\n 1 | u16::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u32'\n --> test:1:1\n |\n 1 | u32::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u64'\n --> test:1:1\n |\n 1 | u64::call()\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u128'\n --> test:1:1\n |\n 1 | u128::call()\n | ^^^^" diff --git a/tests/expectations/parser/parser/expression/literal/string_fail.leo.out b/tests/expectations/parser/parser/expression/literal/string_fail.leo.out index bac30c2c73..331ee1f2d9 100644 --- a/tests/expectations/parser/parser/expression/literal/string_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/string_fail.leo.out @@ -2,8 +2,8 @@ namespace: Token expectation: Fail outputs: - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('H'), Scalar('e'), Scalar('l'), Scalar('l'), Scalar('o'), Scalar(' '), Scalar('w'), Scalar('o'), Scalar('r'), Scalar('l'), Scalar('d'), Scalar('!')]`." - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('\"')]`." + - "Error [EPAR0370025]: Expected a closed string but found `Hello world!`." + - "Error [EPAR0370025]: Expected a closed string but found `\"`." - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370024]: Expected a valid escape character but found `l`." - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `a`." @@ -13,5 +13,5 @@ outputs: - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `}`." - "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `6`." - "Error [EPAR0370032]: There was no closing `}` after a escaped unicode `af🦀\"`." - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('\"')]`." - - "Error [EPAR0370025]: Expected a closed string but found `[Scalar('⭇'), Scalar('😍'), Scalar(';')]`." + - "Error [EPAR0370025]: Expected a closed string but found `\"`." + - "Error [EPAR0370025]: Expected a closed string but found `⭇😍;`." diff --git a/tests/expectations/parser/parser/expression/token_format.leo.out b/tests/expectations/parser/parser/expression/token_format.leo.out new file mode 100644 index 0000000000..c329e3e9ef --- /dev/null +++ b/tests/expectations/parser/parser/expression/token_format.leo.out @@ -0,0 +1,76 @@ +--- +namespace: ParseExpression +expectation: Fail +outputs: + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `@test`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '&&'\n --> test:1:1\n |\n 1 | &&\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '||'\n --> test:1:1\n |\n 1 | ||\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '=='\n --> test:1:1\n |\n 1 | ==\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '!='\n --> test:1:1\n |\n 1 | !=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '<'\n --> test:1:1\n |\n 1 | <\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '<='\n --> test:1:1\n |\n 1 | <=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '>'\n --> test:1:1\n |\n 1 | >\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '>='\n --> test:1:1\n |\n 1 | >=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+'\n --> test:1:1\n |\n 1 | +\n | ^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | -\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '*'\n --> test:1:1\n |\n 1 | *\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**'\n --> test:1:1\n |\n 1 | **\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '/'\n --> test:1:1\n |\n 1 | /\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:1\n |\n 1 | =\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '+='\n --> test:1:1\n |\n 1 | +=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '-='\n --> test:1:1\n |\n 1 | -=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '*='\n --> test:1:1\n |\n 1 | *=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '/='\n --> test:1:1\n |\n 1 | /=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '**='\n --> test:1:1\n |\n 1 | **=\n | ^^^" + - "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | (\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | )\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:1\n |\n 1 | ]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '{'\n --> test:1:1\n |\n 1 | {\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:1\n |\n 1 | }\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:1\n |\n 1 | ,\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '.'\n --> test:1:1\n |\n 1 | .\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | ..\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | ...\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :\n | ^" + - "did not consume all input: ':' @ 1:2-3\n':' @ 1:3-4\n" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ?\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '->'\n --> test:1:1\n |\n 1 | ->\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _\n | ^" + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370030]: Could not lex the following content: `~`." + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'console'\n --> test:1:1\n |\n 1 | console\n | ^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'const'\n --> test:1:1\n |\n 1 | const\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'else'\n --> test:1:1\n |\n 1 | else\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'for'\n --> test:1:1\n |\n 1 | for\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'function'\n --> test:1:1\n |\n 1 | function\n | ^^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'in'\n --> test:1:1\n |\n 1 | in\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'let'\n --> test:1:1\n |\n 1 | let\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'mut'\n --> test:1:1\n |\n 1 | mut\n | ^^^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'return'\n --> test:1:1\n |\n 1 | return\n | ^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'type'\n --> test:1:1\n |\n 1 | type\n | ^^^^" diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index 03766862d2..c411c19563 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -13,52 +13,6 @@ outputs: col_stop: 3 path: "" content: "-x" - - Unary: - inner: - Access: - Member: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 5 - path: "" - content: "-x.y" - type_: ~ - op: Negate - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "-x.y" - - Unary: - inner: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 6 - path: "" - content: "-x::y" - op: Negate - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "-x::y" - Unary: inner: Call: @@ -122,24 +76,44 @@ outputs: col_stop: 4 path: "" content: "-!x" - - Value: - Implicit: - - "-5" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 3 - path: "" - content: "-5" - - Value: - Integer: - - I8 - - "-5" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "-5i8" + - Unary: + inner: + Value: + Implicit: + - "5" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "-5" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 3 + path: "" + content: "-5" + - Unary: + inner: + Value: + Integer: + - I8 + - "5" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: "" + content: "-5i8" + op: Negate + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "-5i8" diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out index 71716da156..221c8c8c35 100644 --- a/tests/expectations/parser/parser/expression/unary/not.leo.out +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -13,52 +13,6 @@ outputs: col_stop: 3 path: "" content: "!x" - - Unary: - inner: - Access: - Member: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 5 - path: "" - content: "!x.y" - type_: ~ - op: Not - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "!x.y" - - Unary: - inner: - Access: - Static: - inner: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 6 - path: "" - content: "!x::y" - op: Not - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "!x::y" - Unary: inner: Call: diff --git a/tests/expectations/parser/parser/functions/annotated.leo.out b/tests/expectations/parser/parser/functions/annotated.leo.out index d9e264e6cf..7680179979 100644 --- a/tests/expectations/parser/parser/functions/annotated.leo.out +++ b/tests/expectations/parser/parser/functions/annotated.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function a() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out b/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out index cffae59c8f..090eba8942 100644 --- a/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_arg_not_ident.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:6\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:14\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '123'\n --> test:8:6\n |\n 8 | @bar(123) // ints not vali\n | ^^^\nError [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:14:2\n |\n 14 | @context // recovery witness\n | ^^^^^^^" + - "Error [EPAR0370030]: Could not lex the following content: `@foo(?, bar, ?)\nfunction x() {\n return ();\n}\n\n@bar(123) // ints not vali\nfunction x() {\n return ();\n}\n\n\n@context // recovery witness\nfunction x() {\n return ();\n}\n`." diff --git a/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out b/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out index 6366839d98..96ece07b38 100644 --- a/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:3:2\n |\n 3 | @context\n | ^^^^^^^\nError [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:8:2\n |\n 8 | @context // recovery witness\n | ^^^^^^^" + - "Error [EPAR0370030]: Could not lex the following content: `@context\nfunction f() {\n return ();\n}\n\n@context // recovery witness\nfunction g() {\n return ();\n}\n`." diff --git a/tests/expectations/parser/parser/functions/annotated_param.leo.out b/tests/expectations/parser/parser/functions/annotated_param.leo.out index 5e5e8b0796..f5201f6956 100644 --- a/tests/expectations/parser/parser/functions/annotated_param.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_param.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/annotated_twice.leo.out b/tests/expectations/parser/parser/functions/annotated_twice.leo.out index 7afe638d67..2ab2a1eff1 100644 --- a/tests/expectations/parser/parser/functions/annotated_twice.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_twice.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out index 53e1ab419b..c5daae1256 100644 --- a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" input: - Variable: @@ -131,7 +125,6 @@ outputs: path: "" content: "function x(const y: u32) {\n ...\n ...\n ...\n}" "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/const_function.leo.out b/tests/expectations/parser/parser/functions/const_function.leo.out index 142f12dfb9..b860726f28 100644 --- a/tests/expectations/parser/parser/functions/const_function.leo.out +++ b/tests/expectations/parser/parser/functions/const_function.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}" input: [] const_: true @@ -21,22 +15,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/functions/const_function_fail.leo.out b/tests/expectations/parser/parser/functions/const_function_fail.leo.out index 72572b4700..c6df75c98d 100644 --- a/tests/expectations/parser/parser/functions/const_function_fail.leo.out +++ b/tests/expectations/parser/parser/functions/const_function_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370003]: unexpected EOF\n --> test:3:1\n |\n 3 | const\n | ^^^^^" + - "Error [EPAR0370005]: expected 'function', 'test' -- got 'const'\n --> test:3:1\n |\n 3 | const\n | ^^^^^" diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index f1302d128d..1abefd7344 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" input: - Variable: @@ -47,22 +41,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 @@ -78,7 +73,6 @@ outputs: path: "" content: "function x(x: u32, const y: i32) {\n ...\n}" "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" input: - Variable: @@ -114,22 +108,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 8 - line_stop: 8 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 8 + line_stop: 8 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 8 line_stop: 8 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 7 line_stop: 9 diff --git a/tests/expectations/parser/parser/functions/const_self_bad.leo.out b/tests/expectations/parser/parser/functions/const_self_bad.leo.out index 3b02d74ff3..bbf0acc44a 100644 --- a/tests/expectations/parser/parser/functions/const_self_bad.leo.out +++ b/tests/expectations/parser/parser/functions/const_self_bad.leo.out @@ -7,7 +7,6 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}": diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index 4bd3bfbc1a..090289cdca 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index 60c3f10b1c..3de9314352 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/functions/ident_token_fail.leo.out b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out new file mode 100644 index 0000000000..c9f3bc759d --- /dev/null +++ b/tests/expectations/parser/parser/functions/ident_token_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370005]: expected 'function', 'test' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^" diff --git a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out index 93a823f907..196af95639 100644 --- a/tests/expectations/parser/parser/functions/infinite_recursion.leo.out +++ b/tests/expectations/parser/parser/functions/infinite_recursion.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}" input: [] const_: false @@ -54,7 +48,6 @@ outputs: path: "" content: "function inf() {\n ...\n}" "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/mut_input.leo.out b/tests/expectations/parser/parser/functions/mut_input.leo.out new file mode 100644 index 0000000000..96efaffce6 --- /dev/null +++ b/tests/expectations/parser/parser/functions/mut_input.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370013]: function func(mut a: u32) { ... } is deprecated. Passed variables are mutable by default.\n --> test:3:12\n |\n 3 | function f(mut a: u8) {}\n | ^^^^^" diff --git a/tests/expectations/parser/parser/functions/mut_input_fail.leo.out b/tests/expectations/parser/parser/functions/mut_input_fail.leo.out new file mode 100644 index 0000000000..96efaffce6 --- /dev/null +++ b/tests/expectations/parser/parser/functions/mut_input_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370013]: function func(mut a: u32) { ... } is deprecated. Passed variables are mutable by default.\n --> test:3:12\n |\n 3 | function f(mut a: u8) {}\n | ^^^^^" diff --git a/tests/expectations/parser/parser/functions/param_array.leo.out b/tests/expectations/parser/parser/functions/param_array.leo.out index b648d79414..e0b27ae7a2 100644 --- a/tests/expectations/parser/parser/functions/param_array.leo.out +++ b/tests/expectations/parser/parser/functions/param_array.leo.out @@ -7,11 +7,9 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/param_circuit.leo.out b/tests/expectations/parser/parser/functions/param_circuit.leo.out index 2d18f67ce0..d05ebf1548 100644 --- a/tests/expectations/parser/parser/functions/param_circuit.leo.out +++ b/tests/expectations/parser/parser/functions/param_circuit.leo.out @@ -7,11 +7,9 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index 17e104a53a..d9952c25e2 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}" input: - Variable: diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 26c4fe8b37..555c27d59b 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" input: - Variable: @@ -47,22 +41,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 681070bf9c..6be865eaa0 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" input: - Variable: @@ -48,22 +42,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index abaabd9585..c3e05b9ae2 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}" input: [] const_: false @@ -22,22 +16,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" + Value: + Implicit: + - "0" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 13 + path: "" + content: " return 0;" span: line_start: 4 line_stop: 4 col_start: 5 - col_stop: 14 + col_stop: 13 path: "" - content: " return ();" + content: " return 0;" span: line_start: 3 line_stop: 5 diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index 0fa5721ff3..37cef6e6e3 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/functions/test_keyword_fail.leo.out b/tests/expectations/parser/parser/functions/test_keyword_fail.leo.out new file mode 100644 index 0000000000..22e16133ed --- /dev/null +++ b/tests/expectations/parser/parser/functions/test_keyword_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370015]: \"test function...\" is deprecated. Did you mean @test annotation?\n --> test:3:1\n |\n 3 | test main() {}\n | ^^^^" diff --git a/tests/expectations/parser/parser/inputs/input_fail.leo.out b/tests/expectations/parser/parser/inputs/input_fail.leo.out new file mode 100644 index 0000000000..5f8bf95de3 --- /dev/null +++ b/tests/expectations/parser/parser/inputs/input_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Input +expectation: Fail +outputs: + - "Error [EPAR0370000]: main\n --> test:3:1\n |\n 3 | main\n | ^^^^" diff --git a/tests/expectations/parser/parser/inputs/input_success.leo.out b/tests/expectations/parser/parser/inputs/input_success.leo.out index 6fde85fcfe..e8089469d1 100644 --- a/tests/expectations/parser/parser/inputs/input_success.leo.out +++ b/tests/expectations/parser/parser/inputs/input_success.leo.out @@ -126,129 +126,6 @@ outputs: col_stop: 11 path: "" content: "e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Array: - - IntegerType: U8 - - - value: "32" - name: "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"f: [u8; 32] = [0; 32]; \\\"}\"}" - value: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 9 - line_stop: 9 - col_start: 16 - col_stop: 17 - path: "" - content: "f: [u8; 32] = [0; 32]; " - dimensions: - - value: "32" - span: - line_start: 9 - line_stop: 9 - col_start: 15 - col_stop: 22 - path: "" - content: "f: [u8; 32] = [0; 32]; " - span: - line_start: 9 - line_stop: 9 - col_start: 4 - col_stop: 12 - path: "" - content: "f: [u8; 32] = [0; 32]; " - - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "3" - name: "{\"name\":\"g\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"g: [[u8; 2]; 3] = [[0; 2]; 3]; \\\"}\"}" - value: - ArrayInit: - element: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 10 - line_stop: 10 - col_start: 21 - col_stop: 22 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "2" - span: - line_start: 10 - line_stop: 10 - col_start: 20 - col_stop: 26 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "3" - span: - line_start: 10 - line_stop: 10 - col_start: 19 - col_stop: 30 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - span: - line_start: 10 - line_stop: 10 - col_start: 4 - col_stop: 16 - path: "" - content: "g: [[u8; 2]; 3] = [[0; 2]; 3]; " - - type_: - Tuple: - - Boolean - - Boolean - name: "{\"name\":\"h\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"h: (bool, bool) = (true, false); \\\"}\"}" - value: - TupleInit: - elements: - - Value: - Boolean: - - "true" - - span: - line_start: 11 - line_stop: 11 - col_start: 20 - col_stop: 24 - path: "" - content: "h: (bool, bool) = (true, false); " - - Value: - Boolean: - - "false" - - span: - line_start: 11 - line_stop: 11 - col_start: 26 - col_stop: 31 - path: "" - content: "h: (bool, bool) = (true, false); " - span: - line_start: 11 - line_stop: 11 - col_start: 19 - col_stop: 32 - path: "" - content: "h: (bool, bool) = (true, false); " - span: - line_start: 11 - line_stop: 11 - col_start: 4 - col_stop: 16 - path: "" - content: "h: (bool, bool) = (true, false); " span: line_start: 3 line_stop: 3 @@ -259,68 +136,68 @@ outputs: - name: registers definitions: - type_: Boolean - name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" + name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" value: Value: Boolean: - "true" - span: - line_start: 14 - line_stop: 14 + line_start: 11 + line_stop: 11 col_start: 13 col_stop: 17 path: "" content: "r0: bool = true; " span: - line_start: 14 - line_stop: 14 + line_start: 11 + line_stop: 11 col_start: 5 col_stop: 9 path: "" content: "r0: bool = true; " - type_: IntegerType: U8 - name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}" + name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}" value: Value: Implicit: - "2" - span: - line_start: 15 - line_stop: 15 + line_start: 12 + line_stop: 12 col_start: 13 col_stop: 14 path: "" content: "r1: u8 = 2; " span: - line_start: 15 - line_stop: 15 + line_start: 12 + line_stop: 12 col_start: 5 col_stop: 7 path: "" content: "r1: u8 = 2; " - type_: Field - name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" + name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" value: Value: Implicit: - "0" - span: - line_start: 16 - line_stop: 16 + line_start: 13 + line_stop: 13 col_start: 13 col_stop: 14 path: "" content: "r2: field = 0; " span: - line_start: 16 - line_stop: 16 + line_start: 13 + line_stop: 13 col_start: 5 col_stop: 10 path: "" content: "r2: field = 0; " - type_: Group - name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" + name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" value: Value: Group: @@ -329,8 +206,8 @@ outputs: Number: - "0" - span: - line_start: 17 - line_stop: 17 + line_start: 14 + line_stop: 14 col_start: 14 col_stop: 15 path: "" @@ -339,172 +216,49 @@ outputs: Number: - "1" - span: - line_start: 17 - line_stop: 17 + line_start: 14 + line_stop: 14 col_start: 17 col_stop: 18 path: "" content: "r3: group = (0, 1)group; " span: - line_start: 17 - line_stop: 17 + line_start: 14 + line_stop: 14 col_start: 14 col_stop: 24 path: "" content: "r3: group = (0, 1)group; " span: - line_start: 17 - line_stop: 17 + line_start: 14 + line_stop: 14 col_start: 5 col_stop: 10 path: "" content: "r3: group = (0, 1)group; " - type_: Address - name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" + name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" value: Value: Address: - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 - span: - line_start: 18 - line_stop: 18 + line_start: 15 + line_stop: 15 col_start: 15 col_stop: 78 path: "" content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" span: - line_start: 18 - line_stop: 18 + line_start: 15 + line_stop: 15 col_start: 5 col_stop: 12 path: "" content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Array: - - IntegerType: U8 - - - value: "32" - name: "{\"name\":\"r5\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r5: [u8; 32] = [0; 32]; \\\"}\"}" - value: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 19 - line_stop: 19 - col_start: 17 - col_stop: 18 - path: "" - content: "r5: [u8; 32] = [0; 32]; " - dimensions: - - value: "32" - span: - line_start: 19 - line_stop: 19 - col_start: 16 - col_stop: 23 - path: "" - content: "r5: [u8; 32] = [0; 32]; " - span: - line_start: 19 - line_stop: 19 - col_start: 5 - col_stop: 13 - path: "" - content: "r5: [u8; 32] = [0; 32]; " - - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "3" - name: "{\"name\":\"r6\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r6: [[u8; 2]; 3] = [[0; 2]; 3]; \\\"}\"}" - value: - ArrayInit: - element: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 20 - line_stop: 20 - col_start: 22 - col_stop: 23 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "2" - span: - line_start: 20 - line_stop: 20 - col_start: 21 - col_stop: 27 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "3" - span: - line_start: 20 - line_stop: 20 - col_start: 20 - col_stop: 31 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - span: - line_start: 20 - line_stop: 20 - col_start: 5 - col_stop: 17 - path: "" - content: "r6: [[u8; 2]; 3] = [[0; 2]; 3]; " - - type_: - Tuple: - - Boolean - - Boolean - name: "{\"name\":\"r7\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r7: (bool, bool) = (true, false); \\\"}\"}" - value: - TupleInit: - elements: - - Value: - Boolean: - - "true" - - span: - line_start: 21 - line_stop: 21 - col_start: 21 - col_stop: 25 - path: "" - content: "r7: (bool, bool) = (true, false); " - - Value: - Boolean: - - "false" - - span: - line_start: 21 - line_stop: 21 - col_start: 27 - col_stop: 32 - path: "" - content: "r7: (bool, bool) = (true, false); " - span: - line_start: 21 - line_stop: 21 - col_start: 20 - col_stop: 33 - path: "" - content: "r7: (bool, bool) = (true, false); " - span: - line_start: 21 - line_stop: 21 - col_start: 5 - col_stop: 17 - path: "" - content: "r7: (bool, bool) = (true, false); " span: - line_start: 13 - line_stop: 13 + line_start: 10 + line_stop: 10 col_start: 2 col_stop: 11 path: "" @@ -512,68 +266,68 @@ outputs: - name: constants definitions: - type_: Boolean - name: "{\"name\":\"c0\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c0: bool = true; \\\"}\"}" + name: "{\"name\":\"c0\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c0: bool = true; \\\"}\"}" value: Value: Boolean: - "true" - span: - line_start: 24 - line_stop: 24 + line_start: 18 + line_stop: 18 col_start: 13 col_stop: 17 path: "" content: "c0: bool = true; " span: - line_start: 24 - line_stop: 24 + line_start: 18 + line_stop: 18 col_start: 5 col_stop: 9 path: "" content: "c0: bool = true; " - type_: IntegerType: U8 - name: "{\"name\":\"c1\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c1: u8 = 2; \\\"}\"}" + name: "{\"name\":\"c1\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c1: u8 = 2; \\\"}\"}" value: Value: Implicit: - "2" - span: - line_start: 25 - line_stop: 25 + line_start: 19 + line_stop: 19 col_start: 13 col_stop: 14 path: "" content: "c1: u8 = 2; " span: - line_start: 25 - line_stop: 25 + line_start: 19 + line_stop: 19 col_start: 5 col_stop: 7 path: "" content: "c1: u8 = 2; " - type_: Field - name: "{\"name\":\"c2\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c2: field = 0; \\\"}\"}" + name: "{\"name\":\"c2\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c2: field = 0; \\\"}\"}" value: Value: Implicit: - "0" - span: - line_start: 26 - line_stop: 26 + line_start: 20 + line_stop: 20 col_start: 13 col_stop: 14 path: "" content: "c2: field = 0; " span: - line_start: 26 - line_stop: 26 + line_start: 20 + line_stop: 20 col_start: 5 col_stop: 10 path: "" content: "c2: field = 0; " - type_: Group - name: "{\"name\":\"c3\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c3: group = (0, 1)group; \\\"}\"}" + name: "{\"name\":\"c3\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c3: group = (0, 1)group; \\\"}\"}" value: Value: Group: @@ -582,8 +336,8 @@ outputs: Number: - "0" - span: - line_start: 27 - line_stop: 27 + line_start: 21 + line_stop: 21 col_start: 14 col_stop: 15 path: "" @@ -592,172 +346,49 @@ outputs: Number: - "1" - span: - line_start: 27 - line_stop: 27 + line_start: 21 + line_stop: 21 col_start: 17 col_stop: 18 path: "" content: "c3: group = (0, 1)group; " span: - line_start: 27 - line_stop: 27 + line_start: 21 + line_stop: 21 col_start: 14 col_stop: 24 path: "" content: "c3: group = (0, 1)group; " span: - line_start: 27 - line_stop: 27 + line_start: 21 + line_stop: 21 col_start: 5 col_stop: 10 path: "" content: "c3: group = (0, 1)group; " - type_: Address - name: "{\"name\":\"c4\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" + name: "{\"name\":\"c4\",\"span\":\"{\\\"line_start\\\":22,\\\"line_stop\\\":22,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" value: Value: Address: - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 - span: - line_start: 28 - line_stop: 28 + line_start: 22 + line_stop: 22 col_start: 15 col_stop: 78 path: "" content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" span: - line_start: 28 - line_stop: 28 + line_start: 22 + line_stop: 22 col_start: 5 col_stop: 12 path: "" content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" - - type_: - Array: - - IntegerType: U8 - - - value: "32" - name: "{\"name\":\"c5\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c5: [u8; 32] = [0; 32]; \\\"}\"}" - value: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 29 - line_stop: 29 - col_start: 17 - col_stop: 18 - path: "" - content: "c5: [u8; 32] = [0; 32]; " - dimensions: - - value: "32" - span: - line_start: 29 - line_stop: 29 - col_start: 16 - col_stop: 23 - path: "" - content: "c5: [u8; 32] = [0; 32]; " - span: - line_start: 29 - line_stop: 29 - col_start: 5 - col_stop: 13 - path: "" - content: "c5: [u8; 32] = [0; 32]; " - - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "3" - name: "{\"name\":\"c6\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c6: [[u8; 2]; 3] = [[0; 2]; 3]; \\\"}\"}" - value: - ArrayInit: - element: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 30 - line_stop: 30 - col_start: 22 - col_stop: 23 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "2" - span: - line_start: 30 - line_stop: 30 - col_start: 21 - col_stop: 27 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - dimensions: - - value: "3" - span: - line_start: 30 - line_stop: 30 - col_start: 20 - col_stop: 31 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - span: - line_start: 30 - line_stop: 30 - col_start: 5 - col_stop: 17 - path: "" - content: "c6: [[u8; 2]; 3] = [[0; 2]; 3]; " - - type_: - Tuple: - - Boolean - - Boolean - name: "{\"name\":\"c7\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c7: (bool, bool) = (true, false); \\\"}\"}" - value: - TupleInit: - elements: - - Value: - Boolean: - - "true" - - span: - line_start: 31 - line_stop: 31 - col_start: 21 - col_stop: 25 - path: "" - content: "c7: (bool, bool) = (true, false); " - - Value: - Boolean: - - "false" - - span: - line_start: 31 - line_stop: 31 - col_start: 27 - col_stop: 32 - path: "" - content: "c7: (bool, bool) = (true, false); " - span: - line_start: 31 - line_stop: 31 - col_start: 20 - col_stop: 33 - path: "" - content: "c7: (bool, bool) = (true, false); " - span: - line_start: 31 - line_stop: 31 - col_start: 5 - col_stop: 17 - path: "" - content: "c7: (bool, bool) = (true, false); " span: - line_start: 23 - line_stop: 23 + line_start: 17 + line_stop: 17 col_start: 2 col_stop: 11 path: "" diff --git a/tests/expectations/parser/parser/program/q_eof.leo.out b/tests/expectations/parser/parser/program/q_eof.leo.out index d7f4823873..185a49721f 100644 --- a/tests/expectations/parser/parser/program/q_eof.leo.out +++ b/tests/expectations/parser/parser/program/q_eof.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370025]: Expected a closed string but found `[]`." + - "Error [EPAR0370025]: Expected a closed string but found ``." diff --git a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out index e417be3b50..7812751117 100644 --- a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out +++ b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out @@ -4,14 +4,8 @@ expectation: Pass outputs: - name: "" expected_input: [] - import_statements: [] - imports: {} - aliases: {} - circuits: {} - global_consts: {} functions: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}" input: [] const_: false diff --git a/tests/expectations/parser/parser/serialize/palindrome.leo.out b/tests/expectations/parser/parser/serialize/palindrome.leo.out index 6ecc69d502..2d21cc251e 100644 --- a/tests/expectations/parser/parser/serialize/palindrome.leo.out +++ b/tests/expectations/parser/parser/serialize/palindrome.leo.out @@ -7,11 +7,9 @@ outputs: import_statements: [] imports: {} aliases: {} - circuits: {} global_consts: {} functions: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}" input: - Variable: @@ -35,7 +33,6 @@ outputs: arguments: - Identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return is_palindrome(str);\\\"}\"}" "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function is_palindrome(str: [char; 20]) -> bool {\\\"}\"}": - annotations: {} identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function is_palindrome(str: [char; 20]) -> bool {\\\"}\"}" input: - Variable: @@ -366,12 +363,8 @@ outputs: - Return: expression: Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":50,\\\"line_stop\\\":50,\\\"col_start\\\":12,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return result;\\\"}\"}" - "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}": - annotations: - test: - arguments: [] - name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":53,\\\"line_stop\\\":53,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test\\\"}\"}" - identifier: "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}" + "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":53,\\\"line_stop\\\":53,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}": + identifier: "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":53,\\\"line_stop\\\":53,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}" input: [] const_: false output: ~ @@ -383,7 +376,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"a b a \\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"a b a \\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -412,7 +405,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":56,\\\"line_stop\\\":56,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"😀😀😀😀😀 😀😀😀😀😀\\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"😀😀😀😀😀 😀😀😀😀😀\\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -441,7 +434,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"borrow or rob \\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":56,\\\"line_stop\\\":56,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"borrow or rob \\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -470,7 +463,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"bbbb aaaa aaaa bbbb\\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"bbbb aaaa aaaa bbbb\\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -499,7 +492,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"aaaaaaaaaaaaaaaaaaaa\\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"aaaaaaaaaaaaaaaaaaaa\\\\\\\"));\\\"}\"}" arguments: - Value: String: @@ -528,7 +521,7 @@ outputs: Assert: Call: function: - Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"taco cat \\\\\\\"));\\\"}\"}" + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"taco cat \\\\\\\"));\\\"}\"}" arguments: - Value: String: diff --git a/tests/expectations/parser/parser/serialize/parser_error.leo.out b/tests/expectations/parser/parser/serialize/parser_error.leo.out index 716c636e1b..62f5bf28f9 100644 --- a/tests/expectations/parser/parser/serialize/parser_error.leo.out +++ b/tests/expectations/parser/parser/serialize/parser_error.leo.out @@ -2,4 +2,4 @@ namespace: Serialize expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'import', 'circuit', 'function', 'test', '@' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" + - "Error [EPAR0370005]: expected 'function', 'test' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/statement/alias.leo.out b/tests/expectations/parser/parser/statement/alias.leo.out new file mode 100644 index 0000000000..7ece282aab --- /dev/null +++ b/tests/expectations/parser/parser/statement/alias.leo.out @@ -0,0 +1,42 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + aliases: + "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}": + name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}" + span: + line_start: 3 + line_stop: 3 + col_start: 1 + col_stop: 14 + path: "" + content: type a = u32; + represents: + IntegerType: U32 + "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}": + name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}" + span: + line_start: 5 + line_stop: 5 + col_start: 1 + col_stop: 17 + path: "" + content: type b = string; + represents: + Identifier: "{\"name\":\"string\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":10,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}" + "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}": + name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}" + span: + line_start: 7 + line_stop: 7 + col_start: 1 + col_stop: 12 + path: "" + content: type c = a; + represents: + Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}" + global_consts: {} + functions: {} diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out index b0ccc8ac1b..ac520eb734 100644 --- a/tests/expectations/parser/parser/statement/assign.leo.out +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -23,35 +23,6 @@ outputs: col_stop: 9 path: "" content: x = expr; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x = (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 7 - path: "" - content: x = (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: x = (); - Assign: operation: Assign assignee: @@ -85,37 +56,6 @@ outputs: col_stop: 8 path: "" content: x = x+y; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: "x = (x,y);" - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 10 - path: "" - content: "x = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x = (x,y);" - Assign: operation: Assign assignee: @@ -147,407 +87,6 @@ outputs: col_stop: 8 path: "" content: x = x(); - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] = y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[0] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] = y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "x[0u32] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 = y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 = y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 = y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x.0 = y; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2] = y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2] = y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[1..2] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "x[1..2] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2] = y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[..2] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[..2] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..] = y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..] = y;" - - ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[2..] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[2..] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..] = y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "x[..] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..] = y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..] = y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..] = y;" - - ArrayRange: - - ~ - - ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0[0][..] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x.0[0][..] = y;" - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y = y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y = y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x.y = y; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 32 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":35,\\\"col_stop\\\":36,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3] = y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 36 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3] = y;" - Assign: operation: Add assignee: @@ -569,35 +108,6 @@ outputs: col_stop: 10 path: "" content: x += expr; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x += ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x += (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x += (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x += (); - Assign: operation: Add assignee: @@ -662,473 +172,6 @@ outputs: col_stop: 9 path: "" content: x += x(); - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] += y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] += y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 += y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 += y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 += y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 += y; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] += y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] += y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] += y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] += y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] += y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] += y;" - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y += y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y += y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y += y; - - Assign: - operation: Add - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] += y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] += y;" - Assign: operation: Sub assignee: @@ -1150,35 +193,6 @@ outputs: col_stop: 10 path: "" content: x -= expr; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x -= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x -= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x -= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x -= (); - Assign: operation: Sub assignee: @@ -1243,473 +257,6 @@ outputs: col_stop: 9 path: "" content: x -= x(); - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] -= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] -= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 -= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 -= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 -= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 -= y; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] -= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] -= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] -= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] -= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] -= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] -= y;" - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y -= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y -= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y -= y; - - Assign: - operation: Sub - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;" - Assign: operation: Mul assignee: @@ -1731,35 +278,6 @@ outputs: col_stop: 10 path: "" content: x *= expr; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x *= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x *= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x *= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x *= (); - Assign: operation: Mul assignee: @@ -1824,473 +342,6 @@ outputs: col_stop: 9 path: "" content: x *= x(); - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 *= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 *= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 *= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 *= y; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] *= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] *= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] *= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] *= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] *= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y *= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y *= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y *= y; - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;" - Assign: operation: Div assignee: @@ -2312,35 +363,6 @@ outputs: col_stop: 10 path: "" content: x /= expr; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x /= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x /= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 8 - path: "" - content: x /= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: x /= (); - Assign: operation: Div assignee: @@ -2405,473 +427,6 @@ outputs: col_stop: 9 path: "" content: x /= x(); - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] /= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] /= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 /= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 /= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 /= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.0 /= y; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] /= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[1..2][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..2][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] /= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[2..][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] /= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x[..][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] /= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] /= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "x.0[0][..][0] /= y;" - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y /= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y /= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x.y /= y; - - Assign: - operation: Div - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":39,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 40 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;" - Assign: operation: Pow assignee: @@ -2893,35 +448,6 @@ outputs: col_stop: 11 path: "" content: x **= expr; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= ();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x **= (); - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 9 - path: "" - content: x **= (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: x **= (); - Assign: operation: Pow assignee: @@ -2955,501 +481,3 @@ outputs: col_stop: 10 path: "" content: x **= x+y; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= x();\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 2 - path: "" - content: x **= x(); - value: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x **= x();\\\"}\"}" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 10 - path: "" - content: x **= x(); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x **= x(); - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0] *= y;" - - Assign: - operation: Mul - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - accesses: - - ArrayIndex: - Value: - Integer: - - U32 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 7 - path: "" - content: "x[0u32] *= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[0u32] *= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u32] *= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "x[0u32] *= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 **= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 **= y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 **= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0 **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x.0 **= y; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..2][0] **= y;" - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..2][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "x[1..2][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[1..2][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..2][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 17 - path: "" - content: "x[1..2][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..2][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[..2][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[..2][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..2][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[..2][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - Value: - Implicit: - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[2..][0] **= y;" - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "x[2..][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[2..][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[2..][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[2..][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] **= y;\\\"}\"}" - accesses: - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x[..][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "x[..][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] **= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0[0][..][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x.0[0][..][0] **= y;" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 12 - col_stop: 13 - path: "" - content: "x.0[0][..][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "x.0[0][..][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0[0][..][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 20 - path: "" - content: "x.0[0][..][0] **= y;" - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y **= y;\\\"}\"}" - accesses: - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y **= y; - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: x.y **= y; - - Assign: - operation: Pow - assignee: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - accesses: - - Tuple: - - value: "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Tuple: - - value: "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Member: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - - ArrayRange: - - ~ - - ~ - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 18 - col_stop: 19 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - ArrayRange: - - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 22 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Value: - Implicit: - - "5" - - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 25 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - ArrayRange: - - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - Value: - Implicit: - - "3" - - span: - line_start: 1 - line_stop: 1 - col_start: 30 - col_stop: 31 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - - ArrayIndex: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 33 - col_stop: 34 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 35 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" - value: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":40,\\\"col_stop\\\":41,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 41 - path: "" - content: "x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;" diff --git a/tests/expectations/parser/parser/statement/assign_fail.leo.out b/tests/expectations/parser/parser/statement/assign_fail.leo.out index 9f5508847a..a4ac3d898c 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.leo.out +++ b/tests/expectations/parser/parser/statement/assign_fail.leo.out @@ -2,17 +2,17 @@ namespace: ParseStatement expectation: Fail outputs: - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x::y = y;\n | ^^^^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::y = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | 5 = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x + x = y;\n | ^^^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | -x = y;\n | ^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | !x = y;\n | ^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | a? x : x = y;\n | ^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x as u32 = y;\n | ^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x {x: y, y: z} = y;\n | ^^^^^^^^^^^^^^" + - "Error [EPAR0370005]: expected ; -- got 'as'\n --> test:1:3\n |\n 1 | x as u32 = y;\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^" + - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:3\n |\n 1 | x {x: y, y: z} = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x() = y;\n | ^^^" - - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x.y() = y;\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got 'y'\n --> test:1:3\n |\n 1 | x.y() = y;\n | ^" - "Error [EPAR0370030]: Could not lex the following content: `🦀 = y;`." diff --git a/tests/expectations/parser/parser/statement/block.leo.out b/tests/expectations/parser/parser/statement/block.leo.out index 4ad226b576..8b88799c01 100644 --- a/tests/expectations/parser/parser/statement/block.leo.out +++ b/tests/expectations/parser/parser/statement/block.leo.out @@ -15,22 +15,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -62,22 +63,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 3 - line_stop: 3 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 3 line_stop: 3 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 2 line_stop: 4 @@ -101,22 +103,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 3 - line_stop: 3 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 3 line_stop: 3 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 2 line_stop: 4 diff --git a/tests/expectations/parser/parser/statement/conditional.leo.out b/tests/expectations/parser/parser/statement/conditional.leo.out index 3fd8752374..48d793e620 100644 --- a/tests/expectations/parser/parser/statement/conditional.leo.out +++ b/tests/expectations/parser/parser/statement/conditional.leo.out @@ -9,22 +9,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -40,44 +41,6 @@ outputs: col_stop: 2 path: "" content: "if x {\n ...\n}" - - Conditional: - condition: - Identifier: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"if Self {\\\"}\"}" - block: - statements: - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 2 - line_stop: 2 - col_start: 1 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 1 - line_stop: 3 - col_start: 9 - col_stop: 2 - path: "" - content: "if Self {\n ...\n}" - next: ~ - span: - line_start: 1 - line_stop: 3 - col_start: 1 - col_stop: 2 - path: "" - content: "if Self {\n ...\n}" - Conditional: condition: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"if (x) {\\\"}\"}" @@ -85,22 +48,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -247,22 +211,23 @@ outputs: content: expr; - Return: expression: - TupleInit: - elements: [] - span: - line_start: 3 - line_stop: 3 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 3 + line_stop: 3 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 3 line_stop: 3 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 4 diff --git a/tests/expectations/parser/parser/statement/definition.leo.out b/tests/expectations/parser/parser/statement/definition.leo.out index ca3527b280..56f9c11987 100644 --- a/tests/expectations/parser/parser/statement/definition.leo.out +++ b/tests/expectations/parser/parser/statement/definition.leo.out @@ -24,36 +24,6 @@ outputs: col_stop: 13 path: "" content: let x = expr; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: let x = (); - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 11 - path: "" - content: let x = (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: let x = (); - Definition: declaration_type: Let variable_names: @@ -88,38 +58,6 @@ outputs: col_stop: 12 path: "" content: let x = x+y; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 14 - path: "" - content: "let x = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: "let x = (x,y);" - Definition: declaration_type: Let variable_names: @@ -174,36 +112,6 @@ outputs: col_stop: 15 path: "" content: const x = expr; - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: const x = (); - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 13 - path: "" - content: const x = (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: const x = (); - Definition: declaration_type: Const variable_names: @@ -238,38 +146,6 @@ outputs: col_stop: 14 path: "" content: const x = x+y; - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "const x = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 16 - path: "" - content: "const x = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "const x = (x,y);" - Definition: declaration_type: Const variable_names: @@ -325,37 +201,6 @@ outputs: col_stop: 18 path: "" content: "let x: u32 = expr;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 16 - path: "" - content: "let x: u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "let x: u32 = ();" - Definition: declaration_type: Let variable_names: @@ -391,39 +236,6 @@ outputs: col_stop: 17 path: "" content: "let x: u32 = x+y;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 19 - path: "" - content: "let x: u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "let x: u32 = (x,y);" - Definition: declaration_type: Let variable_names: @@ -480,37 +292,6 @@ outputs: col_stop: 20 path: "" content: "const x: u32 = expr;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "const x: u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 18 - path: "" - content: "const x: u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 18 - path: "" - content: "const x: u32 = ();" - Definition: declaration_type: Const variable_names: @@ -546,39 +327,6 @@ outputs: col_stop: 19 path: "" content: "const x: u32 = x+y;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 7 - col_stop: 8 - path: "" - content: "const x: u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 21 - path: "" - content: "const x: u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 21 - path: "" - content: "const x: u32 = (x,y);" - Definition: declaration_type: Const variable_names: @@ -643,45 +391,6 @@ outputs: col_stop: 18 path: "" content: "let (x, y) = expr;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y) = ();" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y) = ();" - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 16 - path: "" - content: "let (x, y) = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "let (x, y) = ();" - Definition: declaration_type: Let variable_names: @@ -725,47 +434,6 @@ outputs: col_stop: 17 path: "" content: "let (x, y) = x+y;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y) = (x,y);" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y) = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 19 - path: "" - content: "let (x, y) = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 19 - path: "" - content: "let (x, y) = (x,y);" - Definition: declaration_type: Let variable_names: @@ -838,45 +506,6 @@ outputs: col_stop: 20 path: "" content: "const (x, y) = expr;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y) = ();" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y) = ();" - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 18 - path: "" - content: "const (x, y) = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 18 - path: "" - content: "const (x, y) = ();" - Definition: declaration_type: Const variable_names: @@ -920,47 +549,6 @@ outputs: col_stop: 19 path: "" content: "const (x, y) = x+y;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y) = (x,y);" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y) = (x,y);" - type_: ~ - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":17,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y) = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 16 - col_stop: 21 - path: "" - content: "const (x, y) = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 21 - path: "" - content: "const (x, y) = (x,y);" - Definition: declaration_type: Const variable_names: @@ -1034,46 +622,6 @@ outputs: col_stop: 23 path: "" content: "let (x, y): u32 = expr;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y): u32 = ();" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y): u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 19 - col_stop: 21 - path: "" - content: "let (x, y): u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 21 - path: "" - content: "let (x, y): u32 = ();" - Definition: declaration_type: Let variable_names: @@ -1118,48 +666,6 @@ outputs: col_stop: 22 path: "" content: "let (x, y): u32 = x+y;" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x, y): u32 = (x,y);" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 10 - path: "" - content: "let (x, y): u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 19 - col_stop: 24 - path: "" - content: "let (x, y): u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 24 - path: "" - content: "let (x, y): u32 = (x,y);" - Definition: declaration_type: Let variable_names: @@ -1234,46 +740,6 @@ outputs: col_stop: 25 path: "" content: "const (x, y): u32 = expr;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y): u32 = ();" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y): u32 = ();" - type_: - IntegerType: U32 - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 23 - path: "" - content: "const (x, y): u32 = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 23 - path: "" - content: "const (x, y): u32 = ();" - Definition: declaration_type: Const variable_names: @@ -1318,48 +784,6 @@ outputs: col_stop: 24 path: "" content: "const (x, y): u32 = x+y;" - - Definition: - declaration_type: Const - variable_names: - - mutable: false - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "const (x, y): u32 = (x,y);" - - mutable: false - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 11 - col_stop: 12 - path: "" - content: "const (x, y): u32 = (x,y);" - type_: - IntegerType: U32 - value: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":22,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":24,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const (x, y): u32 = (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 21 - col_stop: 26 - path: "" - content: "const (x, y): u32 = (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 26 - path: "" - content: "const (x, y): u32 = (x,y);" - Definition: declaration_type: Const variable_names: @@ -1402,242 +826,6 @@ outputs: col_stop: 24 path: "" content: "const (x, y): u32 = x();" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x,y,) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "let (x,y,) = ();" - - mutable: true - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let (x,y,) = ();\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 9 - path: "" - content: "let (x,y,) = ();" - type_: ~ - value: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 14 - col_stop: 16 - path: "" - content: "let (x,y,) = ();" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "let (x,y,) = ();" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: [[u8; 2]; 2] = [[0,0], [0,0]];\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - type_: - Array: - - Array: - - IntegerType: U8 - - - value: "2" - - - value: "2" - value: - ArrayInline: - elements: - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 25 - col_stop: 26 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 29 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 32 - col_stop: 33 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 34 - col_stop: 35 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 31 - col_stop: 36 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 37 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 37 - path: "" - content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];" - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: [u8; (2, 2)] = [[0,0], [0,0]];\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - type_: - Array: - - IntegerType: U8 - - - value: "2" - - value: "2" - value: - ArrayInline: - elements: - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 25 - col_stop: 26 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 27 - col_stop: 28 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 24 - col_stop: 29 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - - Expression: - ArrayInline: - elements: - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 32 - col_stop: 33 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - - Expression: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 34 - col_stop: 35 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 31 - col_stop: 36 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 23 - col_stop: 37 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 37 - path: "" - content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];" - Definition: declaration_type: Let variable_names: diff --git a/tests/expectations/parser/parser/statement/definition_fail.leo.out b/tests/expectations/parser/parser/statement/definition_fail.leo.out index 869c0238aa..cdaf512fdd 100644 --- a/tests/expectations/parser/parser/statement/definition_fail.leo.out +++ b/tests/expectations/parser/parser/statement/definition_fail.leo.out @@ -3,29 +3,29 @@ namespace: ParseStatement expectation: Fail outputs: - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = expr;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = ();\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = ();\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:13\n |\n 1 | let mut x = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x+y;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = (x,y);\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = (x,y);\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:13\n |\n 1 | let mut x = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x();\n | ^^^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = expr;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = ();\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = ();\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:15\n |\n 1 | const mut x = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x+y;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = (x,y);\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = (x,y);\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:15\n |\n 1 | const mut x = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x();\n | ^^^^^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = expr;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = ();\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = ();\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:18\n |\n 1 | let mut x: u32 = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x+y;\n | ^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:18\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x();\n | ^^^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = expr;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = ();\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = ();\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:20\n |\n 1 | const mut x: u32 = ();\n | ^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x+y;\n | ^^^^^^^^^" - - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^^^^^" + - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^^^^^\nError [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:20\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^" - "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x();\n | ^^^^^^^^^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:10\n |\n 1 | let (x,y,,) = ();\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:6\n |\n 1 | let (,x,y) = ();\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:8\n |\n 1 | let (x,,y) = ();\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'int', got ','\n --> test:1:16\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^\nError [EPAR0370039]: do not put parens around single dimension array size\n --> test:1:13\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^^^^^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'const'\n --> test:1:8\n |\n 1 | let x: const = expr;\n | ^^^^^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'let'\n --> test:1:10\n |\n 1 | const x: let = expr;\n | ^^^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'mut'\n --> test:1:8\n |\n 1 | let x: mut = expr;\n | ^^^" @@ -39,10 +39,10 @@ outputs: - "Error [EPAR0370005]: expected = -- got ';'\n --> test:1:10\n |\n 1 | let x: u8;\n | ^" - "Error [EPAR0370003]: unexpected EOF\n --> test:1:8\n |\n 1 | let x: u8\n | ^^" - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '='\n --> test:1:8\n |\n 1 | let x: = 1;\n | ^" - - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:11\n |\n 1 | let x: [u8] = 1;\n | ^" - - "Error [EPAR0370003]: unexpected EOF\n --> test:1:11\n |\n 1 | let x: [u8;\n | ^" - - "Error [EPAR0370005]: expected ] -- got 'u8'\n --> test:1:14\n |\n 1 | let x: [u8; 1u8] = [1,\n | ^^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8] = 1;\n | ^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8;\n | ^" + - "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got '['\n --> test:1:8\n |\n 1 | let x: [u8; 1u8] = [1,\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:15\n |\n 1 | let dbg: u8 = ];\n | ^" - "Error [EPAR0370030]: Could not lex the following content: `🦀: u8 = 0;`." - - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:11\n |\n 1 | let (x) = ...;\n | ^^^" - - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x,) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:12\n |\n 1 | let (x,) = ...;\n | ^^^" + - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:11\n |\n 1 | let (x) = ...;\n | ^^" + - "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x,) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:12\n |\n 1 | let (x,) = ...;\n | ^^" diff --git a/tests/expectations/parser/parser/statement/expression.leo.out b/tests/expectations/parser/parser/statement/expression.leo.out index d03278d686..06cbb5ad23 100644 --- a/tests/expectations/parser/parser/statement/expression.leo.out +++ b/tests/expectations/parser/parser/statement/expression.leo.out @@ -12,24 +12,6 @@ outputs: col_stop: 5 path: "" content: expr; - - Expression: - expression: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 3 - path: "" - content: (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 3 - path: "" - content: (); - Expression: expression: Binary: @@ -52,26 +34,6 @@ outputs: col_stop: 4 path: "" content: x+y; - - Expression: - expression: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"(x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"(x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "(x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "(x,y);" - Expression: expression: Call: diff --git a/tests/expectations/parser/parser/statement/expression_fail.leo.out b/tests/expectations/parser/parser/statement/expression_fail.leo.out index 51218ebaa7..9d5ba21531 100644 --- a/tests/expectations/parser/parser/statement/expression_fail.leo.out +++ b/tests/expectations/parser/parser/statement/expression_fail.leo.out @@ -3,8 +3,8 @@ namespace: ParseStatement expectation: Fail outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:2\n |\n 1 | (];\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:2\n |\n 1 | [);\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [);\n | ^" - "Error [EPAR0370030]: Could not lex the following content: `\\y;`." - "Error [EPAR0370040]: Found the char `;`, but expected `|`" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:3\n |\n 1 | x[};\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:2\n |\n 1 | x[};\n | ^" - "Error [EPAR0370005]: expected ) -- got ']'\n --> test:1:6\n |\n 1 | (x, y];\n | ^" diff --git a/tests/expectations/parser/parser/statement/global_const.leo.out b/tests/expectations/parser/parser/statement/global_const.leo.out new file mode 100644 index 0000000000..52e7673324 --- /dev/null +++ b/tests/expectations/parser/parser/statement/global_const.leo.out @@ -0,0 +1,106 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + aliases: {} + global_consts: + x: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: char = 'b';\\\"}\"}" + span: + line_start: 11 + line_stop: 11 + col_start: 7 + col_stop: 8 + path: "" + content: "const x: char = 'b';" + type_: Char + value: + Value: + Char: + character: + Scalar: 98 + span: + line_start: 11 + line_stop: 11 + col_start: 17 + col_stop: 20 + path: "" + content: "const x: char = 'b';" + span: + line_start: 11 + line_stop: 11 + col_start: 1 + col_stop: 20 + path: "" + content: "const x: char = 'b';" + f: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const f: u32 = x;\\\"}\"}" + span: + line_start: 5 + line_stop: 5 + col_start: 7 + col_stop: 8 + path: "" + content: "const f: u32 = x;" + type_: + IntegerType: U32 + value: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const f: u32 = x;\\\"}\"}" + span: + line_start: 5 + line_stop: 5 + col_start: 1 + col_stop: 17 + path: "" + content: "const f: u32 = x;" + y: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const y: string = \\\\\\\"hello world\\\\\\\";\\\"}\"}" + span: + line_start: 9 + line_stop: 9 + col_start: 7 + col_stop: 8 + path: "" + content: "const y: string = \"hello world\";" + type_: + Identifier: "{\"name\":\"string\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const y: string = \\\\\\\"hello world\\\\\\\";\\\"}\"}" + value: + Value: + String: + - - Scalar: 104 + - Scalar: 101 + - Scalar: 108 + - Scalar: 108 + - Scalar: 111 + - Scalar: 32 + - Scalar: 119 + - Scalar: 111 + - Scalar: 114 + - Scalar: 108 + - Scalar: 100 + - span: + line_start: 9 + line_stop: 9 + col_start: 19 + col_stop: 32 + path: "" + content: "const y: string = \"hello world\";" + span: + line_start: 9 + line_stop: 9 + col_start: 1 + col_stop: 32 + path: "" + content: "const y: string = \"hello world\";" + functions: {} diff --git a/tests/expectations/parser/parser/statement/iteration.leo.out b/tests/expectations/parser/parser/statement/iteration.leo.out index 05513bd21e..c4e876a74e 100644 --- a/tests/expectations/parser/parser/statement/iteration.leo.out +++ b/tests/expectations/parser/parser/statement/iteration.leo.out @@ -72,22 +72,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -132,22 +133,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 @@ -182,22 +184,23 @@ outputs: statements: - Return: expression: - TupleInit: - elements: [] - span: - line_start: 2 - line_stop: 2 - col_start: 8 - col_stop: 10 - path: "" - content: return (); + Value: + Implicit: + - "0" + - span: + line_start: 2 + line_stop: 2 + col_start: 8 + col_stop: 9 + path: "" + content: return 0; span: line_start: 2 line_stop: 2 col_start: 1 - col_stop: 10 + col_stop: 9 path: "" - content: return (); + content: return 0; span: line_start: 1 line_stop: 3 diff --git a/tests/expectations/parser/parser/statement/return.leo.out b/tests/expectations/parser/parser/statement/return.leo.out index 2994e613bc..ed1fb34ada 100644 --- a/tests/expectations/parser/parser/statement/return.leo.out +++ b/tests/expectations/parser/parser/statement/return.leo.out @@ -12,84 +12,6 @@ outputs: col_stop: 12 path: "" content: return expr; - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: return (); - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 10 - path: "" - content: return (); - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: return (); - - Return: - expression: - Binary: - left: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return x+y;\\\"}\"}" - right: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return x+y;\\\"}\"}" - op: Add - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 11 - path: "" - content: return x+y; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: return x+y; - - Return: - expression: - TupleInit: - elements: - - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return (x,y);\\\"}\"}" - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"return (x,y);\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 13 - path: "" - content: "return (x,y);" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 13 - path: "" - content: "return (x,y);" - Return: expression: Value: diff --git a/tests/expectations/parser/parser/statement/test_keyword_fail.leo.out b/tests/expectations/parser/parser/statement/test_keyword_fail.leo.out new file mode 100644 index 0000000000..22e16133ed --- /dev/null +++ b/tests/expectations/parser/parser/statement/test_keyword_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370015]: \"test function...\" is deprecated. Did you mean @test annotation?\n --> test:3:1\n |\n 3 | test main() {}\n | ^^^^" diff --git a/tests/expectations/parser/parser/unreachable/define.leo.out b/tests/expectations/parser/parser/unreachable/define.leo.out index 375ae97a14..e075c01cfc 100644 --- a/tests/expectations/parser/parser/unreachable/define.leo.out +++ b/tests/expectations/parser/parser/unreachable/define.leo.out @@ -4,16 +4,16 @@ expectation: Fail outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ; x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '.'\n --> test:1:1\n |\n 1 | . x = 10u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import x = 10u8;\n | ^^^^^^" + - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:8\n |\n 1 | import x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:1\n |\n 1 | , x = 10u8;\n | ^" - - "Error [EPAR0370005]: expected , -- got '='\n --> test:1:5\n |\n 1 | [ x = 10u8;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [ x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:1\n |\n 1 | ] x = 10u8;\n | ^" - "Error [EPAR0370003]: unexpected EOF\n --> test:1:11\n |\n 1 | { x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:1\n |\n 1 | } x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ) -- got '='\n --> test:1:5\n |\n 1 | ( x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | ) x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | : x = 10u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '::'\n --> test:1:1\n |\n 1 | :: x = 10u8;\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :: x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ? x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _ x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:1\n |\n 1 | = x = 10u8;\n | ^" @@ -26,7 +26,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '<='\n --> test:1:1\n |\n 1 | <= x = 10u8;\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '>'\n --> test:1:1\n |\n 1 | > x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | .. x = 10u8;\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'as'\n --> test:1:1\n |\n 1 | as x = 10u8;\n | ^^" + - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:4\n |\n 1 | as x = 10u8;\n | ^" - "Error [EPAR0370005]: expected . -- got 'x'\n --> test:1:9\n |\n 1 | console x = 10u8;\n | ^" - "Error [EPAR0370005]: expected in -- got '='\n --> test:1:7\n |\n 1 | for x = 10u8;\n | ^" - "Error [EPAR0370005]: expected { -- got '='\n --> test:1:6\n |\n 1 | if x = 10u8;\n | ^" @@ -41,7 +41,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:5\n |\n 1 | u32 x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:5\n |\n 1 | u64 x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:6\n |\n 1 | u128 x = 10u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '&'\n --> test:1:1\n |\n 1 | & x = 10u8;\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370005]: expected ; -- got '='\n --> test:1:10\n |\n 1 | return x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:6\n |\n 1 | self x = 10u8;\n | ^" - "Error [EPAR0370005]: expected ; -- got 'x'\n --> test:1:6\n |\n 1 | Self x = 10u8;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/eat_ident.leo.out b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out index cb16998106..5c1018440c 100644 --- a/tests/expectations/parser/parser/unreachable/eat_ident.leo.out +++ b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:3:9\n |\n 3 | circuit ;\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." diff --git a/tests/expectations/parser/parser/unreachable/eat_int.leo.out b/tests/expectations/parser/parser/unreachable/eat_int.leo.out index f2f5151fe2..881cd8dfbe 100644 --- a/tests/expectations/parser/parser/unreachable/eat_int.leo.out +++ b/tests/expectations/parser/parser/unreachable/eat_int.leo.out @@ -3,54 +3,54 @@ namespace: ParseStatement expectation: Fail outputs: - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '-'\n --> test:1:3\n |\n 1 | x.-12\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_;\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_.\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_import\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_,\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_*\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_+\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_-\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_/\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_[\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_]\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_{\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_}\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_(\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_)\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_:\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_::\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_?\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0__\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_==\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_!\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_!=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_>\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_>=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_<\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_<=\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_>\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_..\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_as\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_console\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_const\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_let\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_for\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_if\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_else\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i8\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i16\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i32\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i64\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_i128\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u8\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u16\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u32\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u64\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_u128\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_&\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_return\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_self\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_Self\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_true\n | ^" - - "Error [EPAR0370005]: expected ; -- got '_'\n --> test:1:4\n |\n 1 | x.0_false\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_.\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_import\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_,\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_*\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_+\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_-\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_/\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_[\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_{\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_(\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_)\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_:\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_::\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_?\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0__\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_==\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_!\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_!=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_>\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_>=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_<\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_<=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_>\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_..\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_as\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_console\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_const\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_let\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_for\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_if\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_else\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i8\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i16\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i32\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i64\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_i128\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u8\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u16\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u32\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u64\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_u128\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_return\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_self\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_Self\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_true\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '0'\n --> test:1:3\n |\n 1 | x.0_false\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out b/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out index 23a140dc16..2fb078335f 100644 --- a/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out +++ b/tests/expectations/parser/parser/unreachable/equality_and_order_expression.leo.out @@ -47,7 +47,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 u32 {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 u64 {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 u128 {}\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 & {}\n | ^^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 return {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 self {}\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if 10 Self {}\n | ^^" diff --git a/tests/expectations/parser/parser/unreachable/expect_ident.leo.out b/tests/expectations/parser/parser/unreachable/expect_ident.leo.out index 5d356e51f1..8041c9b1fd 100644 --- a/tests/expectations/parser/parser/unreachable/expect_ident.leo.out +++ b/tests/expectations/parser/parser/unreachable/expect_ident.leo.out @@ -2,55 +2,55 @@ namespace: ParseStatement expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:1:4\n |\n 1 | x::;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '.'\n --> test:1:4\n |\n 1 | x::.\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'import'\n --> test:1:4\n |\n 1 | x::import\n | ^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x::,\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '*'\n --> test:1:4\n |\n 1 | x::*\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '+'\n --> test:1:4\n |\n 1 | x::+\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '-'\n --> test:1:4\n |\n 1 | x::-\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '/'\n --> test:1:4\n |\n 1 | x::/\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '['\n --> test:1:4\n |\n 1 | x::[\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ']'\n --> test:1:4\n |\n 1 | x::]\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '{'\n --> test:1:4\n |\n 1 | x::{\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '}'\n --> test:1:4\n |\n 1 | x::}\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '('\n --> test:1:4\n |\n 1 | x::(\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ')'\n --> test:1:4\n |\n 1 | x::)\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ':'\n --> test:1:4\n |\n 1 | x:::\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '::'\n --> test:1:4\n |\n 1 | x::::\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:1:4\n |\n 1 | x::?\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '_'\n --> test:1:4\n |\n 1 | x::_\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '='\n --> test:1:4\n |\n 1 | x::=\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '=='\n --> test:1:4\n |\n 1 | x::==\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '!'\n --> test:1:4\n |\n 1 | x::!\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '!='\n --> test:1:4\n |\n 1 | x::!=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>'\n --> test:1:4\n |\n 1 | x::>\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>='\n --> test:1:4\n |\n 1 | x::>=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '<'\n --> test:1:4\n |\n 1 | x::<\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '<='\n --> test:1:4\n |\n 1 | x::<=\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>'\n --> test:1:4\n |\n 1 | x::>\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '..'\n --> test:1:4\n |\n 1 | x::..\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'as'\n --> test:1:4\n |\n 1 | x::as\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'console'\n --> test:1:4\n |\n 1 | x::console\n | ^^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'const'\n --> test:1:4\n |\n 1 | x::const\n | ^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'let'\n --> test:1:4\n |\n 1 | x::let\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'for'\n --> test:1:4\n |\n 1 | x::for\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'if'\n --> test:1:4\n |\n 1 | x::if\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'else'\n --> test:1:4\n |\n 1 | x::else\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i8'\n --> test:1:4\n |\n 1 | x::i8\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i16'\n --> test:1:4\n |\n 1 | x::i16\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i32'\n --> test:1:4\n |\n 1 | x::i32\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i64'\n --> test:1:4\n |\n 1 | x::i64\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i128'\n --> test:1:4\n |\n 1 | x::i128\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u8'\n --> test:1:4\n |\n 1 | x::u8\n | ^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u16'\n --> test:1:4\n |\n 1 | x::u16\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u32'\n --> test:1:4\n |\n 1 | x::u32\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u64'\n --> test:1:4\n |\n 1 | x::u64\n | ^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u128'\n --> test:1:4\n |\n 1 | x::u128\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '&'\n --> test:1:4\n |\n 1 | x::&\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'return'\n --> test:1:4\n |\n 1 | x::return\n | ^^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'self'\n --> test:1:4\n |\n 1 | x::self\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'Self'\n --> test:1:4\n |\n 1 | x::Self\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'true'\n --> test:1:4\n |\n 1 | x::true\n | ^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'false'\n --> test:1:4\n |\n 1 | x::false\n | ^^^^^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '0'\n --> test:1:4\n |\n 1 | x::0\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::;\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::.\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::import\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::,\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::*\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::+\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::-\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::/\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::[\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::]\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::{\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::}\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::(\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::)\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x:::\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::::\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::?\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::_\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::==\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::!\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::!=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::<\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::<=\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::..\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::as\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::console\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::const\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::let\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::for\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::if\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::else\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i8\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i16\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i32\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i64\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i128\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u8\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u16\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u32\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u64\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u128\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::return\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::self\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::Self\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::true\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::false\n | ^" + - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::0\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out index d3eb1fba62..43975e39c2 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_fail.leo.out @@ -5,9 +5,9 @@ outputs: - "did not consume all input: 'b' @ 1:13-14\n';' @ 1:14-15\n" - "Error [EPAR0370005]: expected ; -- got 'import'\n --> test:1:11\n |\n 1 | let x = a import b;\n | ^^^^^^" - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:11\n |\n 1 | let x = a , b;\n | ^" - - "Error [EPAR0370005]: expected ] -- got ';'\n --> test:1:14\n |\n 1 | let x = a [ b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:11\n |\n 1 | let x = a [ b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:11\n |\n 1 | let x = a ] b;\n | ^" - - "Error [EPAR0370005]: expected } -- got ';'\n --> test:1:14\n |\n 1 | let x = a { b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:11\n |\n 1 | let x = a { b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:11\n |\n 1 | let x = a } b;\n | ^" - "Error [EPAR0370005]: expected ) -- got ';'\n --> test:1:14\n |\n 1 | let x = a ( b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ')'\n --> test:1:11\n |\n 1 | let x = a ) b;\n | ^" @@ -33,7 +33,7 @@ outputs: - "Error [EPAR0370005]: expected ; -- got 'u32'\n --> test:1:11\n |\n 1 | let x = a u32 b;\n | ^^^" - "Error [EPAR0370005]: expected ; -- got 'u64'\n --> test:1:11\n |\n 1 | let x = a u64 b;\n | ^^^" - "Error [EPAR0370005]: expected ; -- got 'u128'\n --> test:1:11\n |\n 1 | let x = a u128 b;\n | ^^^^" - - "Error [EPAR0370005]: expected ; -- got '&'\n --> test:1:11\n |\n 1 | let x = a & b;\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." - "Error [EPAR0370005]: expected ; -- got 'return'\n --> test:1:11\n |\n 1 | let x = a return b;\n | ^^^^^^" - "Error [EPAR0370005]: expected ; -- got 'self'\n --> test:1:11\n |\n 1 | let x = a self b;\n | ^^^^" - "Error [EPAR0370005]: expected ; -- got 'Self'\n --> test:1:11\n |\n 1 | let x = a Self b;\n | ^^^^" @@ -43,17 +43,17 @@ outputs: - "did not consume all input: '=' @ 1:3-4\n'b' @ 1:4-5\n';' @ 1:5-6\n" - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got '='\n --> test:1:3\n |\n 1 | x.=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:2\n |\n 1 | x,=b; // 43\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:3\n |\n 1 | x[=b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:2\n |\n 1 | x[=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:2\n |\n 1 | x]=b;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got '='\n --> test:1:3\n |\n 1 | x{=b;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:2\n |\n 1 | x{=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:2\n |\n 1 | x}=b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:4\n |\n 1 | x=(;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:3\n |\n 1 | x=);\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:3\n |\n 1 | x=:;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got '::'\n --> test:1:3\n |\n 1 | x=::;\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:3\n |\n 1 | x=::;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:3\n |\n 1 | x?=b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x!==b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x>==b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x<==b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '..'\n --> test:1:2\n |\n 1 | x..=b;\n | ^^" - - "Error [EPAR0370005]: expected ; -- got '&'\n --> test:1:2\n |\n 1 | x&=b;\n | ^" + - "Error [EPAR0370023]: Expected more characters to lex but found none." diff --git a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out index 051886207a..324d10b3e1 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out +++ b/tests/expectations/parser/parser/unreachable/math_op_pass.leo.out @@ -2,74 +2,6 @@ namespace: ParseStatement expectation: Pass outputs: - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a . b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: let x = a . b; - type_: ~ - value: - Access: - Member: - inner: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a . b;\\\"}\"}" - name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a . b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 14 - path: "" - content: let x = a . b; - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 14 - path: "" - content: let x = a . b; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a :: b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "let x = a :: b;" - type_: ~ - value: - Access: - Static: - inner: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a :: b;\\\"}\"}" - name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a :: b;\\\"}\"}" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 15 - path: "" - content: "let x = a :: b;" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "let x = a :: b;" - Definition: declaration_type: Let variable_names: @@ -308,60 +240,6 @@ outputs: col_stop: 14 path: "" content: let x = a > b; - - Definition: - declaration_type: Let - variable_names: - - mutable: true - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a as b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: let x = a as b; - type_: ~ - value: - Cast: - inner: - Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a as b;\\\"}\"}" - target_type: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x = a as b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 9 - col_stop: 15 - path: "" - content: let x = a as b; - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: let x = a as b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"ximport\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"ximport=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: ximport=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"ximport=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: ximport=b; - Assign: operation: Assign assignee: @@ -493,27 +371,6 @@ outputs: col_stop: 5 path: "" content: x>=b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"xas\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xas=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: xas=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xas=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: xas=b; - Assign: operation: Assign assignee: @@ -871,48 +728,6 @@ outputs: col_stop: 10 path: "" content: xreturn=b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"xself\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xself=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: xself=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xself=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: xself=b; - - Assign: - operation: Assign - assignee: - identifier: "{\"name\":\"xSelf\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xSelf=b;\\\"}\"}" - accesses: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: xSelf=b; - value: - Identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"xSelf=b;\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: xSelf=b; - Assign: operation: Assign assignee: diff --git a/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out b/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out index c65db37a9a..582b63369f 100644 --- a/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out +++ b/tests/expectations/parser/parser/unreachable/postfix_fail.leo.out @@ -5,9 +5,9 @@ outputs: - "did not consume all input: ';' @ 1:11-12\n" - "Error [EPAR0370009]: unexpected string: expected 'int or ident', got ';'\n --> test:1:11\n |\n 1 | let x = a.;\n | ^" - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:10\n |\n 1 | let x = a,;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:11\n |\n 1 | let x = a[;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:10\n |\n 1 | let x = a[;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:10\n |\n 1 | let x = a];\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:1:11\n |\n 1 | let x = a{;\n | ^" + - "Error [EPAR0370005]: expected ; -- got '{'\n --> test:1:10\n |\n 1 | let x = a{;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:10\n |\n 1 | let x = a};\n | ^" - "Error [EPAR0370005]: expected ; -- got ')'\n --> test:1:10\n |\n 1 | let x = a);\n | ^" - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:10\n |\n 1 | let x = a:;\n | ^" diff --git a/tests/parser/circuits/big_self.leo b/tests/parser/circuits/big_self.leo deleted file mode 100644 index e6c5d08fbd..0000000000 --- a/tests/parser/circuits/big_self.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x() -> Self { - return Self {}; - } -} \ No newline at end of file diff --git a/tests/parser/circuits/const_functions.leo b/tests/parser/circuits/const_functions.leo deleted file mode 100644 index 21fb9d5e12..0000000000 --- a/tests/parser/circuits/const_functions.leo +++ /dev/null @@ -1,23 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - x: u32 - const function x() { - return (); - } - const function x(self) { - return (); - } - const function c(const self) { - return (); - } - const function b(const self, x: u32) { - return (); - } - const function b(const self, const x: u32) { - return (); - } -} diff --git a/tests/parser/circuits/consts.leo b/tests/parser/circuits/consts.leo deleted file mode 100644 index e50b3829a7..0000000000 --- a/tests/parser/circuits/consts.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - static const x: u32 = 2; - static const y: u32 = 5; -} \ No newline at end of file diff --git a/tests/parser/circuits/empty.leo b/tests/parser/circuits/empty.leo deleted file mode 100644 index c4fc98fc3e..0000000000 --- a/tests/parser/circuits/empty.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - -} \ No newline at end of file diff --git a/tests/parser/circuits/field_and_functions.leo b/tests/parser/circuits/field_and_functions.leo deleted file mode 100644 index 99ce46e134..0000000000 --- a/tests/parser/circuits/field_and_functions.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - static const a: u8 = 10; - x: u32, - y: u32 - function x() { - return (); - } - function y() { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/fields.leo b/tests/parser/circuits/fields.leo deleted file mode 100644 index 1369166472..0000000000 --- a/tests/parser/circuits/fields.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - x: u32; - y: u32; -} \ No newline at end of file diff --git a/tests/parser/circuits/fields_fail.leo b/tests/parser/circuits/fields_fail.leo deleted file mode 100644 index 6ebc22b0b1..0000000000 --- a/tests/parser/circuits/fields_fail.leo +++ /dev/null @@ -1,15 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit X { - x: u32 - y: u32 -} - -circuit X { - x: u32, - y: u32; - , // recovery witness -} diff --git a/tests/parser/circuits/functions.leo b/tests/parser/circuits/functions.leo deleted file mode 100644 index 511bb48aa0..0000000000 --- a/tests/parser/circuits/functions.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x() { - return (); - } - function y() { - return (); - } - const function z() { - return (); - } -} diff --git a/tests/parser/circuits/mixed_order_fail.leo b/tests/parser/circuits/mixed_order_fail.leo deleted file mode 100644 index 7267cf0465..0000000000 --- a/tests/parser/circuits/mixed_order_fail.leo +++ /dev/null @@ -1,19 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit A { - function a() {} - const function z() {} - - foo: u8, - - static const BAR: u8 = 0u8; -} - -circuit B { - foo: u8, - - static const BAR: u8 = 0u8; -} diff --git a/tests/parser/circuits/mut_self_fail.leo b/tests/parser/circuits/mut_self_fail.leo deleted file mode 100644 index dff6af2db1..0000000000 --- a/tests/parser/circuits/mut_self_fail.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit X { - function x(mut self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/ref_self.leo b/tests/parser/circuits/ref_self.leo deleted file mode 100644 index 8e5c19f820..0000000000 --- a/tests/parser/circuits/ref_self.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x(&self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/self.leo b/tests/parser/circuits/self.leo deleted file mode 100644 index c99c4bea1c..0000000000 --- a/tests/parser/circuits/self.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -circuit X { - function x(self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/self_not_first_fail.leo b/tests/parser/circuits/self_not_first_fail.leo deleted file mode 100644 index 51ea2fc20e..0000000000 --- a/tests/parser/circuits/self_not_first_fail.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -circuit X { - function x(foo: u32, &self) { - return (); - } -} \ No newline at end of file diff --git a/tests/parser/circuits/struct_fail.leo b/tests/parser/circuits/struct_fail.leo deleted file mode 100644 index 582b508aab..0000000000 --- a/tests/parser/circuits/struct_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -struct A {} -circuit B {} -class C {} -circuit D {} diff --git a/tests/parser/expression/access/array_access.leo b/tests/parser/expression/access/array_access.leo deleted file mode 100644 index 14d2393afd..0000000000 --- a/tests/parser/expression/access/array_access.leo +++ /dev/null @@ -1,14 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x[0] -X[1] -x[0u8] -x[1u8][2u8] -x[x][y][z] -x[0]() -x()[0] -x(y)::y(x) -x[x].0[x] \ No newline at end of file diff --git a/tests/parser/expression/access/array_range_access.leo b/tests/parser/expression/access/array_range_access.leo deleted file mode 100644 index 4ae4f62c3f..0000000000 --- a/tests/parser/expression/access/array_range_access.leo +++ /dev/null @@ -1,22 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x[..] -x[1..] -x[..1] -x[1..1] -x[0..100] - -x[323452345.2345234523453453][323452345.2345234523453453] - -x[0u8..1u8] -x[0u8..] -x[..0u8] - -x[..] -x[x.y..] -x[..y.x] -x[x.y..y.x] -x[x.y.x..y.x.y] diff --git a/tests/parser/expression/access/call.leo b/tests/parser/expression/access/call.leo index 3a59b7585b..28d1d9e2ae 100644 --- a/tests/parser/expression/access/call.leo +++ b/tests/parser/expression/access/call.leo @@ -8,7 +8,3 @@ X() x(y) x(y, z) x(x, y, z) -x::y() -x::y(x) -x.0(x) -x[0](x) diff --git a/tests/parser/expression/access/circuit.leo b/tests/parser/expression/access/circuit.leo deleted file mode 100644 index ced0211988..0000000000 --- a/tests/parser/expression/access/circuit.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x.y -X.Y -x.y.z -x.y() -x.y.0 -x.y[1] \ No newline at end of file diff --git a/tests/parser/expression/access/circuit_static.leo b/tests/parser/expression/access/circuit_static.leo deleted file mode 100644 index cc9793c510..0000000000 --- a/tests/parser/expression/access/circuit_static.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x::y -X::Y -x::y::z -x::y() -x::y.0 -x::y[1] \ No newline at end of file diff --git a/tests/parser/expression/access/tuple.leo b/tests/parser/expression/access/tuple.leo deleted file mode 100644 index c96e38953f..0000000000 --- a/tests/parser/expression/access/tuple.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x.0 -x.1 -x.2 -x.0.0 -x.1.1 -x.2.2 \ No newline at end of file diff --git a/tests/parser/expression/array_init.leo b/tests/parser/expression/array_init.leo deleted file mode 100644 index 38826f66e7..0000000000 --- a/tests/parser/expression/array_init.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -[0u8; 1] - -[0; 1] - -[0; (1, 2)] - -[0; (1, 2,)] - -[0; (1, 2, 3)] - -[[[0; 3]; 2]; 1] diff --git a/tests/parser/expression/array_inline.leo b/tests/parser/expression/array_inline.leo deleted file mode 100644 index 5dc6746f17..0000000000 --- a/tests/parser/expression/array_inline.leo +++ /dev/null @@ -1,24 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -[0u8, 1, 2, 3] - -[1] - -[1u8] - -[1u8,] - -[0, 1,] - -[0,1,] - -[] - -[[1,2,3],[1,2,3]] - -[[]] - -[[], []] \ No newline at end of file diff --git a/tests/parser/expression/array_len.leo b/tests/parser/expression/array_len.leo deleted file mode 100644 index eb59228e67..0000000000 --- a/tests/parser/expression/array_len.leo +++ /dev/null @@ -1,14 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -[0u8; 1].len() - -[0; 1].len() - -[0; (1, 2)].len() - -[0; (1, 2, 3)].len() - -[[[0; 3]; 2]; 1].len() diff --git a/tests/parser/expression/binary/exp.leo b/tests/parser/expression/binary/exp.leo index 0bd2795265..8e04d92748 100644 --- a/tests/parser/expression/binary/exp.leo +++ b/tests/parser/expression/binary/exp.leo @@ -8,7 +8,3 @@ expectation: Pass 2**3 1 ** 2 ** 3 - -1 as i8 ** 3 as i8 - -1 as i8 ** 3 as i8 ** 5 as i8 \ No newline at end of file diff --git a/tests/parser/expression/cast.leo b/tests/parser/expression/cast.leo deleted file mode 100644 index 76809aa8b9..0000000000 --- a/tests/parser/expression/cast.leo +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x as u8 -y as id -z as u32 -x as i128 -x as u8 as u128 -x as field -x as group -x ** y as u32 ** z -// ~x as u32 -!x as u32 --x as u32 \ No newline at end of file diff --git a/tests/parser/expression/circuit_init.leo b/tests/parser/expression/circuit_init.leo deleted file mode 100644 index a6817977c2..0000000000 --- a/tests/parser/expression/circuit_init.leo +++ /dev/null @@ -1,22 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -x {} - -x {y} - -x{y} - -x{} - -x{y: y} - -x{y: x} - -x{y: x,} - -x{y:x, x:y,} - -Self {} diff --git a/tests/parser/expression/literal/access.leo b/tests/parser/expression/literal/access.leo deleted file mode 100644 index bb30728808..0000000000 --- a/tests/parser/expression/literal/access.leo +++ /dev/null @@ -1,51 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -// address -aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() -address::call() - -// bool -true.call() -bool::call() - -// char -'a'.call() -char::call() - -// field -1field.call() -field::call() - -//group -0group.call() -(0, 1)group.call() -group::call() - -// ints -1i8.call() -1i16.call() -1i32.call() -1i64.call() -1i128.call() - -i8::call() -i16::call() -i32::call() -i64::call() -i128::call() - -// uints -1u8.call() -1u16.call() -1u32.call() -1u64.call() -1u128.call() - -u8::call() -u16::call() -u32::call() -u64::call() -u128::call() \ No newline at end of file diff --git a/tests/parser/expression/literal/char_fail.leo b/tests/parser/expression/literal/char_fail.leo index 3a934152ab..fbd343b4e5 100644 --- a/tests/parser/expression/literal/char_fail.leo +++ b/tests/parser/expression/literal/char_fail.leo @@ -12,6 +12,7 @@ expectation: Fail '' +'\x '\x7' '\xz' '\x9A' @@ -51,6 +52,7 @@ expectation: Fail '\u00000000' '\u01000000' '\u{110000}' +'\u{1234567890}' '\u{bbbbb}\u{aaaa}' '😭😂😘' diff --git a/tests/parser/expression/token_format.leo b/tests/parser/expression/token_format.leo new file mode 100644 index 0000000000..e9afe3cde6 --- /dev/null +++ b/tests/parser/expression/token_format.leo @@ -0,0 +1,148 @@ +/* +namespace: ParseExpression +expectation: Fail +*/ + +"test" ~ + +u32 ~ + +1 ~ + +true ~ + +false ~ + +aleo13jgjyzhzhvrqecjct7scsjrfsfn09j9vryung8mfykt5502p75rsx7l9lr ~ + +'h' ~ + +@test + +!1 ~ + +&& + +|| + +== + +!= + +< + +<= + +> + +>= + ++ + +- + +* + +** + +/ + += + ++= + +-= + +*= + +/= + +**= + +( + +) + +[ + +] + +{ + +} + +, + +. + +.. + +... + +; + +: + +h:: + +? + +-> + +_ + +u8 ~ + +u16 ~ + +u32 ~ + +u64 ~ + +u128 ~ + +i8 ~ + +i16 ~ + +i32 ~ + +i64 ~ + +i128 ~ + +field ~ + +group ~ + +bool ~ + +address ~ + +char ~ + +input ~ + +console + +const + +else + +for + +function + +if + +in + +let + +mut + +& + +return + +type \ No newline at end of file diff --git a/tests/parser/expression/tuple.leo b/tests/parser/expression/tuple.leo deleted file mode 100644 index abfcab0999..0000000000 --- a/tests/parser/expression/tuple.leo +++ /dev/null @@ -1,19 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -//not tuples -(x) -(y) -(z) - -//tuples -(x,) -(x,y) -(x,y,z) -(123,123) - -() - -(()) \ No newline at end of file diff --git a/tests/parser/expression/unary/negate.leo b/tests/parser/expression/unary/negate.leo index 035a0c3c26..39438fca2f 100644 --- a/tests/parser/expression/unary/negate.leo +++ b/tests/parser/expression/unary/negate.leo @@ -4,8 +4,6 @@ expectation: Pass */ -x --x.y --x::y -x() --x -!x diff --git a/tests/parser/expression/unary/not.leo b/tests/parser/expression/unary/not.leo index 5ad9c3b5d3..db83e523bd 100644 --- a/tests/parser/expression/unary/not.leo +++ b/tests/parser/expression/unary/not.leo @@ -4,8 +4,6 @@ expectation: Pass */ !x -!x.y -!x::y !x() !!x !-x \ No newline at end of file diff --git a/tests/parser/functions/annotated.leo b/tests/parser/functions/annotated.leo deleted file mode 100644 index 56568b959a..0000000000 --- a/tests/parser/functions/annotated.leo +++ /dev/null @@ -1,24 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -@test -function a() { - return (); -} - -@test(test) -function b() { - return (); -} - -@test(test,) -function c() { - return (); -} - -@test() -function d() { - return (); -} diff --git a/tests/parser/functions/annotated_param.leo b/tests/parser/functions/annotated_param.leo deleted file mode 100644 index 65a16b3894..0000000000 --- a/tests/parser/functions/annotated_param.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -@test(test) -function x() { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/annotated_twice.leo b/tests/parser/functions/annotated_twice.leo deleted file mode 100644 index b969c4df35..0000000000 --- a/tests/parser/functions/annotated_twice.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -@test @test2 -function x() { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/const_function.leo b/tests/parser/functions/const_function.leo index fd8703b9fc..d65dc46c1a 100644 --- a/tests/parser/functions/const_function.leo +++ b/tests/parser/functions/const_function.leo @@ -4,5 +4,5 @@ expectation: Pass */ const function x() { - return (); + return 0; } diff --git a/tests/parser/functions/const_param.leo b/tests/parser/functions/const_param.leo index 3fbe5dfdba..a69f08e3d7 100644 --- a/tests/parser/functions/const_param.leo +++ b/tests/parser/functions/const_param.leo @@ -4,9 +4,9 @@ expectation: Pass */ function x(x: u32, const y: i32) { - return (); + return 0; } function x(const x: u32, y: i32) { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/const_self_bad.leo b/tests/parser/functions/const_self_bad.leo deleted file mode 100644 index 281dbab043..0000000000 --- a/tests/parser/functions/const_self_bad.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(const self) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/empty.leo b/tests/parser/functions/empty.leo deleted file mode 100644 index 0c463ae036..0000000000 --- a/tests/parser/functions/empty.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x() { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/ident_token_fail.leo b/tests/parser/functions/ident_token_fail.leo new file mode 100644 index 0000000000..edc97cfa61 --- /dev/null +++ b/tests/parser/functions/ident_token_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Fail +*/ + +1 main() {} \ No newline at end of file diff --git a/tests/parser/functions/mut_input_fail.leo b/tests/parser/functions/mut_input_fail.leo new file mode 100644 index 0000000000..94d4a16005 --- /dev/null +++ b/tests/parser/functions/mut_input_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Fail +*/ + +function f(mut a: u8) {} \ No newline at end of file diff --git a/tests/parser/functions/param_array.leo b/tests/parser/functions/param_array.leo deleted file mode 100644 index 36e5bbb930..0000000000 --- a/tests/parser/functions/param_array.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(x: [u8; 12]) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/param_circuit.leo b/tests/parser/functions/param_circuit.leo deleted file mode 100644 index dbffe0608c..0000000000 --- a/tests/parser/functions/param_circuit.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(x: MyCircuit) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/param_tuple.leo b/tests/parser/functions/param_tuple.leo deleted file mode 100644 index 80d9c202f9..0000000000 --- a/tests/parser/functions/param_tuple.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(x: (u32, i32)) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/params.leo b/tests/parser/functions/params.leo index e42363568c..9392a2784b 100644 --- a/tests/parser/functions/params.leo +++ b/tests/parser/functions/params.leo @@ -4,5 +4,5 @@ expectation: Pass */ function x(x: u32, y: i32) { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/params_return.leo b/tests/parser/functions/params_return.leo index d1f2b434fd..ed61c09ad3 100644 --- a/tests/parser/functions/params_return.leo +++ b/tests/parser/functions/params_return.leo @@ -4,5 +4,5 @@ expectation: Pass */ function x(x: u32, y: i32) -> u32 { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/return.leo b/tests/parser/functions/return.leo index ccf8dee32b..1a78e8d5ef 100644 --- a/tests/parser/functions/return.leo +++ b/tests/parser/functions/return.leo @@ -4,5 +4,5 @@ expectation: Pass */ function x() -> u32 { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/functions/return_tuple.leo b/tests/parser/functions/return_tuple.leo deleted file mode 100644 index 618ddec00d..0000000000 --- a/tests/parser/functions/return_tuple.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x() -> (u32, u32) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/test_keyword_fail.leo b/tests/parser/functions/test_keyword_fail.leo new file mode 100644 index 0000000000..5e31c6a528 --- /dev/null +++ b/tests/parser/functions/test_keyword_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Parse +expectation: Fail +*/ + +test main() {} \ No newline at end of file diff --git a/tests/parser/inputs/input_fail.leo b/tests/parser/inputs/input_fail.leo new file mode 100644 index 0000000000..f678affff7 --- /dev/null +++ b/tests/parser/inputs/input_fail.leo @@ -0,0 +1,6 @@ +/* +namespace: Input +expectation: Fail +*/ + +main \ No newline at end of file diff --git a/tests/parser/inputs/input_success.leo b/tests/parser/inputs/input_success.leo index fae8348174..ed24602a59 100644 --- a/tests/parser/inputs/input_success.leo +++ b/tests/parser/inputs/input_success.leo @@ -9,9 +9,6 @@ b: u8 = 2; c: field = 0; d: group = (0, 1)group; e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -f: [u8; 32] = [0; 32]; -g: [[u8; 2]; 3] = [[0; 2]; 3]; -h: (bool, bool) = (true, false); [registers] r0: bool = true; @@ -19,9 +16,6 @@ r1: u8 = 2; r2: field = 0; r3: group = (0, 1)group; r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -r5: [u8; 32] = [0; 32]; -r6: [[u8; 2]; 3] = [[0; 2]; 3]; -r7: (bool, bool) = (true, false); [constants] c0: bool = true; @@ -29,6 +23,3 @@ c1: u8 = 2; c2: field = 0; c3: group = (0, 1)group; c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; -c5: [u8; 32] = [0; 32]; -c6: [[u8; 2]; 3] = [[0; 2]; 3]; -c7: (bool, bool) = (true, false); diff --git a/tests/parser/serialize/linear_regression.leo b/tests/parser/serialize/linear_regression.leo deleted file mode 100644 index b64dd2cbac..0000000000 --- a/tests/parser/serialize/linear_regression.leo +++ /dev/null @@ -1,70 +0,0 @@ -/* -namespace: Serialize -expectation: Pass -*/ - -circuit Point { - x: i32, - y: i32, - - function new(x: i32, y: i32) -> Self { - return Self { x, y }; - } -} - -circuit LinearRegression { - points: [Point; 5], - - // Instantiates a linear regression circuit. - function new(points: [Point; 5]) -> Self { - return Self { points }; - } - - // Return the slope of the linear regression. - function slope(self) -> i32 { - - let num_points = 5i32; - // Calculate the sums. - let x_sum = 0i32; - let y_sum = 0i32; - let xy_sum = 0i32; - let x2_sum = 0i32; - for i in 0..5 { - x_sum += self.points[i].x; - y_sum += self.points[i].y; - xy_sum += self.points[i].x * self.points[i].y; - x2_sum += self.points[i].x * self.points[i].x; - } - let numerator = (num_points * xy_sum) - (x_sum * y_sum); - let denominator = (num_points * x2_sum) - (x_sum * x_sum); - let slope = numerator / denominator; - return slope; - } - // Return the offset of the linear regression. - function offset(self, slope: i32) -> i32 { - let num_points = 5i32; - // Calculate the sum. - let x_sum = 0i32; - let y_sum = 0i32; - for i in 0..5 { - x_sum += self.points[i].x; - y_sum += self.points[i].y; - } - return (y_sum - slope * x_sum) / num_points; - } -} - - -function main (x: i32, y: i32) -> [i32; 2] { - let points: [Point; 5] = [ - Point{x: x + 1, y: y + 1}, - Point{x: x + 2, y: y + 2}, - Point{x: x + 3, y: y + 3}, - Point{x: x + 4, y: y + 4}, - Point{x: x + 5, y: y + 5} - ]; - let reg = LinearRegression::new(points); - let slope = reg.slope(); - let offset = reg.offset(slope); - return [slope, offset]; -} diff --git a/tests/parser/serialize/palindrome.leo b/tests/parser/serialize/palindrome.leo deleted file mode 100644 index ebc9bb7e11..0000000000 --- a/tests/parser/serialize/palindrome.leo +++ /dev/null @@ -1,64 +0,0 @@ -/* -namespace: Serialize -expectation: Pass -*/ - -// This Program takes in any 20-byte low register string and tells -// whether a string is a palindrome ignoring any spaces. - -function main(str: [char; 20]) -> bool { - return is_palindrome(str); -} - -function is_palindrome(str: [char; 20]) -> bool { - const str_len = 20u32; // saving const for convenience - - // By default we assume that input is a palindrome. - let result = true; - let processed = 0u8; - - for start in 0..(str_len / 2) { - let start_sym = str[start]; - if start_sym != ' ' { - let skipped = 0u8; - let end_empty = 0u8; - let end_sym = ' '; - - for end in (str_len - 1)..start { - if str[end] != ' ' && skipped == processed && end_sym == ' ' { - end_sym = str[end]; - } else { - end_empty = end_empty + 1; - if str[end] != ' ' { - skipped = skipped + 1; - } - } - } - - // If there are symbols left to the right from the start. - if end_sym != ' ' { - console.log("Comparing: {} ? {}", start_sym, end_sym); - - if result { - result = (start_sym == end_sym); - } - - processed = processed + 1; - } - } - } - - console.log("Result is: {}", result); - - return result; -} - -@test -function test_is_palindrome() { - console.assert(is_palindrome("a b a ")); - console.assert(is_palindrome("😀😀😀😀😀 😀😀😀😀😀")); - console.assert(is_palindrome("borrow or rob ")); - console.assert(is_palindrome("bbbb aaaa aaaa bbbb")); - console.assert(is_palindrome("aaaaaaaaaaaaaaaaaaaa")); - console.assert(is_palindrome("taco cat ")); -} diff --git a/tests/parser/serialize/pedersen_hash.leo b/tests/parser/serialize/pedersen_hash.leo deleted file mode 100644 index b8520a9be4..0000000000 --- a/tests/parser/serialize/pedersen_hash.leo +++ /dev/null @@ -1,30 +0,0 @@ -/* -namespace: Serialize -expectation: Pass -*/ - -circuit PedersenHash { - parameters: [group; 256]; - - // Instantiates a Pedersen hash circuit - function new(parameters: [group; 256]) -> Self { - return Self { parameters: parameters }; - } - - function hash(self, bits: [bool; 256]) -> group { - let digest: group = 0group; - for i in 0..256 { - if bits[i] { - digest += self.parameters[i]; - } - } - return digest; - } -} - -// The 'pedersen-hash' main function. -function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { - const pedersen = PedersenHash::new(parameters); - return pedersen.hash(hash_input); -} - diff --git a/tests/parser/statement/assign.leo b/tests/parser/statement/assign.leo index e5587ae045..6d368cc6fd 100644 --- a/tests/parser/statement/assign.leo +++ b/tests/parser/statement/assign.leo @@ -5,186 +5,34 @@ expectation: Pass x = expr; -x = (); - x = x+y; -x = (x,y); - x = x(); - -x[0] = y; - -x[0u32] = y; - -x.0 = y; - -x[1..2] = y; - -x[..2] = y; - -x[2..] = y; - -x[..] = y; - -x.0[0][..] = y; - -x.y = y; - -x.0.y[0].1.y[..][0][1..5][0..3] = y; - - - x += expr; -x += (); - x += x+y; x += x(); - -x[0] += y; - -x[0u32] += y; - -x.0 += y; - -x[1..2][0] += y; - -x[..2][0] += y; - -x[2..][0] += y; - -x[..][0] += y; - -x.0[0][..][0] += y; - -x.y += y; - -x.0.y[0].1.y[..][0][1..5][0..3][0] += y; - - - x -= expr; -x -= (); - x -= x+y; x -= x(); - -x[0] -= y; - -x[0u32] -= y; - -x.0 -= y; - -x[1..2][0] -= y; - -x[..2][0] -= y; - -x[2..][0] -= y; - -x[..][0] -= y; - -x.0[0][..][0] -= y; - -x.y -= y; - -x.0.y[0].1.y[..][0][1..5][0..3][0] -= y; - - - x *= expr; -x *= (); - x *= x+y; x *= x(); - -x[0] *= y; - -x[0u32] *= y; - -x.0 *= y; - -x[1..2][0] *= y; - -x[..2][0] *= y; - -x[2..][0] *= y; - -x[..][0] *= y; - -x.0[0][..][0] *= y; - -x.y *= y; - -x.0.y[0].1.y[..][0][1..5][0..3][0] *= y; - - - x /= expr; -x /= (); - x /= x+y; x /= x(); - -x[0] /= y; - -x[0u32] /= y; - -x.0 /= y; - -x[1..2][0] /= y; - -x[..2][0] /= y; - -x[2..][0] /= y; - -x[..][0] /= y; - -x.0[0][..][0] /= y; - -x.y /= y; - -x.0.y[0].1.y[..][0][1..5][0..3][0] /= y; - - - x **= expr; -x **= (); - x **= x+y; - -x **= x(); - - -x[0] *= y; - -x[0u32] *= y; - -x.0 **= y; - -x[1..2][0] **= y; - -x[..2][0] **= y; - -x[2..][0] **= y; - -x[..][0] **= y; - -x.0[0][..][0] **= y; - -x.y **= y; - -x.0.y[0].1.y[..][0][1..5][0..3][0] **= y; \ No newline at end of file diff --git a/tests/parser/statement/block.leo b/tests/parser/statement/block.leo index 307cc6928d..199b47cbc4 100644 --- a/tests/parser/statement/block.leo +++ b/tests/parser/statement/block.leo @@ -6,20 +6,20 @@ expectation: Pass {} { - return (); + return 0; } {{}} { { - return (); + return 0; } } { if x { - return (); + return 0; } } diff --git a/tests/parser/statement/conditional.leo b/tests/parser/statement/conditional.leo index 62a9e7f54e..6740174fbd 100644 --- a/tests/parser/statement/conditional.leo +++ b/tests/parser/statement/conditional.leo @@ -4,15 +4,11 @@ expectation: Pass */ if x { - return (); -} - -if Self { - return (); + return 0; } if (x) { - return (); + return 0; } if (x) {} else {} @@ -21,5 +17,5 @@ if x+y {} else if x+z {} else {} if x+y { expr; - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/statement/definition.leo b/tests/parser/statement/definition.leo index 1e10103111..598cec9594 100644 --- a/tests/parser/statement/definition.leo +++ b/tests/parser/statement/definition.leo @@ -5,45 +5,29 @@ expectation: Pass let x = expr; -let x = (); - let x = x+y; -let x = (x,y); - let x = x(); const x = expr; -const x = (); - const x = x+y; -const x = (x,y); - const x = x(); let x: u32 = expr; -let x: u32 = (); - let x: u32 = x+y; -let x: u32 = (x,y); - let x: u32 = x(); const x: u32 = expr; -const x: u32 = (); - const x: u32 = x+y; -const x: u32 = (x,y); - const x: u32 = x(); @@ -53,53 +37,29 @@ const x: u32 = x(); let (x, y) = expr; -let (x, y) = (); - let (x, y) = x+y; -let (x, y) = (x,y); - let (x, y) = x(); const (x, y) = expr; -const (x, y) = (); - const (x, y) = x+y; -const (x, y) = (x,y); - const (x, y) = x(); let (x, y): u32 = expr; -let (x, y): u32 = (); - let (x, y): u32 = x+y; -let (x, y): u32 = (x,y); - let (x, y): u32 = x(); const (x, y): u32 = expr; -const (x, y): u32 = (); - const (x, y): u32 = x+y; -const (x, y): u32 = (x,y); - const (x, y): u32 = x(); - -let (x,y,) = (); - -let x: [[u8; 2]; 2] = [[0,0], [0,0]]; - -let x: [u8; (2, 2)] = [[0,0], [0,0]]; - - let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53; diff --git a/tests/parser/statement/expression.leo b/tests/parser/statement/expression.leo index cc63041b00..1a5b3b1fe1 100644 --- a/tests/parser/statement/expression.leo +++ b/tests/parser/statement/expression.leo @@ -5,10 +5,6 @@ expectation: Pass expr; -(); - x+y; -(x,y); - x(); \ No newline at end of file diff --git a/tests/parser/statement/iteration.leo b/tests/parser/statement/iteration.leo index 79850fa6b9..506110850c 100644 --- a/tests/parser/statement/iteration.leo +++ b/tests/parser/statement/iteration.leo @@ -6,13 +6,13 @@ expectation: Pass for x in 0..7 {} for x in 0..7 { - return (); + return 0; } for x in 0..99u8 { - return (); + return 0; } for x in 0..Self { - return (); + return 0; } \ No newline at end of file diff --git a/tests/parser/statement/return.leo b/tests/parser/statement/return.leo index e3e835c5df..9451b67f16 100644 --- a/tests/parser/statement/return.leo +++ b/tests/parser/statement/return.leo @@ -5,13 +5,5 @@ expectation: Pass return expr; -return (); - -return (); - -return x+y; - -return (x,y); - return 5; \ No newline at end of file diff --git a/tests/parser/unreachable/math_op_pass.leo b/tests/parser/unreachable/math_op_pass.leo index e1cc3051c8..48e55ffb5b 100644 --- a/tests/parser/unreachable/math_op_pass.leo +++ b/tests/parser/unreachable/math_op_pass.leo @@ -3,9 +3,6 @@ namespace: ParseStatement expectation: Pass */ -let x = a . b; - -let x = a :: b; let x = a == b; @@ -21,10 +18,6 @@ let x = a <= b; let x = a > b; -let x = a as b; - -ximport=b; - x_=b; x==b; @@ -37,8 +30,6 @@ x<=b; x>=b; -xas=b; - xconsole=b; xconst=b; @@ -73,10 +64,6 @@ xu128=b; xreturn=b; -xself=b; - -xSelf=b; - xtrue=b; xfalse=b;