From d0a21ff5a36dc1abe9f23643e568d07812e8fc75 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 30 Jun 2021 17:48:48 +0300 Subject: [PATCH 01/62] draft. adds dependency section to Leo.toml --- leo/commands/install.rs | 62 ++++++++++++++++++++++++++++++++++++ leo/commands/mod.rs | 3 ++ leo/main.rs | 8 +++++ package/src/root/manifest.rs | 14 ++++++++ 4 files changed, 87 insertions(+) create mode 100644 leo/commands/install.rs diff --git a/leo/commands/install.rs b/leo/commands/install.rs new file mode 100644 index 0000000000..cf19ba55bd --- /dev/null +++ b/leo/commands/install.rs @@ -0,0 +1,62 @@ +// Copyright (C) 2019-2021 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::{commands::Command, context::Context}; + +use anyhow::{anyhow, Result}; +use structopt::StructOpt; +use tracing::span::Span; + +/// Install dependencies Leo code command +#[derive(StructOpt, Debug)] +#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)] +pub struct Install {} + +impl Command for Install { + type Input = (); + type Output = (); + + fn log_span(&self) -> Span { + tracing::span!(tracing::Level::INFO, "Installing") + } + + fn prelude(&self, _: Context) -> Result { + Ok(()) + } + + fn apply(self, context: Context, _: Self::Input) -> Result { + let deps = context + .manifest()? + .get_package_dependencies() + .ok_or_else(|| anyhow!("Package has no dependencies"))?; + + use crate::commands::package::Add; + + for (_name, dep) in deps.iter() { + Add::new( + None, + Some(dep.author.clone()), + Some(dep.name.clone()), + Some(dep.version.clone()), + ) + .execute(context.clone())?; + } + + dbg!(deps); + + Ok(()) + } +} diff --git a/leo/commands/mod.rs b/leo/commands/mod.rs index 7f5f2349fb..0616a3aaea 100644 --- a/leo/commands/mod.rs +++ b/leo/commands/mod.rs @@ -33,6 +33,9 @@ pub use deploy::Deploy; pub mod init; pub use init::Init; +pub mod install; +pub use install::Install; + pub mod lint; pub use lint::Lint; diff --git a/leo/main.rs b/leo/main.rs index 7d92f4f087..cbcca7661b 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -28,6 +28,7 @@ use commands::{ Command, Deploy, Init, + Install, Lint, New, Prove, @@ -137,6 +138,12 @@ enum CommandOpts { command: Add, }, + #[structopt(about = "Install dependencies for this program")] + Install { + #[structopt(flatten)] + command: Install, + }, + #[structopt(about = "Clone a package from the Aleo Package Manager")] Clone { #[structopt(flatten)] @@ -214,6 +221,7 @@ fn run_with_args(opt: Opt) -> Result<(), Error> { CommandOpts::Update { command } => command.try_execute(context), CommandOpts::Add { command } => command.try_execute(context), + CommandOpts::Install { command } => command.try_execute(context), CommandOpts::Clone { command } => command.try_execute(context), CommandOpts::Login { command } => command.try_execute(context), CommandOpts::Logout { command } => command.try_execute(context), diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 9167f402bb..9e998a7547 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -19,6 +19,7 @@ use crate::{errors::ManifestError, package::Package}; use serde::Deserialize; use std::{ borrow::Cow, + collections::HashMap, convert::TryFrom, fs::File, io::{Read, Write}, @@ -33,10 +34,18 @@ pub struct Remote { pub author: String, } +#[derive(Clone, Debug, Deserialize)] +pub struct Dependency { + pub author: String, + pub version: String, + pub name: String, +} + #[derive(Deserialize)] pub struct Manifest { pub project: Package, pub remote: Option, + pub dependencies: Option>, } impl Manifest { @@ -44,6 +53,7 @@ impl Manifest { Ok(Self { project: Package::new(package_name)?, remote: author.map(|author| Remote { author }), + dependencies: Some(HashMap::::new()), }) } @@ -71,6 +81,10 @@ impl Manifest { self.project.description.clone() } + pub fn get_package_dependencies(&self) -> Option> { + self.dependencies.clone() + } + pub fn get_package_license(&self) -> Option { self.project.license.clone() } From bbc210d01684063d5178b0c7e4e94de612fb255d Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 7 Jul 2021 17:15:03 +0300 Subject: [PATCH 02/62] imports map, leo install --- compiler/src/compiler.rs | 11 ++++++++++- compiler/tests/mod.rs | 12 ++++++++++-- compiler/tests/test.rs | 15 +++++++++++++-- imports/src/parser/import_parser.rs | 9 +++++---- imports/src/parser/parse_package.rs | 15 ++++++++++++--- leo/commands/build.rs | 9 ++++++++- leo/commands/mod.rs | 3 --- leo/commands/package/add.rs | 13 ++++++++++--- leo/commands/{ => package}/install.rs | 11 +++++------ leo/commands/package/mod.rs | 3 +++ leo/commands/test.rs | 1 + leo/main.rs | 3 +-- package/src/root/manifest.rs | 23 ++++++++++++++++++++++- 13 files changed, 100 insertions(+), 28 deletions(-) rename leo/commands/{ => package}/install.rs (91%) diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 82de5ab734..1649be02b2 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -28,6 +28,7 @@ use crate::{ pub use leo_asg::{new_context, AsgContext as Context, AsgContext}; use leo_asg::{Asg, AsgPass, FormattedError, Program as AsgProgram}; use leo_ast::{Input, MainInput, Program as AstProgram}; +use leo_imports::ImportParser; use leo_input::LeoInputParser; use leo_package::inputs::InputPairs; use leo_parser::parse_ast; @@ -39,6 +40,7 @@ use snarkvm_r1cs::{ConstraintSynthesizer, ConstraintSystem, SynthesisError}; use sha2::{Digest, Sha256}; use std::{ + collections::HashMap, fs, marker::PhantomData, path::{Path, PathBuf}, @@ -68,6 +70,7 @@ pub struct Compiler<'a, F: PrimeField, G: GroupType> { asg: Option>, options: CompilerOptions, proof_options: TheoremOptions, + imports_map: HashMap, _engine: PhantomData, _group: PhantomData, } @@ -83,6 +86,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { context: AsgContext<'a>, options: Option, proof_options: Option, + imports_map: HashMap, ) -> Self { Self { program_name: package_name.clone(), @@ -94,6 +98,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { context, options: options.unwrap_or_default(), proof_options: proof_options.unwrap_or_default(), + imports_map, _engine: PhantomData, _group: PhantomData, } @@ -113,6 +118,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { context: AsgContext<'a>, options: Option, proof_options: Option, + imports_map: HashMap, ) -> Result { let mut compiler = Self::new( package_name, @@ -121,6 +127,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { context, options, proof_options, + imports_map, ); compiler.parse_program()?; @@ -152,6 +159,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { context: AsgContext<'a>, options: Option, proof_options: Option, + imports_map: HashMap, ) -> Result { let mut compiler = Self::new( package_name, @@ -160,6 +168,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { context, options, proof_options, + imports_map, ); compiler.parse_input(input_string, input_path, state_string, state_path)?; @@ -263,7 +272,7 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { let asg = Asg::new( self.context, &self.program, - &mut leo_imports::ImportParser::new(self.main_file_path.clone()), + &mut ImportParser::new(self.main_file_path.clone(), self.imports_map.clone()), )?; if self.proof_options.type_inferenced { diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs index b488ea9f00..cf83a42034 100644 --- a/compiler/tests/mod.rs +++ b/compiler/tests/mod.rs @@ -33,7 +33,7 @@ use leo_compiler::{ use snarkvm_curves::edwards_bls12::Fq; use snarkvm_r1cs::TestConstraintSystem; -use std::path::PathBuf; +use std::{collections::HashMap, path::PathBuf}; pub const TEST_OUTPUT_DIRECTORY: &str = "/output/"; const EMPTY_FILE: &str = ""; @@ -52,7 +52,15 @@ fn new_compiler() -> EdwardsTestCompiler { let path = PathBuf::from("/test/src/main.leo"); let output_dir = PathBuf::from(TEST_OUTPUT_DIRECTORY); - EdwardsTestCompiler::new(program_name, path, output_dir, make_test_context(), None, None) + EdwardsTestCompiler::new( + program_name, + path, + output_dir, + make_test_context(), + None, + None, + HashMap::new(), + ) } pub(crate) fn parse_program(program_string: &str) -> Result { diff --git a/compiler/tests/test.rs b/compiler/tests/test.rs index d699321ad5..7262412575 100644 --- a/compiler/tests/test.rs +++ b/compiler/tests/test.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use std::path::{Path, PathBuf}; +use std::{ + collections::HashMap, + path::{Path, PathBuf}, +}; use leo_asg::*; use leo_synthesizer::{CircuitSynthesizer, SerializedCircuit, SummarizedCircuit}; @@ -40,7 +43,15 @@ fn new_compiler(path: PathBuf) -> EdwardsTestCompiler { let program_name = "test".to_string(); let output_dir = PathBuf::from("/output/"); - EdwardsTestCompiler::new(program_name, path, output_dir, make_test_context(), None, None) + EdwardsTestCompiler::new( + program_name, + path, + output_dir, + make_test_context(), + None, + None, + HashMap::new(), + ) } pub(crate) fn parse_program(program_string: &str) -> Result { diff --git a/imports/src/parser/import_parser.rs b/imports/src/parser/import_parser.rs index c8fcfdf43a..51cf3392dc 100644 --- a/imports/src/parser/import_parser.rs +++ b/imports/src/parser/import_parser.rs @@ -18,7 +18,7 @@ use crate::errors::ImportParserError; use leo_asg::{AsgContext, AsgConvertError, ImportResolver, Program, Span}; use indexmap::{IndexMap, IndexSet}; -use std::path::PathBuf; +use std::{collections::HashMap, path::PathBuf}; /// Stores imported packages. /// @@ -29,14 +29,16 @@ pub struct ImportParser<'a> { program_path: PathBuf, partial_imports: IndexSet, imports: IndexMap>, + pub imports_map: HashMap, } impl<'a> ImportParser<'a> { - pub fn new(program_path: PathBuf) -> Self { + pub fn new(program_path: PathBuf, imports_map: HashMap) -> Self { ImportParser { program_path, partial_imports: Default::default(), imports: Default::default(), + imports_map, } } } @@ -55,9 +57,8 @@ impl<'a> ImportResolver<'a> for ImportParser<'a> { if let Some(program) = self.imports.get(&full_path) { return Ok(Some(program.clone())); } - let mut imports = Self::default(); let path = self.program_path.clone(); - + let mut imports = self.clone(); // Self::default() was previously self.partial_imports.insert(full_path.clone()); let program = imports .parse_package(context, path, package_segments, span) diff --git a/imports/src/parser/parse_package.rs b/imports/src/parser/parse_package.rs index a14f12a2cc..a8b3a65d11 100644 --- a/imports/src/parser/parse_package.rs +++ b/imports/src/parser/parse_package.rs @@ -103,21 +103,30 @@ impl<'a> ImportParser<'a> { .collect::, std::io::Error>>() .map_err(|error| ImportParserError::directory_error(error, span, &error_path))?; + // Keeping backward compatibilty for existing packages. + // If index_map contains key, use it or try to access directly. + // TODO: Remove when migration is possible. + let package_name = self + .imports_map + .get(package_name) + .unwrap_or(&package_name.to_string()) + .clone(); + // Check if the imported package name is in the imports directory. let matched_import_entry = entries .into_iter() - .find(|entry| entry.file_name().into_string().unwrap().eq(package_name)); + .find(|entry| entry.file_name().into_string().unwrap().eq(&package_name)); // Check if the package name was found in both the source and imports directory. match (matched_source_entry, matched_import_entry) { (Some(_), Some(_)) => Err(ImportParserError::conflicting_imports(Identifier::new_with_span( - package_name, + &package_name, span.clone(), ))), (Some(source_entry), None) => self.parse_package_access(context, &source_entry, &segments[1..], span), (None, Some(import_entry)) => self.parse_package_access(context, &import_entry, &segments[1..], span), (None, None) => Err(ImportParserError::unknown_package(Identifier::new_with_span( - package_name, + &package_name, span.clone(), ))), } diff --git a/leo/commands/build.rs b/leo/commands/build.rs index ef701b4d87..ec2326a300 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -34,6 +34,8 @@ use snarkvm_r1cs::ConstraintSystem; use structopt::StructOpt; use tracing::span::Span; +use std::collections::HashMap; + /// Compiler Options wrapper for Build command. Also used by other commands which /// require Build command output as their input. #[derive(StructOpt, Clone, Debug)] @@ -126,7 +128,11 @@ impl Command for Build { fn apply(self, context: Context, _: Self::Input) -> Result { let path = context.dir()?; - let package_name = context.manifest()?.get_package_name(); + let manifest = context + .manifest() + .map_err(|_| anyhow!("Package manifest not found, try running `leo init`"))?; + let package_name = manifest.get_package_name(); + let imports_map = manifest.get_imports_map().unwrap_or(HashMap::new()); // Sanitize the package path to the root directory. let mut package_path = path.clone(); @@ -174,6 +180,7 @@ impl Command for Build { thread_leaked_context(), Some(self.compiler_options.clone().into()), Some(self.compiler_options.into()), + imports_map, )?; // Compute the current program checksum diff --git a/leo/commands/mod.rs b/leo/commands/mod.rs index 0616a3aaea..7f5f2349fb 100644 --- a/leo/commands/mod.rs +++ b/leo/commands/mod.rs @@ -33,9 +33,6 @@ pub use deploy::Deploy; pub mod init; pub use init::Init; -pub mod install; -pub use install::Install; - pub mod lint; pub use lint::Lint; diff --git a/leo/commands/package/add.rs b/leo/commands/package/add.rs index 5b540617ba..4d070b7e2c 100644 --- a/leo/commands/package/add.rs +++ b/leo/commands/package/add.rs @@ -101,9 +101,9 @@ impl Command for Add { // Attempt to fetch the package. let reader = { let fetch = Fetch { - author, + author: author.clone(), package_name: package_name.clone(), - version: self.version, + version: self.version.clone(), }; let bytes = context.api.run_route(fetch)?.bytes()?; std::io::Cursor::new(bytes) @@ -114,7 +114,14 @@ impl Command for Add { { ImportsDirectory::create(&path)?; path.push(IMPORTS_DIRECTORY_NAME); - path.push(package_name); + + // Dumb compatibility hack. + // TODO: Remove once `leo add` functionality is discussed. + if self.version.is_some() { + path.push(format!("{}-{}@{}", author, package_name, self.version.unwrap())); + } else { + path.push(package_name); + } create_dir_all(&path)?; }; diff --git a/leo/commands/install.rs b/leo/commands/package/install.rs similarity index 91% rename from leo/commands/install.rs rename to leo/commands/package/install.rs index cf19ba55bd..f1e50cd344 100644 --- a/leo/commands/install.rs +++ b/leo/commands/package/install.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::{ + commands::{package::Add, Command}, + context::Context, +}; use anyhow::{anyhow, Result}; use structopt::StructOpt; @@ -43,20 +46,16 @@ impl Command for Install { .get_package_dependencies() .ok_or_else(|| anyhow!("Package has no dependencies"))?; - use crate::commands::package::Add; - for (_name, dep) in deps.iter() { Add::new( None, Some(dep.author.clone()), - Some(dep.name.clone()), + Some(dep.package.clone()), Some(dep.version.clone()), ) .execute(context.clone())?; } - dbg!(deps); - Ok(()) } } diff --git a/leo/commands/package/mod.rs b/leo/commands/package/mod.rs index ce8c637f59..434b9dbd47 100644 --- a/leo/commands/package/mod.rs +++ b/leo/commands/package/mod.rs @@ -20,6 +20,9 @@ pub use add::Add; pub mod clone; pub use clone::Clone; +pub mod install; +pub use install::Install; + pub mod login; pub use login::Login; diff --git a/leo/commands/test.rs b/leo/commands/test.rs index 3de2c52715..6b97e737b2 100644 --- a/leo/commands/test.rs +++ b/leo/commands/test.rs @@ -113,6 +113,7 @@ impl Command for Test { thread_leaked_context(), Some(self.compiler_options.clone().into()), Some(self.compiler_options.clone().into()), + std::collections::HashMap::new(), )?; let temporary_program = program; diff --git a/leo/main.rs b/leo/main.rs index 88711724ef..062ca3b9c6 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -22,13 +22,12 @@ pub mod logger; pub mod updater; use commands::{ - package::{Add, Clone, Login, Logout, Publish, Remove}, + package::{Add, Clone, Install, Login, Logout, Publish, Remove}, Build, Clean, Command, Deploy, Init, - Install, Lint, New, Prove, diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 9e998a7547..017eb5bc4f 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -38,7 +38,7 @@ pub struct Remote { pub struct Dependency { pub author: String, pub version: String, - pub name: String, + pub package: String, } #[derive(Deserialize)] @@ -85,6 +85,23 @@ impl Manifest { self.dependencies.clone() } + /// Get HashMap of kind: + /// import name => import directory + /// Which then used in AST/ASG to resolve import paths. + pub fn get_imports_map(&self) -> Option> { + self.dependencies.clone().map(|dependencies| { + dependencies + .into_iter() + .map(|(name, dependency)| { + ( + name, + format!("{}-{}@{}", dependency.author, dependency.package, dependency.version), + ) + }) + .collect() + }) + } + pub fn get_package_license(&self) -> Option { self.project.license.clone() } @@ -119,6 +136,10 @@ license = "MIT" [remote] author = "{author}" # Add your Aleo Package Manager username or team name. + +[dependencies] +# Define dependencies here in format: +# name = {{ package = "package-name", author = "author", version = "version" }} "#, name = self.project.name, author = author From f71648c6a657020746fc62c33bca4c23d6263fb9 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 7 Jul 2021 17:15:42 +0300 Subject: [PATCH 03/62] clippy --- leo/commands/build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/leo/commands/build.rs b/leo/commands/build.rs index ec2326a300..5871d4f1d4 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -34,8 +34,6 @@ use snarkvm_r1cs::ConstraintSystem; use structopt::StructOpt; use tracing::span::Span; -use std::collections::HashMap; - /// Compiler Options wrapper for Build command. Also used by other commands which /// require Build command output as their input. #[derive(StructOpt, Clone, Debug)] @@ -132,7 +130,7 @@ impl Command for Build { .manifest() .map_err(|_| anyhow!("Package manifest not found, try running `leo init`"))?; let package_name = manifest.get_package_name(); - let imports_map = manifest.get_imports_map().unwrap_or(HashMap::new()); + let imports_map = manifest.get_imports_map().unwrap_or_default(); // Sanitize the package path to the root directory. let mut package_path = path.clone(); From e5be6e2c571501c3ee9698b8c7a1795cf5acdf13 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 12 Jul 2021 21:45:26 +0300 Subject: [PATCH 04/62] added dependency management - recursively add deps - prevent recursion in dep tree - pretty print recursion error - fix logging for leo install cmd - add test for leo install and dep section --- Cargo.lock | 1 + Cargo.toml | 3 ++ leo/commands/package/add.rs | 13 ++++--- leo/commands/package/install.rs | 63 +++++++++++++++++++++++++-------- leo/main.rs | 29 +++++++++++++++ package/src/root/zip.rs | 6 ++-- 6 files changed, 92 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b07391f0bd..3ec4f838b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1216,6 +1216,7 @@ dependencies = [ "console", "dirs", "from-pest", + "indexmap", "lazy_static", "leo-ast", "leo-compiler", diff --git a/Cargo.toml b/Cargo.toml index b47de38dcd..4d4b2281ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,6 +108,9 @@ version = "0.14.0" [dependencies.from-pest] version = "0.3.1" +[dependencies.indexmap] +version = "1.7" + [dependencies.lazy_static] version = "1.4.0" diff --git a/leo/commands/package/add.rs b/leo/commands/package/add.rs index 4d070b7e2c..9aa0e3ed5e 100644 --- a/leo/commands/package/add.rs +++ b/leo/commands/package/add.rs @@ -21,6 +21,7 @@ use anyhow::{anyhow, Result}; use std::{ fs::{create_dir_all, File}, io::{Read, Write}, + path::PathBuf, }; use structopt::StructOpt; use tracing::Span; @@ -80,7 +81,7 @@ impl Add { impl Command for Add { type Input = (); - type Output = (); + type Output = PathBuf; fn log_span(&self) -> Span { tracing::span!(tracing::Level::INFO, "Adding") @@ -98,6 +99,8 @@ impl Command for Add { let (author, package_name) = self.try_read_arguments()?; + tracing::info!("Package: {}/{}", &author, &package_name); + // Attempt to fetch the package. let reader = { let fetch = Fetch { @@ -118,9 +121,9 @@ impl Command for Add { // Dumb compatibility hack. // TODO: Remove once `leo add` functionality is discussed. if self.version.is_some() { - path.push(format!("{}-{}@{}", author, package_name, self.version.unwrap())); + path.push(format!("{}-{}@{}", author.clone(), package_name, self.version.unwrap())); } else { - path.push(package_name); + path.push(package_name.clone()); } create_dir_all(&path)?; }; @@ -152,8 +155,8 @@ impl Command for Add { } } - tracing::info!("Successfully added a package"); + tracing::info!("Successfully added package {}/{}", author, package_name); - Ok(()) + Ok(path) } } diff --git a/leo/commands/package/install.rs b/leo/commands/package/install.rs index f1e50cd344..18419557a8 100644 --- a/leo/commands/package/install.rs +++ b/leo/commands/package/install.rs @@ -20,6 +20,7 @@ use crate::{ }; use anyhow::{anyhow, Result}; +use indexmap::set::IndexSet; use structopt::StructOpt; use tracing::span::Span; @@ -29,31 +30,65 @@ use tracing::span::Span; pub struct Install {} impl Command for Install { - type Input = (); + /// Names of dependencies in the current branch of a dependency tree. + type Input = IndexSet; type Output = (); fn log_span(&self) -> Span { tracing::span!(tracing::Level::INFO, "Installing") } - fn prelude(&self, _: Context) -> Result { - Ok(()) + fn prelude(&self, context: Context) -> Result { + let package_name = context.manifest()?.get_package_name(); + + let mut set = IndexSet::new(); + set.insert(package_name); + + Ok(set) } - fn apply(self, context: Context, _: Self::Input) -> Result { - let deps = context - .manifest()? - .get_package_dependencies() - .ok_or_else(|| anyhow!("Package has no dependencies"))?; + fn apply(self, context: Context, mut tree: Self::Input) -> Result { + let dependencies = context + .manifest() + .map_err(|_| anyhow!("Package Manifest not found"))? + .get_package_dependencies(); - for (_name, dep) in deps.iter() { - Add::new( + let dependencies = match dependencies { + Some(value) => value, + None => return Ok(()), + }; + + // Go through each dependency in Leo.toml and add it to the imports. + // While adding, pull dependencies of this package as well and check for recursion. + for (_name, dependency) in dependencies.iter() { + let package_name = dependency.package.clone(); + let path = Add::new( None, - Some(dep.author.clone()), - Some(dep.package.clone()), - Some(dep.version.clone()), + Some(dependency.author.clone()), + Some(package_name.clone()), + Some(dependency.version.clone()), ) - .execute(context.clone())?; + .apply(context.clone(), ())?; + + // Try inserting a new dependency to the branch. If not inserted, + // then fail because this dependency was added on a higher level. + if !tree.insert(package_name.clone()) { + // Pretty format for the message - show dependency structure. + let mut message: Vec = tree + .into_iter() + .enumerate() + .map(|(i, val)| format!("{}└─{}", " ".repeat(i * 2), val)) + .collect(); + + message.push(format!("{}└─{} (FAILURE)", " ".repeat(message.len() * 2), package_name)); + + return Err(anyhow!("recursive dependency found \n{}", message.join("\n"))); + } + + // Run the same command for installed dependency. + let mut new_context = context.clone(); + new_context.path = Some(path); + (Install {}).apply(new_context, tree.clone())?; } Ok(()) diff --git a/leo/main.rs b/leo/main.rs index 062ca3b9c6..bfb04d43f6 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -247,6 +247,7 @@ mod cli_tests { use crate::{run_with_args, Opt}; use anyhow::Error; + use snarkvm_utilities::Write; use std::path::PathBuf; use structopt::StructOpt; use test_dir::{DirBuilder, FileType, TestDir}; @@ -366,6 +367,7 @@ mod cli_tests { } #[test] + #[ignore] fn test_import() { let dir = testdir("test"); let path = dir.path("test"); @@ -407,4 +409,31 @@ mod cli_tests { assert!(run_cmd("leo test -f examples/silly-sudoku/src/lib.leo", path).is_ok()); assert!(run_cmd("leo test -f examples/silly-sudoku/src/main.leo", path).is_ok()); } + + #[test] + fn test_install() { + let dir = testdir("test"); + let path = dir.path("test"); + + assert!(run_cmd("leo new install", &Some(path.clone())).is_ok()); + + let install_path = &Some(path.join("install")); + + let mut file = std::fs::OpenOptions::new() + .write(true) + .append(true) + .open(path.join("install/Leo.toml")) + .unwrap(); + + assert!( + file.write_all( + br#" + sudoku = {author = "justice-league", package = "u8u32", version = "0.1.0"} + "# + ) + .is_ok() + ); + + assert!(run_cmd("leo install", install_path).is_ok()); + } } diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs index 6286b125d0..f9f3a9fe5b 100644 --- a/package/src/root/zip.rs +++ b/package/src/root/zip.rs @@ -156,10 +156,8 @@ impl ZipFile { /// Check if the file path should be included in the package zip file. fn is_included(path: &Path) -> bool { - // excluded directories: `output`, `imports` - if path.ends_with(OUTPUTS_DIRECTORY_NAME.trim_end_matches('/')) - | path.ends_with(IMPORTS_DIRECTORY_NAME.trim_end_matches('/')) - { + // DO NOT include `imports` and `outputs` directories. + if path.starts_with(IMPORTS_DIRECTORY_NAME) || path.starts_with(OUTPUTS_DIRECTORY_NAME) { return false; } From 87af0609b788566eb871a10d13fb919c452821ce Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 13 Jul 2021 13:41:38 +0300 Subject: [PATCH 05/62] install -> fetch --- leo/commands/package/{install.rs => fetch.rs} | 8 ++++---- leo/commands/package/mod.rs | 4 ++-- leo/main.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) rename leo/commands/package/{install.rs => fetch.rs} (95%) diff --git a/leo/commands/package/install.rs b/leo/commands/package/fetch.rs similarity index 95% rename from leo/commands/package/install.rs rename to leo/commands/package/fetch.rs index 18419557a8..4c8c9d9d4e 100644 --- a/leo/commands/package/install.rs +++ b/leo/commands/package/fetch.rs @@ -27,15 +27,15 @@ use tracing::span::Span; /// Install dependencies Leo code command #[derive(StructOpt, Debug)] #[structopt(setting = structopt::clap::AppSettings::ColoredHelp)] -pub struct Install {} +pub struct Fetch {} -impl Command for Install { +impl Command for Fetch { /// Names of dependencies in the current branch of a dependency tree. type Input = IndexSet; type Output = (); fn log_span(&self) -> Span { - tracing::span!(tracing::Level::INFO, "Installing") + tracing::span!(tracing::Level::INFO, "Fetching") } fn prelude(&self, context: Context) -> Result { @@ -88,7 +88,7 @@ impl Command for Install { // Run the same command for installed dependency. let mut new_context = context.clone(); new_context.path = Some(path); - (Install {}).apply(new_context, tree.clone())?; + (Fetch {}).apply(new_context, tree.clone())?; } Ok(()) diff --git a/leo/commands/package/mod.rs b/leo/commands/package/mod.rs index 434b9dbd47..cd1c3ccd69 100644 --- a/leo/commands/package/mod.rs +++ b/leo/commands/package/mod.rs @@ -20,8 +20,8 @@ pub use add::Add; pub mod clone; pub use clone::Clone; -pub mod install; -pub use install::Install; +pub mod fetch; +pub use fetch::Fetch; pub mod login; pub use login::Login; diff --git a/leo/main.rs b/leo/main.rs index bfb04d43f6..39613bf13c 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -22,7 +22,7 @@ pub mod logger; pub mod updater; use commands::{ - package::{Add, Clone, Install, Login, Logout, Publish, Remove}, + package::{Add, Clone, Fetch, Login, Logout, Publish, Remove}, Build, Clean, Command, @@ -138,9 +138,9 @@ enum CommandOpts { }, #[structopt(about = "Install dependencies for this program")] - Install { + Fetch { #[structopt(flatten)] - command: Install, + command: Fetch, }, #[structopt(about = "Clone a package from the Aleo Package Manager")] @@ -220,7 +220,7 @@ fn run_with_args(opt: Opt) -> Result<(), Error> { CommandOpts::Update { command } => command.try_execute(context), CommandOpts::Add { command } => command.try_execute(context), - CommandOpts::Install { command } => command.try_execute(context), + CommandOpts::Fetch { command } => command.try_execute(context), CommandOpts::Clone { command } => command.try_execute(context), CommandOpts::Login { command } => command.try_execute(context), CommandOpts::Logout { command } => command.try_execute(context), From a4433cb9864da2b8083f6960008a17b641c5bc84 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 13 Jul 2021 13:42:15 +0300 Subject: [PATCH 06/62] deprecate GH Actions tests --- .github/workflows/ci.yml | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54871c0d37..8cffb4a00f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,33 +71,33 @@ jobs: command: clippy args: --all-features --examples --all --benches - test-package: - name: Test Package - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - - nightly - steps: - - name: Checkout - uses: actions/checkout@v2 + # test-package: + # name: Test Package + # runs-on: ubuntu-latest + # strategy: + # matrix: + # rust: + # - stable + # - nightly + # steps: + # - name: Checkout + # uses: actions/checkout@v2 - - name: Install Rust (${{ matrix.rust }}) - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true + # - name: Install Rust (${{ matrix.rust }}) + # uses: actions-rs/toolchain@v1 + # with: + # profile: minimal + # toolchain: ${{ matrix.rust }} + # override: true - - name: Install cargo-all-features - run: | - cargo install cargo-all-features + # - name: Install cargo-all-features + # run: | + # cargo install cargo-all-features - - name: Test - run: | - cd package - cargo test-all-features + # - name: Test + # run: | + # cd package + # cargo test-all-features codecov: name: Code Coverage From a648552043871bbeb2f38c501bbe25a20989fa3a Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 13 Jul 2021 13:47:45 +0300 Subject: [PATCH 07/62] remove random r file in .circleci --- .circleci/r | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .circleci/r diff --git a/.circleci/r b/.circleci/r deleted file mode 100644 index e69de29bb2..0000000000 From 45903d6c23e1d12f35015615d01b4c82d18e8ad4 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 15 Jul 2021 12:05:34 +0300 Subject: [PATCH 08/62] added proving system and curve --- package/src/root/manifest.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 017eb5bc4f..e738464209 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -137,6 +137,10 @@ license = "MIT" [remote] author = "{author}" # Add your Aleo Package Manager username or team name. +[target] +curve = "bls12_377" +proving_system = "groth16" + [dependencies] # Define dependencies here in format: # name = {{ package = "package-name", author = "author", version = "version" }} From 3ac22c91d7851073ff4a17154b90897498bf113d Mon Sep 17 00:00:00 2001 From: damirka Date: Sat, 17 Jul 2021 02:35:38 +0300 Subject: [PATCH 09/62] adds lock_file to leo-package and fetch command --- leo/commands/package/fetch.rs | 67 +++++++++++++++----- package/src/errors/root/lock_file.rs | 47 ++++++++++++++ package/src/errors/root/mod.rs | 3 + package/src/root/lock_file.rs | 94 ++++++++++++++++++++++++++++ package/src/root/mod.rs | 3 + 5 files changed, 200 insertions(+), 14 deletions(-) create mode 100644 package/src/errors/root/lock_file.rs create mode 100644 package/src/root/lock_file.rs diff --git a/leo/commands/package/fetch.rs b/leo/commands/package/fetch.rs index 4c8c9d9d4e..64814bc2a0 100644 --- a/leo/commands/package/fetch.rs +++ b/leo/commands/package/fetch.rs @@ -16,11 +16,17 @@ use crate::{ commands::{package::Add, Command}, - context::Context, + context::{create_context, Context}, +}; + +use leo_package::root::{ + lock_file::{LockFile, Package}, + Dependency, }; use anyhow::{anyhow, Result}; use indexmap::set::IndexSet; +use std::collections::HashMap; use structopt::StructOpt; use tracing::span::Span; @@ -47,32 +53,52 @@ impl Command for Fetch { Ok(set) } - fn apply(self, context: Context, mut tree: Self::Input) -> Result { + fn apply(self, context: Context, tree: Self::Input) -> Result { let dependencies = context .manifest() .map_err(|_| anyhow!("Package Manifest not found"))? .get_package_dependencies(); let dependencies = match dependencies { - Some(value) => value, + Some(dependencies) => dependencies, None => return Ok(()), }; + if dependencies.is_empty() { + return Ok(()); + } + + let mut lock_file = LockFile::new(); + self.add_dependencies(context.clone(), tree, &mut lock_file, dependencies)?; + lock_file.write_to(&context.dir()?)?; + + Ok(()) + } +} + +impl Fetch { + fn add_dependencies( + &self, + context: Context, + mut tree: IndexSet, + lock_file: &mut LockFile, + dependencies: HashMap, + ) -> Result<()> { // Go through each dependency in Leo.toml and add it to the imports. // While adding, pull dependencies of this package as well and check for recursion. - for (_name, dependency) in dependencies.iter() { - let package_name = dependency.package.clone(); + for (_import_name, dependency) in dependencies.into_iter() { + let mut package = Package::from(dependency); let path = Add::new( None, - Some(dependency.author.clone()), - Some(package_name.clone()), - Some(dependency.version.clone()), + Some(package.author.clone()), + Some(package.name.clone()), + Some(package.version.clone()), ) .apply(context.clone(), ())?; // Try inserting a new dependency to the branch. If not inserted, // then fail because this dependency was added on a higher level. - if !tree.insert(package_name.clone()) { + if !tree.insert(package.name.clone()) { // Pretty format for the message - show dependency structure. let mut message: Vec = tree .into_iter() @@ -80,15 +106,28 @@ impl Command for Fetch { .map(|(i, val)| format!("{}└─{}", " ".repeat(i * 2), val)) .collect(); - message.push(format!("{}└─{} (FAILURE)", " ".repeat(message.len() * 2), package_name)); + message.push(format!("{}└─{} (FAILURE)", " ".repeat(message.len() * 2), package.name)); return Err(anyhow!("recursive dependency found \n{}", message.join("\n"))); } - // Run the same command for installed dependency. - let mut new_context = context.clone(); - new_context.path = Some(path); - (Fetch {}).apply(new_context, tree.clone())?; + // Check imported dependency's dependencies. + let imported_dependencies = create_context(path, None)?.manifest()?.get_package_dependencies(); + if let Some(dependencies) = imported_dependencies { + if !dependencies.is_empty() { + // Fill in the lock file with imported dependency and information about its dependencies. + package.add_dependencies(&dependencies); + lock_file.add_package(package); + + // Recursively call this method for imported program. + self.add_dependencies(context.clone(), tree.clone(), lock_file, dependencies)?; + + continue; + } + } + + // If there are no dependencies for the new import, add a single record. + lock_file.add_package(package); } Ok(()) diff --git a/package/src/errors/root/lock_file.rs b/package/src/errors/root/lock_file.rs new file mode 100644 index 0000000000..1f46877e05 --- /dev/null +++ b/package/src/errors/root/lock_file.rs @@ -0,0 +1,47 @@ +// Copyright (C) 2019-2021 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 std::io; + +#[derive(Debug, Error)] +pub enum LockFileError { + #[error("{}: {}", _0, _1)] + Crate(&'static str, String), + + #[error("`{}` creating: {}", _0, _1)] + Creating(&'static str, io::Error), + + #[error("`{}` metadata: {}", _0, _1)] + Metadata(&'static str, io::Error), + + #[error("`{}` opening: {}", _0, _1)] + Opening(&'static str, io::Error), + + #[error("`{}` parsing: {}", _0, _1)] + Parsing(&'static str, toml::de::Error), + + #[error("`{}` reading: {}", _0, _1)] + Reading(&'static str, io::Error), + + #[error("`{}` writing: {}", _0, _1)] + Writing(&'static str, io::Error), +} + +impl From for LockFileError { + fn from(error: toml::ser::Error) -> Self { + LockFileError::Crate("toml", error.to_string()) + } +} diff --git a/package/src/errors/root/mod.rs b/package/src/errors/root/mod.rs index 6b90439ca1..3a6c2b95a0 100644 --- a/package/src/errors/root/mod.rs +++ b/package/src/errors/root/mod.rs @@ -17,6 +17,9 @@ pub mod gitignore; pub use self::gitignore::*; +pub mod lock_file; +pub use self::lock_file::*; + pub mod manifest; pub use self::manifest::*; diff --git a/package/src/root/lock_file.rs b/package/src/root/lock_file.rs new file mode 100644 index 0000000000..c06e33f027 --- /dev/null +++ b/package/src/root/lock_file.rs @@ -0,0 +1,94 @@ +// Copyright (C) 2019-2021 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::{errors::LockFileError, root::Dependency}; + +use serde::{Deserialize, Serialize}; +use std::{borrow::Cow, collections::HashMap, fs::File, io::Write, path::Path}; + +pub const LOCKFILE_FILENAME: &str = "Leo.lock"; + +/// Lock-file struct, contains all information about imported dependencies +/// and their relationships. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LockFile { + pub package: Vec, +} + +/// Single dependency record. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Package { + // pub import_name: String, + pub name: String, + pub version: String, + pub author: String, + pub dependencies: HashMap, +} + +impl LockFile { + pub fn new() -> Self { + LockFile { package: vec![] } + } + + /// Add Package record to the lock file. Chainable. + pub fn add_package(&mut self, package: Package) -> &mut Self { + self.package.push(package); + self + } + + pub fn to_string(&self) -> Result { + Ok(toml::to_string(self)?) + } + + /// Write Leo.lock to the given location. + pub fn write_to(self, path: &Path) -> Result<(), LockFileError> { + let mut path = Cow::from(path); + if path.is_dir() { + path.to_mut().push(LOCKFILE_FILENAME); + } + + let mut file = File::create(&path).map_err(|error| LockFileError::Creating(LOCKFILE_FILENAME, error))?; + file.write_all(self.to_string()?.as_bytes()) + .map_err(|error| LockFileError::Writing(LOCKFILE_FILENAME, error)) + } +} + +impl Package { + /// Fill dependencies from Leo Manifest data. + pub fn add_dependencies(&mut self, dependencies: &HashMap) { + for (import_name, dependency) in dependencies.iter() { + self.dependencies + .insert(import_name.clone(), dependency.package.clone()); + } + } +} + +impl From for Package { + fn from(dependency: Dependency) -> Package { + let Dependency { + author, + version, + package, + } = dependency; + + Package { + name: package, + author, + version, + dependencies: Default::default(), + } + } +} diff --git a/package/src/root/mod.rs b/package/src/root/mod.rs index 6b90439ca1..3a6c2b95a0 100644 --- a/package/src/root/mod.rs +++ b/package/src/root/mod.rs @@ -17,6 +17,9 @@ pub mod gitignore; pub use self::gitignore::*; +pub mod lock_file; +pub use self::lock_file::*; + pub mod manifest; pub use self::manifest::*; From c36be2c745d96c8aa65c91861fdf3eeaa72c1e06 Mon Sep 17 00:00:00 2001 From: damirka Date: Sun, 18 Jul 2021 23:40:26 +0300 Subject: [PATCH 10/62] finalizes import stabilization - temporarily disables leo add and leo rm - lock file is parsed by leo build and used - error messages improved for some cases - fetch test is added and improved --- .circleci/config.yml | 24 ++++----- leo/commands/build.rs | 13 +++++ leo/commands/package/add.rs | 4 ++ leo/commands/package/fetch.rs | 16 ++++-- leo/commands/package/remove.rs | 4 ++ leo/context.rs | 14 ++++- leo/main.rs | 33 ++++++------ package/src/errors/root/lock_file.rs | 6 +++ package/src/root/lock_file.rs | 81 +++++++++++++++++++++++----- 9 files changed, 147 insertions(+), 48 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 602894ba20..72cbec6c83 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -145,18 +145,18 @@ jobs: export LEO=/home/circleci/project/project/bin/leo ./project/.circleci/leo-setup.sh - leo-add-remove: - docker: - - image: cimg/rust:1.52.1 - resource_class: xlarge - steps: - - attach_workspace: - at: /home/circleci/project/ - - run: - name: leo add & remove - command: | - export LEO=/home/circleci/project/project/bin/leo - ./project/.circleci/leo-add-remove.sh + # leo-add-remove: + # docker: + # - image: cimg/rust:1.52.1 + # resource_class: xlarge + # steps: + # - attach_workspace: + # at: /home/circleci/project/ + # - run: + # name: leo add & remove + # command: | + # export LEO=/home/circleci/project/project/bin/leo + # ./project/.circleci/leo-add-remove.sh leo-check-constraints: docker: diff --git a/leo/commands/build.rs b/leo/commands/build.rs index abfcb2a21e..77d29beb5d 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -135,6 +135,11 @@ impl Command for Build { let package_name = manifest.get_package_name(); let imports_map = manifest.get_imports_map().unwrap_or_default(); + // Error out if there are dependencies but no lock file found. + if !imports_map.is_empty() && !context.lock_file_exists()? { + return Err(anyhow!("Dependencies are not installed, please run `leo fetch` first")); + } + // Sanitize the package path to the root directory. let mut package_path = path.clone(); if package_path.is_file() { @@ -175,6 +180,14 @@ impl Command for Build { ); } + let imports_map = if context.lock_file_exists()? { + context.lock_file()?.to_hashmap() + } else { + Default::default() + }; + + dbg!(&imports_map); + // Load the program at `main_file_path` let program = Compiler::::parse_program_with_input( package_name.clone(), diff --git a/leo/commands/package/add.rs b/leo/commands/package/add.rs index 9aa0e3ed5e..4b2d147bb5 100644 --- a/leo/commands/package/add.rs +++ b/leo/commands/package/add.rs @@ -14,6 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +// !!!!!!!!!!!!!!!!!!!!!!!!!!!! +// COMMAND TEMPORARILY DISABLED +// !!!!!!!!!!!!!!!!!!!!!!!!!!!! + use crate::{api::Fetch, commands::Command, context::Context}; use leo_package::imports::{ImportsDirectory, IMPORTS_DIRECTORY_NAME}; diff --git a/leo/commands/package/fetch.rs b/leo/commands/package/fetch.rs index 64814bc2a0..1df0274bff 100644 --- a/leo/commands/package/fetch.rs +++ b/leo/commands/package/fetch.rs @@ -59,6 +59,7 @@ impl Command for Fetch { .map_err(|_| anyhow!("Package Manifest not found"))? .get_package_dependencies(); + // If program has no dependencies in the Leo.toml, exit with success. let dependencies = match dependencies { Some(dependencies) => dependencies, None => return Ok(()), @@ -77,6 +78,8 @@ impl Command for Fetch { } impl Fetch { + /// Pulls dependencies and fills in the lock file. Also checks for + /// recursive dependencies with dependency tree. fn add_dependencies( &self, context: Context, @@ -86,8 +89,11 @@ impl Fetch { ) -> Result<()> { // Go through each dependency in Leo.toml and add it to the imports. // While adding, pull dependencies of this package as well and check for recursion. - for (_import_name, dependency) in dependencies.into_iter() { - let mut package = Package::from(dependency); + for (import_name, dependency) in dependencies.into_iter() { + let mut package = Package::from(&dependency); + package.import_name = Some(import_name); + + // Pull the dependency first. let path = Add::new( None, Some(package.author.clone()), @@ -112,7 +118,11 @@ impl Fetch { } // Check imported dependency's dependencies. - let imported_dependencies = create_context(path, None)?.manifest()?.get_package_dependencies(); + let imported_dependencies = create_context(path, None)? + .manifest() + .map_err(|_| anyhow!("Unable to parse imported dependency's manifest"))? + .get_package_dependencies(); + if let Some(dependencies) = imported_dependencies { if !dependencies.is_empty() { // Fill in the lock file with imported dependency and information about its dependencies. diff --git a/leo/commands/package/remove.rs b/leo/commands/package/remove.rs index 1f5426062c..6031acdb96 100644 --- a/leo/commands/package/remove.rs +++ b/leo/commands/package/remove.rs @@ -14,6 +14,10 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +// !!!!!!!!!!!!!!!!!!!!!!!!!!!! +// COMMAND TEMPORARILY DISABLED +// !!!!!!!!!!!!!!!!!!!!!!!!!!!! + use crate::{commands::Command, context::Context}; use leo_package::LeoPackage; diff --git a/leo/context.rs b/leo/context.rs index 0fb96f0a11..0f689bc4aa 100644 --- a/leo/context.rs +++ b/leo/context.rs @@ -15,7 +15,7 @@ // along with the Leo library. If not, see . use crate::{api::Api, config}; -use leo_package::root::Manifest; +use leo_package::root::{LockFile, Manifest}; use anyhow::Result; use std::{convert::TryFrom, env::current_dir, path::PathBuf}; @@ -41,10 +41,20 @@ impl Context { } } - /// Get package manifest for current context + /// Get package manifest for current context. pub fn manifest(&self) -> Result { Ok(Manifest::try_from(self.dir()?.as_path())?) } + + /// Get lock file for current context. + pub fn lock_file(&self) -> Result { + Ok(LockFile::try_from(self.dir()?.as_path())?) + } + + /// Check if lock file exists. + pub fn lock_file_exists(&self) -> Result { + Ok(LockFile::exists_at(&self.dir()?)) + } } /// Create a new context for the current directory. diff --git a/leo/main.rs b/leo/main.rs index 73344f1b5f..e10afcb6fc 100644 --- a/leo/main.rs +++ b/leo/main.rs @@ -22,7 +22,7 @@ pub mod logger; pub mod updater; use commands::{ - package::{Add, Clone, Fetch, Login, Logout, Publish, Remove}, + package::{Clone, Fetch, Login, Logout, Publish}, Build, Clean, Command, @@ -131,13 +131,12 @@ enum CommandOpts { command: Test, }, - #[structopt(about = "Import a package from the Aleo Package Manager")] - Add { - #[structopt(flatten)] - command: Add, - }, - - #[structopt(about = "Install dependencies for this program")] + // #[structopt(about = "Import a package from the Aleo Package Manager")] + // Add { + // #[structopt(flatten)] + // command: Add, + // }, + #[structopt(about = "Pull dependencies from Aleo Package Manager")] Fetch { #[structopt(flatten)] command: Fetch, @@ -167,12 +166,11 @@ enum CommandOpts { command: Publish, }, - #[structopt(about = "Uninstall a package from the current package")] - Remove { - #[structopt(flatten)] - command: Remove, - }, - + // #[structopt(about = "Uninstall a package from the current package")] + // Remove { + // #[structopt(flatten)] + // command: Remove, + // }, #[structopt(about = "Lints the Leo files in the package (*)")] Lint { #[structopt(flatten)] @@ -219,14 +217,13 @@ fn run_with_args(opt: Opt) -> Result<()> { CommandOpts::Watch { command } => command.try_execute(context), CommandOpts::Update { command } => command.try_execute(context), - CommandOpts::Add { command } => command.try_execute(context), + // CommandOpts::Add { command } => command.try_execute(context), CommandOpts::Fetch { command } => command.try_execute(context), CommandOpts::Clone { command } => command.try_execute(context), CommandOpts::Login { command } => command.try_execute(context), CommandOpts::Logout { command } => command.try_execute(context), CommandOpts::Publish { command } => command.try_execute(context), - CommandOpts::Remove { command } => command.try_execute(context), - + // CommandOpts::Remove { command } => command.try_execute(context), CommandOpts::Lint { command } => command.try_execute(context), CommandOpts::Deploy { command } => command.try_execute(context), } @@ -425,6 +422,7 @@ mod cli_tests { .open(path.join("install/Leo.toml")) .unwrap(); + assert!(run_cmd("leo fetch", install_path).is_ok()); assert!( file.write_all( br#" @@ -435,5 +433,6 @@ mod cli_tests { ); assert!(run_cmd("leo fetch", install_path).is_ok()); + assert!(run_cmd("leo build", install_path).is_ok()); } } diff --git a/package/src/errors/root/lock_file.rs b/package/src/errors/root/lock_file.rs index 1f46877e05..8a442a1846 100644 --- a/package/src/errors/root/lock_file.rs +++ b/package/src/errors/root/lock_file.rs @@ -45,3 +45,9 @@ impl From for LockFileError { LockFileError::Crate("toml", error.to_string()) } } + +impl From for LockFileError { + fn from(error: toml::de::Error) -> Self { + LockFileError::Crate("toml", error.to_string()) + } +} diff --git a/package/src/root/lock_file.rs b/package/src/root/lock_file.rs index c06e33f027..6dc5767c40 100644 --- a/package/src/root/lock_file.rs +++ b/package/src/root/lock_file.rs @@ -17,7 +17,14 @@ use crate::{errors::LockFileError, root::Dependency}; use serde::{Deserialize, Serialize}; -use std::{borrow::Cow, collections::HashMap, fs::File, io::Write, path::Path}; +use std::{ + borrow::Cow, + collections::HashMap, + convert::TryFrom, + fs::File, + io::{Read, Write}, + path::Path, +}; pub const LOCKFILE_FILENAME: &str = "Leo.lock"; @@ -31,10 +38,11 @@ pub struct LockFile { /// Single dependency record. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Package { - // pub import_name: String, pub name: String, pub version: String, pub author: String, + pub import_name: Option, + #[serde(skip_serializing_if = "HashMap::is_empty", default)] pub dependencies: HashMap, } @@ -43,6 +51,15 @@ impl LockFile { LockFile { package: vec![] } } + /// Check if LockFile exists in a directory. + pub fn exists_at(path: &Path) -> bool { + let mut path = Cow::from(path); + if path.is_dir() { + path.to_mut().push(LOCKFILE_FILENAME); + } + path.exists() + } + /// Add Package record to the lock file. Chainable. pub fn add_package(&mut self, package: Package) -> &mut Self { self.package.push(package); @@ -53,6 +70,18 @@ impl LockFile { Ok(toml::to_string(self)?) } + pub fn to_hashmap(&self) -> HashMap { + let mut result = HashMap::new(); + for package in self.package.iter() { + match &package.import_name { + Some(name) => result.insert(name.clone(), package.to_identifier()), + None => result.insert(package.name.clone(), package.to_identifier()), + }; + } + + result + } + /// Write Leo.lock to the given location. pub fn write_to(self, path: &Path) -> Result<(), LockFileError> { let mut path = Cow::from(path); @@ -66,29 +95,53 @@ impl LockFile { } } +impl TryFrom<&Path> for LockFile { + type Error = LockFileError; + + fn try_from(path: &Path) -> Result { + let mut path = Cow::from(path); + if path.is_dir() { + path.to_mut().push(LOCKFILE_FILENAME); + } + + let mut file = File::open(path.clone()).map_err(|error| LockFileError::Opening(LOCKFILE_FILENAME, error))?; + let size = file + .metadata() + .map_err(|error| LockFileError::Metadata(LOCKFILE_FILENAME, error))? + .len() as usize; + + let mut buffer = String::with_capacity(size); + file.read_to_string(&mut buffer) + .map_err(|error| LockFileError::Reading(LOCKFILE_FILENAME, error))?; + + toml::from_str(&buffer).map_err(|error| LockFileError::Parsing(LOCKFILE_FILENAME, error)) + } +} + impl Package { /// Fill dependencies from Leo Manifest data. pub fn add_dependencies(&mut self, dependencies: &HashMap) { for (import_name, dependency) in dependencies.iter() { self.dependencies - .insert(import_name.clone(), dependency.package.clone()); + .insert(import_name.clone(), Package::from(dependency).to_identifier()); } } + + /// Form an path identifier for a package. It is the path under which package is stored + /// inside the `imports/` directory. + pub fn to_identifier(&self) -> String { + format!("{}-{}@{}", self.author, self.name, self.version) + } } -impl From for Package { - fn from(dependency: Dependency) -> Package { - let Dependency { - author, - version, - package, - } = dependency; - +impl From<&Dependency> for Package { + fn from(dependency: &Dependency) -> Package { Package { - name: package, - author, - version, + name: dependency.package.clone(), + author: dependency.author.clone(), + version: dependency.version.clone(), dependencies: Default::default(), + import_name: None, } } } From 712c1ecd969974eb6bd203b6c65119f1f06b1c54 Mon Sep 17 00:00:00 2001 From: damirka Date: Sun, 18 Jul 2021 23:43:56 +0300 Subject: [PATCH 11/62] return github workflow --- .github/workflows/ci.yml | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97b8ebf8f6..8f0d7c2e18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,33 +69,33 @@ jobs: command: clippy args: --all-features --examples --all --benches - # test-package: - # name: Test Package - # runs-on: ubuntu-latest - # strategy: - # matrix: - # rust: - # - stable - # - nightly - # steps: - # - name: Checkout - # uses: actions/checkout@v2 + test-package: + name: Test Package + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - nightly + steps: + - name: Checkout + uses: actions/checkout@v2 - # - name: Install Rust (${{ matrix.rust }}) - # uses: actions-rs/toolchain@v1 - # with: - # profile: minimal - # toolchain: ${{ matrix.rust }} - # override: true + - name: Install Rust (${{ matrix.rust }}) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true - # - name: Install cargo-all-features - # run: | - # cargo install cargo-all-features + - name: Install cargo-all-features + run: | + cargo install cargo-all-features - # - name: Test - # run: | - # cd package - # cargo test-all-features + - name: Test + run: | + cd package + cargo test-all-features codecov: name: Code Coverage From aae666c483687c76dff6fc4d3c49f413df798ef6 Mon Sep 17 00:00:00 2001 From: damirka Date: Sun, 18 Jul 2021 23:51:38 +0300 Subject: [PATCH 12/62] self-review fixes --- leo/commands/build.rs | 4 +--- leo/commands/package/fetch.rs | 2 +- package/src/root/lock_file.rs | 14 +++++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/leo/commands/build.rs b/leo/commands/build.rs index 77d29beb5d..c7ae453474 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -181,13 +181,11 @@ impl Command for Build { } let imports_map = if context.lock_file_exists()? { - context.lock_file()?.to_hashmap() + context.lock_file()?.to_import_map() } else { Default::default() }; - dbg!(&imports_map); - // Load the program at `main_file_path` let program = Compiler::::parse_program_with_input( package_name.clone(), diff --git a/leo/commands/package/fetch.rs b/leo/commands/package/fetch.rs index 1df0274bff..4a2615c83f 100644 --- a/leo/commands/package/fetch.rs +++ b/leo/commands/package/fetch.rs @@ -30,7 +30,7 @@ use std::collections::HashMap; use structopt::StructOpt; use tracing::span::Span; -/// Install dependencies Leo code command +/// Pull dependencies specified in Leo toml. #[derive(StructOpt, Debug)] #[structopt(setting = structopt::clap::AppSettings::ColoredHelp)] pub struct Fetch {} diff --git a/package/src/root/lock_file.rs b/package/src/root/lock_file.rs index 6dc5767c40..1b06dff826 100644 --- a/package/src/root/lock_file.rs +++ b/package/src/root/lock_file.rs @@ -66,16 +66,20 @@ impl LockFile { self } + /// Print LockFile as toml. pub fn to_string(&self) -> Result { Ok(toml::to_string(self)?) } - pub fn to_hashmap(&self) -> HashMap { + /// Form a HashMap of kind: + /// ``` imported_name => package_name ``` + /// for all imported packages. + pub fn to_import_map(&self) -> HashMap { let mut result = HashMap::new(); for package in self.package.iter() { match &package.import_name { - Some(name) => result.insert(name.clone(), package.to_identifier()), - None => result.insert(package.name.clone(), package.to_identifier()), + Some(name) => result.insert(name.clone(), package.to_string()), + None => result.insert(package.name.clone(), package.to_string()), }; } @@ -123,13 +127,13 @@ impl Package { pub fn add_dependencies(&mut self, dependencies: &HashMap) { for (import_name, dependency) in dependencies.iter() { self.dependencies - .insert(import_name.clone(), Package::from(dependency).to_identifier()); + .insert(import_name.clone(), Package::from(dependency).to_string()); } } /// Form an path identifier for a package. It is the path under which package is stored /// inside the `imports/` directory. - pub fn to_identifier(&self) -> String { + pub fn to_string(&self) -> String { format!("{}-{}@{}", self.author, self.name, self.version) } } From 9cc2a8e2d1600e02f860c7e0a102018da184a7b1 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 19 Jul 2021 18:37:52 +0300 Subject: [PATCH 13/62] clippy fix --- package/src/root/lock_file.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/src/root/lock_file.rs b/package/src/root/lock_file.rs index 1b06dff826..c4ef91215c 100644 --- a/package/src/root/lock_file.rs +++ b/package/src/root/lock_file.rs @@ -30,7 +30,7 @@ pub const LOCKFILE_FILENAME: &str = "Leo.lock"; /// Lock-file struct, contains all information about imported dependencies /// and their relationships. -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Default, Debug, Clone, Serialize, Deserialize)] pub struct LockFile { pub package: Vec, } From 0b338d7d78e3e3def5647f5e5bc8497ad3564eca Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 19 Jul 2021 19:01:22 +0300 Subject: [PATCH 14/62] update leo-package README --- package/README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/package/README.md b/package/README.md index dc16bf3844..563104abfc 100644 --- a/package/README.md +++ b/package/README.md @@ -4,6 +4,27 @@ [![Authors](https://img.shields.io/badge/authors-Aleo-orange.svg)](../AUTHORS) [![License](https://img.shields.io/badge/License-GPLv3-blue.svg)](./LICENSE.md) -This module defines the structure of a Leo project package. +## Description -Each file in this directory mirrors a corresponding file generated in a new Leo project package. +This module defines the structure of a Leo project package. And describes behavior of package internals, such +as Leo Manifest (Leo.toml), Lock File (Leo.lock), source files and imports. + +Mainly used by Leo binary. + +## Structure + +Each directory in this crate mirrors a corresponding file generated in a new Leo project package: + +``` +package/src +├── errors # crate level error definitions +├── imports # program imports management +├── inputs # program inputs directory +├── outputs # program outputs directory +├── root # program root: Leo.toml, Leo.lock +└── source # source files directory +``` + +## Testing + +Package features functional tests in the `tests/` directory. From 50eae0d2788912036d3f9710ca7849fb84d82b35 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 19 Jul 2021 19:53:20 +0300 Subject: [PATCH 15/62] fix ci --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d224721e0c..6a45390dc4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -213,9 +213,9 @@ workflows: - leo-setup: requires: - leo-executable - - leo-add-remove: - requires: - - leo-executable + # - leo-add-remove: + # requires: + # - leo-executable - leo-check-constraints: requires: - leo-executable From f80717afef769971b7a3d19fb6c78e4de15ec5e4 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 19 Jul 2021 22:13:34 +0300 Subject: [PATCH 16/62] more clippy --- package/src/root/lock_file.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package/src/root/lock_file.rs b/package/src/root/lock_file.rs index c4ef91215c..c04e4b478a 100644 --- a/package/src/root/lock_file.rs +++ b/package/src/root/lock_file.rs @@ -21,6 +21,7 @@ use std::{ borrow::Cow, collections::HashMap, convert::TryFrom, + fmt::{self, Display}, fs::File, io::{Read, Write}, path::Path, @@ -130,11 +131,13 @@ impl Package { .insert(import_name.clone(), Package::from(dependency).to_string()); } } +} +impl Display for Package { /// Form an path identifier for a package. It is the path under which package is stored /// inside the `imports/` directory. - pub fn to_string(&self) -> String { - format!("{}-{}@{}", self.author, self.name, self.version) + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}-{}@{}", self.author, self.name, self.version) } } From 7f6df6c41d6e7fbf9716bd2a846d8b9479841872 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 20 Jul 2021 00:39:03 +0300 Subject: [PATCH 17/62] fix clippy again --- leo/commands/package/add.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leo/commands/package/add.rs b/leo/commands/package/add.rs index 4b2d147bb5..afc2431ec8 100644 --- a/leo/commands/package/add.rs +++ b/leo/commands/package/add.rs @@ -125,7 +125,7 @@ impl Command for Add { // Dumb compatibility hack. // TODO: Remove once `leo add` functionality is discussed. if self.version.is_some() { - path.push(format!("{}-{}@{}", author.clone(), package_name, self.version.unwrap())); + path.push(format!("{}-{}@{}", author, package_name, self.version.unwrap())); } else { path.push(package_name.clone()); } From f245937ef9df3b1d06d762ebb3acba5da4b651d5 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 22 Jul 2021 16:10:36 +0300 Subject: [PATCH 18/62] fix incorrect argument parsing in leo build --- compiler/src/option.rs | 2 +- leo/commands/build.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/src/option.rs b/compiler/src/option.rs index 36617d3a30..54d85e2317 100644 --- a/compiler/src/option.rs +++ b/compiler/src/option.rs @@ -17,7 +17,7 @@ /// /// Toggles compiler optimizations on the program. /// -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct CompilerOptions { pub canonicalization_enabled: bool, pub constant_folding_enabled: bool, diff --git a/leo/commands/build.rs b/leo/commands/build.rs index 7c6c408214..695c9f02dc 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -59,10 +59,10 @@ pub struct BuildOptions { impl Default for BuildOptions { fn default() -> Self { Self { - disable_canonicalization: true, - disable_constant_folding: true, - disable_code_elimination: true, - disable_all_optimizations: true, + disable_canonicalization: false, + disable_constant_folding: false, + disable_code_elimination: false, + disable_all_optimizations: false, enable_all_ast_snapshots: false, enable_initial_ast_snapshot: false, enable_canonicalized_ast_snapshot: false, @@ -73,11 +73,11 @@ impl Default for BuildOptions { impl From for CompilerOptions { fn from(options: BuildOptions) -> Self { - if !options.disable_all_optimizations { + if options.disable_all_optimizations { CompilerOptions { - canonicalization_enabled: true, - constant_folding_enabled: true, - dead_code_elimination_enabled: true, + canonicalization_enabled: false, + constant_folding_enabled: false, + dead_code_elimination_enabled: false, } } else { CompilerOptions { From de6ae99b20efd2b89d416cd95feef442ca633ff8 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 22 Jul 2021 16:43:17 +0300 Subject: [PATCH 19/62] make canonicalization a must in imports --- imports/src/parser/parse_symbol.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/imports/src/parser/parse_symbol.rs b/imports/src/parser/parse_symbol.rs index 3a09506546..6a49813e6e 100644 --- a/imports/src/parser/parse_symbol.rs +++ b/imports/src/parser/parse_symbol.rs @@ -54,7 +54,13 @@ impl<'a> ImportParser<'a> { // Build the package abstract syntax tree. let program_string = &std::fs::read_to_string(&file_path).map_err(|x| ImportParserError::io_error(span, file_path_str, x))?; - let mut ast = leo_parser::parse(&file_path_str, &program_string)?; + let mut ast = leo_parser::parse_ast(&file_path_str, &program_string)?; + if let Err(_) = ast.canonicalize() { + todo!("Import canonicalization failed. Conversion to ImportError is not implemented."); + }; + + let mut ast = ast.into_repr(); + ast.name = file_name; Ok(ast) } From 1ebd4fb741541ce28ff528b5e4454e286245b6b2 Mon Sep 17 00:00:00 2001 From: damirka Date: Fri, 23 Jul 2021 10:04:55 +0300 Subject: [PATCH 20/62] always enable canonicalization --- compiler/src/compiler.rs | 10 ++++------ compiler/src/option.rs | 2 -- leo/commands/build.rs | 11 ----------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 16e67a421b..b8b507db0d 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -253,13 +253,11 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { ast.to_json_file(self.output_directory.clone(), "initial_ast.json")?; } - // Preform compiler optimization via canonicalizing AST if its enabled. - if self.options.canonicalization_enabled { - ast.canonicalize()?; + // Always canonicalize AST. + ast.canonicalize()?; - if self.ast_snapshot_options.canonicalized { - ast.to_json_file(self.output_directory.clone(), "canonicalization_ast.json")?; - } + if self.ast_snapshot_options.canonicalized { + ast.to_json_file(self.output_directory.clone(), "canonicalization_ast.json")?; } // Store the main program file. diff --git a/compiler/src/option.rs b/compiler/src/option.rs index 54d85e2317..f163cec5ad 100644 --- a/compiler/src/option.rs +++ b/compiler/src/option.rs @@ -19,7 +19,6 @@ /// #[derive(Clone, Debug)] pub struct CompilerOptions { - pub canonicalization_enabled: bool, pub constant_folding_enabled: bool, pub dead_code_elimination_enabled: bool, } @@ -30,7 +29,6 @@ impl Default for CompilerOptions { /// fn default() -> Self { CompilerOptions { - canonicalization_enabled: true, constant_folding_enabled: true, dead_code_elimination_enabled: true, } diff --git a/leo/commands/build.rs b/leo/commands/build.rs index 695c9f02dc..96debbd1c2 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -38,8 +38,6 @@ use tracing::span::Span; /// require Build command output as their input. #[derive(StructOpt, Clone, Debug)] pub struct BuildOptions { - #[structopt(long, help = "Disable canonicaliztion compiler optimization")] - pub disable_canonicalization: bool, #[structopt(long, help = "Disable constant folding compiler optimization")] pub disable_constant_folding: bool, #[structopt(long, help = "Disable dead code elimination compiler optimization")] @@ -59,7 +57,6 @@ pub struct BuildOptions { impl Default for BuildOptions { fn default() -> Self { Self { - disable_canonicalization: false, disable_constant_folding: false, disable_code_elimination: false, disable_all_optimizations: false, @@ -75,13 +72,11 @@ impl From for CompilerOptions { fn from(options: BuildOptions) -> Self { if options.disable_all_optimizations { CompilerOptions { - canonicalization_enabled: false, constant_folding_enabled: false, dead_code_elimination_enabled: false, } } else { CompilerOptions { - canonicalization_enabled: !options.disable_canonicalization, constant_folding_enabled: !options.disable_constant_folding, dead_code_elimination_enabled: !options.disable_code_elimination, } @@ -174,12 +169,6 @@ impl Command for Build { // Log compilation of files to console tracing::info!("Compiling main program... ({:?})", main_file_path); - if self.compiler_options.disable_canonicalization && self.compiler_options.enable_canonicalized_ast_snapshot { - tracing::warn!( - "Can not ask for canonicalization theorem without having canonicalization compiler feature enabled." - ); - } - let imports_map = if context.lock_file_exists()? { context.lock_file()?.to_import_map() } else { From 77192723d0829b4697d0f642b2ac49725aa9cb77 Mon Sep 17 00:00:00 2001 From: damirka Date: Fri, 23 Jul 2021 14:14:48 +0300 Subject: [PATCH 21/62] fix bug in detecting recursive dependencies --- Cargo.lock | 1 + leo/commands/package/fetch.rs | 5 ++--- package/Cargo.toml | 3 +++ package/src/root/lock_file.rs | 7 ++++--- package/src/root/manifest.rs | 7 ++++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e728d5696..4588fae0f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1326,6 +1326,7 @@ version = "1.5.2" name = "leo-package" version = "1.5.2" dependencies = [ + "indexmap", "lazy_static", "serde", "thiserror", diff --git a/leo/commands/package/fetch.rs b/leo/commands/package/fetch.rs index 4a2615c83f..0dbc82b38b 100644 --- a/leo/commands/package/fetch.rs +++ b/leo/commands/package/fetch.rs @@ -25,8 +25,7 @@ use leo_package::root::{ }; use anyhow::{anyhow, Result}; -use indexmap::set::IndexSet; -use std::collections::HashMap; +use indexmap::{set::IndexSet, IndexMap}; use structopt::StructOpt; use tracing::span::Span; @@ -85,7 +84,7 @@ impl Fetch { context: Context, mut tree: IndexSet, lock_file: &mut LockFile, - dependencies: HashMap, + dependencies: IndexMap, ) -> Result<()> { // Go through each dependency in Leo.toml and add it to the imports. // While adding, pull dependencies of this package as well and check for recursion. diff --git a/package/Cargo.toml b/package/Cargo.toml index 15778e7ea7..328f6c14ae 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -17,6 +17,9 @@ include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ] license = "GPL-3.0" edition = "2018" +[dependencies.indexmap] +version = "1.7" + [dependencies.serde] version = "1.0" features = [ "derive" ] diff --git a/package/src/root/lock_file.rs b/package/src/root/lock_file.rs index c04e4b478a..2808287927 100644 --- a/package/src/root/lock_file.rs +++ b/package/src/root/lock_file.rs @@ -16,6 +16,7 @@ use crate::{errors::LockFileError, root::Dependency}; +use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use std::{ borrow::Cow, @@ -43,8 +44,8 @@ pub struct Package { pub version: String, pub author: String, pub import_name: Option, - #[serde(skip_serializing_if = "HashMap::is_empty", default)] - pub dependencies: HashMap, + #[serde(skip_serializing_if = "IndexMap::is_empty", default)] + pub dependencies: IndexMap, } impl LockFile { @@ -125,7 +126,7 @@ impl TryFrom<&Path> for LockFile { impl Package { /// Fill dependencies from Leo Manifest data. - pub fn add_dependencies(&mut self, dependencies: &HashMap) { + pub fn add_dependencies(&mut self, dependencies: &IndexMap) { for (import_name, dependency) in dependencies.iter() { self.dependencies .insert(import_name.clone(), Package::from(dependency).to_string()); diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index e738464209..a15a8957bd 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -16,6 +16,7 @@ use crate::{errors::ManifestError, package::Package}; +use indexmap::IndexMap; use serde::Deserialize; use std::{ borrow::Cow, @@ -45,7 +46,7 @@ pub struct Dependency { pub struct Manifest { pub project: Package, pub remote: Option, - pub dependencies: Option>, + pub dependencies: Option>, } impl Manifest { @@ -53,7 +54,7 @@ impl Manifest { Ok(Self { project: Package::new(package_name)?, remote: author.map(|author| Remote { author }), - dependencies: Some(HashMap::::new()), + dependencies: Some(IndexMap::::new()), }) } @@ -81,7 +82,7 @@ impl Manifest { self.project.description.clone() } - pub fn get_package_dependencies(&self) -> Option> { + pub fn get_package_dependencies(&self) -> Option> { self.dependencies.clone() } From fbb33647113351805a87cdcf44038615abb5cae9 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 28 Jul 2021 17:38:24 +0300 Subject: [PATCH 22/62] fix featureset --- Cargo.toml | 1 + package/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index af0abb2702..4667219476 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,6 +114,7 @@ version = "0.3.1" [dependencies.indexmap] version = "1.7" +features = ["serde"] [dependencies.lazy_static] version = "1.4.0" diff --git a/package/Cargo.toml b/package/Cargo.toml index 328f6c14ae..43f645d7d9 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -19,6 +19,7 @@ edition = "2018" [dependencies.indexmap] version = "1.7" +features = ["serde"] [dependencies.serde] version = "1.0" From 595ae607f9a25c4f6c6d1eea3506573ebf691b54 Mon Sep 17 00:00:00 2001 From: damirka Date: Fri, 30 Jul 2021 15:36:43 +0300 Subject: [PATCH 23/62] draft CI for acl2 -- without binaries --- .github/workflows/acl2.yml | 74 ++++++++++++++++++++++++++++++++++++++ Cargo.lock | 5 +++ test-framework/Cargo.toml | 22 ++++++++++++ test-framework/src/test.rs | 2 +- 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/acl2.yml diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml new file mode 100644 index 0000000000..3c2bad771b --- /dev/null +++ b/.github/workflows/acl2.yml @@ -0,0 +1,74 @@ +name: Leo-ACL2 +on: + push: +env: + RUST_BACKTRACE: 1 + +jobs: + acl2: + name: leo-acl2 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + + - name: Prepare tgc + run: | + cd acl2 && gunzip leo-acl2.lx86cl64.gz + ls -la . + + - name: Generate asts + run: | + cargo run -p leo-test-framework --bin tgc + ls -l tmp + + - name: Run tgc over the asts + run: | + for dir in `ls tmp/tgc`; + do + # enter the directory + cd tmp/tgc/$dir; + + # run tgc over the files in this directory + ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp + + # go back to the root path + cd ../../.. + done + + # - name: Run files generation for pedersen hash + # run: | + # mkdir TEMPDIR && cd TEMPDIR + # ls -la + # cargo run -p stages -- \ + # --file ../examples/pedersen-hash/src/main.leo \ + # --input ../examples/pedersen-hash/inputs/pedersen-hash.in --all + + # - name: Run leo-acl2 executable + # run: | + # ls -la stages + # cd stages && gunzip leo-acl2.lx86cl64.gz && cd .. + # pwd + + # export TEMPLATE_DIR="$(pwd)/stages/" + + # cd TEMPDIR + # ls -la + # pwd + + # # print command + # cat << EOF + # (tgc "$TEMPLATE_DIR" "th.lisp" "initial.json" "canonicalization.json") + # EOF + + # # run command + # cat << EOF | ../stages/leo-acl2 + # (tgc "$TEMPLATE_DIR" "th.lisp" "initial.json" "canonicalization.json") + # EOF diff --git a/Cargo.lock b/Cargo.lock index f109d381e2..17ef491a76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1378,6 +1378,11 @@ dependencies = [ name = "leo-test-framework" version = "1.5.3" dependencies = [ + "leo-asg", + "leo-ast", + "leo-compiler", + "leo-imports", + "leo-parser", "serde", "serde_json", "serde_yaml", diff --git a/test-framework/Cargo.toml b/test-framework/Cargo.toml index fa5440225b..c4a3de6db4 100644 --- a/test-framework/Cargo.toml +++ b/test-framework/Cargo.toml @@ -26,3 +26,25 @@ version = "1.0" [dependencies.serde_yaml] version = "0.8" + +# List of dependencies for tgc binary; + +[dependencies.leo-ast] +path = "../ast" +version = "1.5.2" + +[dependencies.leo-parser] +path = "../parser" +version = "1.5.2" + +[dependencies.leo-imports] +path = "../imports" +version = "1.5.2" + +[dependencies.leo-asg] +path = "../asg" +version = "1.5.2" + +[dependencies.leo-compiler] +path = "../compiler" +version = "1.5.2" diff --git a/test-framework/src/test.rs b/test-framework/src/test.rs index ba129c39ab..dc3d0871f5 100644 --- a/test-framework/src/test.rs +++ b/test-framework/src/test.rs @@ -22,7 +22,7 @@ pub enum TestExpectationMode { Fail, } -#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TestConfig { pub namespace: String, pub expectation: TestExpectationMode, From 64e343298562352c8815db289e6699effa786b92 Mon Sep 17 00:00:00 2001 From: damirka Date: Fri, 30 Jul 2021 15:46:31 +0300 Subject: [PATCH 24/62] change to stable toolchain --- .github/workflows/acl2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 3c2bad771b..7c9d0820fd 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -16,7 +16,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true - name: Prepare tgc From 32784748993cded5a2ab5e7ea1073b57012cb126 Mon Sep 17 00:00:00 2001 From: damirka Date: Fri, 30 Jul 2021 15:49:58 +0300 Subject: [PATCH 25/62] adds bin target --- test-framework/Cargo.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test-framework/Cargo.toml b/test-framework/Cargo.toml index c4a3de6db4..fe8d2145b5 100644 --- a/test-framework/Cargo.toml +++ b/test-framework/Cargo.toml @@ -48,3 +48,9 @@ version = "1.5.2" [dependencies.leo-compiler] path = "../compiler" version = "1.5.2" + + +[[bin]] +name = "tgc" +test = false +bench = false From d32982990868be3d05ba8c7f2a23e00cce6117e3 Mon Sep 17 00:00:00 2001 From: damirka Date: Fri, 30 Jul 2021 15:53:29 +0300 Subject: [PATCH 26/62] remove gitignore --- test-framework/.gitignore | 1 + test-framework/Cargo.toml | 6 -- test-framework/src/bin/tgc.rs | 105 ++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 test-framework/.gitignore create mode 100644 test-framework/src/bin/tgc.rs diff --git a/test-framework/.gitignore b/test-framework/.gitignore new file mode 100644 index 0000000000..ef4cd56d9d --- /dev/null +++ b/test-framework/.gitignore @@ -0,0 +1 @@ +!src/bin diff --git a/test-framework/Cargo.toml b/test-framework/Cargo.toml index fe8d2145b5..c4a3de6db4 100644 --- a/test-framework/Cargo.toml +++ b/test-framework/Cargo.toml @@ -48,9 +48,3 @@ version = "1.5.2" [dependencies.leo-compiler] path = "../compiler" version = "1.5.2" - - -[[bin]] -name = "tgc" -test = false -bench = false diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs new file mode 100644 index 0000000000..a035382095 --- /dev/null +++ b/test-framework/src/bin/tgc.rs @@ -0,0 +1,105 @@ +// Copyright (C) 2019-2021 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 leo_test_framework::{ + fetch::find_tests, + test::{extract_test_config, TestExpectationMode as Expectation}, +}; +// use leo_test_framework::runner::{Runner, Namespace}; + +use leo_asg::Asg; +use leo_compiler::{compiler::thread_leaked_context, TypeInferencePhase}; +use leo_imports::ImportParser; + +use std::{ + error::Error, + path::{Path, PathBuf}, +}; + +use std::fs; + +fn main() -> Result<(), Box> { + let mut tests = Vec::new(); + let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + test_dir.push("../tests/"); + + find_tests(&test_dir, &mut tests); + + if !Path::new("tmp").exists() { + fs::create_dir("tmp")?; + } + + if !Path::new("tmp/tgc").exists() { + fs::create_dir("tmp/tgc")?; + } + + // Prepare directory for placing results. + for (index, (path, text)) in tests.iter().enumerate() { + if let Some(config) = extract_test_config(text) { + // Skip namespaces that we don't need; also skip failure tests. + if config.namespace != "Compile" || config.expectation == Expectation::Fail { + continue; + } + + let mut test_name = path + .split(std::path::MAIN_SEPARATOR) + .last() + .unwrap() + .replace(".leo", ""); + + test_name.push_str(&format!("_{}", index)); + + // Create directory for this file. + let mut target = PathBuf::from("tmp/tgc"); + target.push(test_name); + fs::create_dir(target.clone())?; + + // Write all files into the directory. + let (initial, canonicalized, _type_inferenced) = generate_asts(path, text)?; + + target.push("initial_ast.json"); + fs::write(target.clone(), initial)?; + target.pop(); + + target.push("canonicalization_ast.json"); + fs::write(target.clone(), canonicalized)?; + } + } + + Ok(()) +} + +/// Do what Compiler does - prepare 3 stages of AST: initial, canonicalized and type_inferenced +fn generate_asts(path: &String, text: &String) -> Result<(String, String, String), Box> { + let mut ast = leo_parser::parse_ast(path, text)?; + let initial = ast.to_json_string()?; + + ast.canonicalize()?; + let canonicalized = ast.to_json_string()?; + + let asg = Asg::new( + thread_leaked_context(), + &ast, + &mut ImportParser::new(PathBuf::from(path)), + )?; + + let type_inferenced = TypeInferencePhase::default() + .phase_ast(&ast.into_repr(), &asg.clone().into_repr()) + .expect("Failed to produce type inference ast.") + .to_json_string()?; + + Ok((initial, canonicalized, type_inferenced)) +} From 98ee5af387df3983eb04c74294da6ab791ebb1c8 Mon Sep 17 00:00:00 2001 From: damirka Date: Fri, 30 Jul 2021 18:13:14 +0300 Subject: [PATCH 27/62] collect failures --- .github/workflows/acl2.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 7c9d0820fd..eaa407a830 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -31,17 +31,18 @@ jobs: - name: Run tgc over the asts run: | + ARRAY=(); for dir in `ls tmp/tgc`; do - # enter the directory - cd tmp/tgc/$dir; - - # run tgc over the files in this directory - ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp - - # go back to the root path + cd tmp/tgc/$dir; # enter the directory + ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp || ARRAY+=("$dir"); cd ../../.. - done + done; + echo "Failures:"; + for i in ${ARRAY[@]}; + do + echo $i; + done; # - name: Run files generation for pedersen hash # run: | From cb5a5eb0f4d4d99aa365221defc83a8fa2ea2363 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 2 Aug 2021 17:34:03 +0300 Subject: [PATCH 28/62] Adds structopt --- Cargo.lock | 1 + test-framework/Cargo.toml | 3 ++ test-framework/src/bin/tgc.rs | 65 +++++++++++++++++++++++++---------- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17ef491a76..bc2e671e06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1386,6 +1386,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", + "structopt", ] [[package]] diff --git a/test-framework/Cargo.toml b/test-framework/Cargo.toml index c4a3de6db4..b471480d24 100644 --- a/test-framework/Cargo.toml +++ b/test-framework/Cargo.toml @@ -48,3 +48,6 @@ version = "1.5.2" [dependencies.leo-compiler] path = "../compiler" version = "1.5.2" + +[dependencies.structopt] +version = "0.3" diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs index a035382095..04c4212ce8 100644 --- a/test-framework/src/bin/tgc.rs +++ b/test-framework/src/bin/tgc.rs @@ -14,36 +14,45 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +use leo_asg::Asg; +use leo_compiler::{compiler::thread_leaked_context, TypeInferencePhase}; +use leo_imports::ImportParser; use leo_test_framework::{ fetch::find_tests, test::{extract_test_config, TestExpectationMode as Expectation}, }; -// use leo_test_framework::runner::{Runner, Namespace}; -use leo_asg::Asg; -use leo_compiler::{compiler::thread_leaked_context, TypeInferencePhase}; -use leo_imports::ImportParser; +use std::{error::Error, fs, path::PathBuf}; +use structopt::{clap::AppSettings, StructOpt}; -use std::{ - error::Error, - path::{Path, PathBuf}, -}; +#[derive(StructOpt)] +#[structopt(name = "ast-stages-generator", author = "The Aleo Team ", setting = AppSettings::ColoredHelp)] +struct Opt { + #[structopt( + short, + long, + help = "Path to the output folder (auto generated)", + default_value = "tmp/tgc" + )] + path: PathBuf, -use std::fs; + #[structopt(short, long, help = "Filter test names and run only matching")] + filter: Option, +} -fn main() -> Result<(), Box> { +fn main() { + handle_error(run_with_args(Opt::from_args())); +} + +fn run_with_args(opt: Opt) -> Result<(), Box> { + // Variable that stores all the tests. let mut tests = Vec::new(); let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); test_dir.push("../tests/"); - find_tests(&test_dir, &mut tests); - if !Path::new("tmp").exists() { - fs::create_dir("tmp")?; - } - - if !Path::new("tmp/tgc").exists() { - fs::create_dir("tmp/tgc")?; + if !opt.path.exists() { + fs::create_dir_all(&opt.path)?; } // Prepare directory for placing results. @@ -60,12 +69,22 @@ fn main() -> Result<(), Box> { .unwrap() .replace(".leo", ""); + // Filter out the tests that do not match pattern, if pattern is set. + if let Some(filter) = &opt.filter { + if !test_name.contains(filter) { + continue; + } + } + test_name.push_str(&format!("_{}", index)); // Create directory for this file. let mut target = PathBuf::from("tmp/tgc"); target.push(test_name); - fs::create_dir(target.clone())?; + + if !target.exists() { + fs::create_dir_all(target.clone())?; + } // Write all files into the directory. let (initial, canonicalized, _type_inferenced) = generate_asts(path, text)?; @@ -103,3 +122,13 @@ fn generate_asts(path: &String, text: &String) -> Result<(String, String, String Ok((initial, canonicalized, type_inferenced)) } + +fn handle_error(res: Result<(), Box>) { + match res { + Ok(_) => (), + Err(err) => { + eprintln!("Error: {}", err); + std::process::exit(1); + } + } +} From 1792ef49931174b15c6860f6de274ab9c2461758 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 2 Aug 2021 18:05:19 +0300 Subject: [PATCH 29/62] attmpt to fix 1217 (rebased) --- ast/src/reducer/canonicalization.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 0e14208fc1..3d207276f9 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -263,6 +263,14 @@ impl Canonicalizer { }); } Expression::CircuitStaticFunctionAccess(circuit_static_func_access) => { + // dbg!(&circuit_static_func_access.name); + // dbg!(&circuit_static_func_access.circuit); + + // let canonicalized_name = self.canonicalize_expression(&circuit_static_func_access.circuit); + + // dbg!(&canonicalized_name); + // dbg!(circuit_static_func_access.name.clone()); + return Expression::CircuitStaticFunctionAccess(CircuitStaticFunctionAccessExpression { circuit: Box::new(self.canonicalize_expression(&circuit_static_func_access.circuit)), name: circuit_static_func_access.name.clone(), @@ -278,10 +286,13 @@ impl Canonicalizer { } Expression::Identifier(identifier) => { if identifier.name.as_ref() == "Self" && self.circuit_name.is_some() { - return Expression::Identifier(self.circuit_name.as_ref().unwrap().clone()); + let name = self.circuit_name.as_ref().unwrap().clone(); + + dbg!(&name); + return Expression::Identifier(name); } } - _ => {} + _ => (), } expression.clone() From 97645eb443ac242fde0a88441c9bf0abd6dd5e66 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 2 Aug 2021 18:22:07 +0300 Subject: [PATCH 30/62] remove comments, update circleci to rust 1.54 --- .circleci/config.yml | 22 ++++++++++----------- .github/workflows/acl2.yml | 30 ----------------------------- ast/src/reducer/canonicalization.rs | 8 -------- 3 files changed, 11 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5853674ed5..7de018f8ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,7 +61,7 @@ jobs: clippy: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - checkout @@ -118,7 +118,7 @@ jobs: leo-executable: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - checkout @@ -136,7 +136,7 @@ jobs: leo-new: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -149,7 +149,7 @@ jobs: leo-init: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -162,7 +162,7 @@ jobs: leo-clean: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -175,7 +175,7 @@ jobs: leo-setup: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -188,7 +188,7 @@ jobs: leo-add-remove: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -201,7 +201,7 @@ jobs: leo-check-constraints: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -214,7 +214,7 @@ jobs: leo-login-logout: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -227,7 +227,7 @@ jobs: leo-clone: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: @@ -240,7 +240,7 @@ jobs: leo-publish: docker: - - image: cimg/rust:1.53 + - image: cimg/rust:1.54 resource_class: xlarge steps: - attach_workspace: diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index eaa407a830..671fe21bee 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -43,33 +43,3 @@ jobs: do echo $i; done; - - # - name: Run files generation for pedersen hash - # run: | - # mkdir TEMPDIR && cd TEMPDIR - # ls -la - # cargo run -p stages -- \ - # --file ../examples/pedersen-hash/src/main.leo \ - # --input ../examples/pedersen-hash/inputs/pedersen-hash.in --all - - # - name: Run leo-acl2 executable - # run: | - # ls -la stages - # cd stages && gunzip leo-acl2.lx86cl64.gz && cd .. - # pwd - - # export TEMPLATE_DIR="$(pwd)/stages/" - - # cd TEMPDIR - # ls -la - # pwd - - # # print command - # cat << EOF - # (tgc "$TEMPLATE_DIR" "th.lisp" "initial.json" "canonicalization.json") - # EOF - - # # run command - # cat << EOF | ../stages/leo-acl2 - # (tgc "$TEMPLATE_DIR" "th.lisp" "initial.json" "canonicalization.json") - # EOF diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 3d207276f9..19e04cef4e 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -263,14 +263,6 @@ impl Canonicalizer { }); } Expression::CircuitStaticFunctionAccess(circuit_static_func_access) => { - // dbg!(&circuit_static_func_access.name); - // dbg!(&circuit_static_func_access.circuit); - - // let canonicalized_name = self.canonicalize_expression(&circuit_static_func_access.circuit); - - // dbg!(&canonicalized_name); - // dbg!(circuit_static_func_access.name.clone()); - return Expression::CircuitStaticFunctionAccess(CircuitStaticFunctionAccessExpression { circuit: Box::new(self.canonicalize_expression(&circuit_static_func_access.circuit)), name: circuit_static_func_access.name.clone(), From 4f13716e5b463462f17d07f18bf04dfcc930a633 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 2 Aug 2021 18:23:13 +0300 Subject: [PATCH 31/62] removed dbg --- ast/src/reducer/canonicalization.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 19e04cef4e..019ffe66f4 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -278,10 +278,7 @@ impl Canonicalizer { } Expression::Identifier(identifier) => { if identifier.name.as_ref() == "Self" && self.circuit_name.is_some() { - let name = self.circuit_name.as_ref().unwrap().clone(); - - dbg!(&name); - return Expression::Identifier(name); + return Expression::Identifier(self.circuit_name.as_ref().unwrap().clone()); } } _ => (), From 7d074f368d88617790c0b4dc6d4694989f790489 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 16 Aug 2021 23:26:24 +0300 Subject: [PATCH 32/62] fix import-related issues with tgc --- test-framework/src/bin/tgc.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs index 04c4212ce8..29594aba89 100644 --- a/test-framework/src/bin/tgc.rs +++ b/test-framework/src/bin/tgc.rs @@ -86,8 +86,18 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { fs::create_dir_all(target.clone())?; } + let cwd = config + .extra + .get("cwd") + .map(|val| { + let mut cwd = PathBuf::from(path); + cwd.pop(); + cwd.join(&val.as_str().unwrap()) + }) + .unwrap_or(PathBuf::from(path)); + // Write all files into the directory. - let (initial, canonicalized, _type_inferenced) = generate_asts(path, text)?; + let (initial, canonicalized, _type_inferenced) = generate_asts(cwd, text)?; target.push("initial_ast.json"); fs::write(target.clone(), initial)?; @@ -102,18 +112,14 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { } /// Do what Compiler does - prepare 3 stages of AST: initial, canonicalized and type_inferenced -fn generate_asts(path: &String, text: &String) -> Result<(String, String, String), Box> { - let mut ast = leo_parser::parse_ast(path, text)?; +fn generate_asts(path: PathBuf, text: &String) -> Result<(String, String, String), Box> { + let mut ast = leo_parser::parse_ast(path.clone().into_os_string().into_string().unwrap(), text)?; let initial = ast.to_json_string()?; ast.canonicalize()?; let canonicalized = ast.to_json_string()?; - let asg = Asg::new( - thread_leaked_context(), - &ast, - &mut ImportParser::new(PathBuf::from(path)), - )?; + let asg = Asg::new(thread_leaked_context(), &ast, &mut ImportParser::new(path))?; let type_inferenced = TypeInferencePhase::default() .phase_ast(&ast.into_repr(), &asg.clone().into_repr()) From 031cc980775036ae1581b000c26ba72975d4c779 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 10:44:44 +0300 Subject: [PATCH 33/62] test release fetcher --- .github/workflows/acl2.yml | 64 +++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 671fe21bee..cce87d7dd0 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -12,34 +12,42 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 + # - name: Install Rust + # uses: actions-rs/toolchain@v1 + # with: + # profile: minimal + # toolchain: stable + # override: true + + # - name: Prepare tgc + # run: | + # cd acl2 && gunzip leo-acl2.lx86cl64.gz + # ls -la . + + # - name: Generate asts + # run: | + # cargo run -p leo-test-framework --bin tgc + + - name: Download tgc + uses: pozetroninc/github-action-get-latest-release@master with: - profile: minimal - toolchain: stable - override: true - - - name: Prepare tgc + repository: AleoHQ/leo-acl2-bin + + - name: List files run: | - cd acl2 && gunzip leo-acl2.lx86cl64.gz - ls -la . + ls -la - - name: Generate asts - run: | - cargo run -p leo-test-framework --bin tgc - ls -l tmp - - - name: Run tgc over the asts - run: | - ARRAY=(); - for dir in `ls tmp/tgc`; - do - cd tmp/tgc/$dir; # enter the directory - ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp || ARRAY+=("$dir"); - cd ../../.. - done; - echo "Failures:"; - for i in ${ARRAY[@]}; - do - echo $i; - done; + # - name: Run tgc over the asts + # run: | + # ARRAY=(); + # for dir in `ls tmp/tgc`; + # do + # cd tmp/tgc/$dir; # enter the directory + # ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp || ARRAY+=("$dir"); + # cd ../../.. + # done; + # echo "Failures:"; + # for i in ${ARRAY[@]}; + # do + # echo $i; + # done; From 56ce8558dfdf25bb7a4ef83ae26a47dce7587442 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:03:10 +0300 Subject: [PATCH 34/62] change action to a different one --- .github/workflows/acl2.yml | 7 ++++--- FORMAT_ABNF_GRAMMER.md | 0 2 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 FORMAT_ABNF_GRAMMER.md diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index cce87d7dd0..cd9ec18a55 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -28,10 +28,11 @@ jobs: # run: | # cargo run -p leo-test-framework --bin tgc - - name: Download tgc - uses: pozetroninc/github-action-get-latest-release@master + - name: fetch-latest-release + uses: thebritican/fetch-latest-release@v1 with: - repository: AleoHQ/leo-acl2-bin + repo_path: AleoHQ/leo-acl2-bin + github_token: ${{ github.token }} - name: List files run: | diff --git a/FORMAT_ABNF_GRAMMER.md b/FORMAT_ABNF_GRAMMER.md deleted file mode 100644 index e69de29bb2..0000000000 From e05cca47ffc1cceb1a3bf3b8c719dd1b25606abc Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:04:38 +0300 Subject: [PATCH 35/62] remove version from fetch-latest-release --- .github/workflows/acl2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index cd9ec18a55..d9f1604c70 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -29,7 +29,7 @@ jobs: # cargo run -p leo-test-framework --bin tgc - name: fetch-latest-release - uses: thebritican/fetch-latest-release@v1 + uses: thebritican/fetch-latest-release with: repo_path: AleoHQ/leo-acl2-bin github_token: ${{ github.token }} From b1cf6024d7890df26a47050785a6dba2b6286016 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:06:07 +0300 Subject: [PATCH 36/62] add v2 to action --- .github/workflows/acl2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index d9f1604c70..b9b07ecd2b 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -29,7 +29,7 @@ jobs: # cargo run -p leo-test-framework --bin tgc - name: fetch-latest-release - uses: thebritican/fetch-latest-release + uses: thebritican/fetch-latest-release@v2 with: repo_path: AleoHQ/leo-acl2-bin github_token: ${{ github.token }} From 775109f40c09f852b0ba31aa1fcc163aae305395 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:07:23 +0300 Subject: [PATCH 37/62] yet another change of version --- .github/workflows/acl2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index b9b07ecd2b..2d5a8c67a8 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -29,7 +29,7 @@ jobs: # cargo run -p leo-test-framework --bin tgc - name: fetch-latest-release - uses: thebritican/fetch-latest-release@v2 + uses: thebritican/fetch-latest-release@v2.0.0 with: repo_path: AleoHQ/leo-acl2-bin github_token: ${{ github.token }} From 7e8da8cc80bad14934a6fe3f140ee77cd9214e68 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:10:02 +0300 Subject: [PATCH 38/62] add echo outputs --- .github/workflows/acl2.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 2d5a8c67a8..9179779f16 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -29,6 +29,7 @@ jobs: # cargo run -p leo-test-framework --bin tgc - name: fetch-latest-release + id: tgc uses: thebritican/fetch-latest-release@v2.0.0 with: repo_path: AleoHQ/leo-acl2-bin @@ -37,6 +38,7 @@ jobs: - name: List files run: | ls -la + echo "${{ steps.tgc.outputs }}" # - name: Run tgc over the asts # run: | From a1cc026c58a0ace60fb52f30b44272b474371b1d Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:14:00 +0300 Subject: [PATCH 39/62] use curl to fetch --- .github/workflows/acl2.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 9179779f16..ef7ba082ff 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -28,17 +28,16 @@ jobs: # run: | # cargo run -p leo-test-framework --bin tgc - - name: fetch-latest-release - id: tgc - uses: thebritican/fetch-latest-release@v2.0.0 - with: - repo_path: AleoHQ/leo-acl2-bin - github_token: ${{ github.token }} - - - name: List files + - name: Pull the tgc executable run: | + cd tmp; + curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/latest | \ + sed -n 's/.*"tarball_url": "\(.*\)",.*/\1/p' | \ + xargs -n1 wget -O - -q | \ + tar -xz --strip-components=1 + ls -la - echo "${{ steps.tgc.outputs }}" + tree . # - name: Run tgc over the asts # run: | From 5a1bf7e26e726bf5df6905087b200876ac324a5d Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:15:00 +0300 Subject: [PATCH 40/62] adds mkdir tmp --- .github/workflows/acl2.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index ef7ba082ff..badceeee9c 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -30,6 +30,7 @@ jobs: - name: Pull the tgc executable run: | + mkdir tmp; cd tmp; curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/latest | \ sed -n 's/.*"tarball_url": "\(.*\)",.*/\1/p' | \ From 2ec1065c1843f3e5a744c2c775b557278b8f8c2e Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:16:05 +0300 Subject: [PATCH 41/62] fix pipes, make oneliner --- .github/workflows/acl2.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index badceeee9c..bb5f58adae 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -32,11 +32,7 @@ jobs: run: | mkdir tmp; cd tmp; - curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/latest | \ - sed -n 's/.*"tarball_url": "\(.*\)",.*/\1/p' | \ - xargs -n1 wget -O - -q | \ - tar -xz --strip-components=1 - + curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/latest | sed -n 's/.*"tarball_url": "\(.*\)",.*/\1/p' | xargs -n1 wget -O - -q | tar -xz --strip-components=1 ls -la tree . From a511638021442c9c19542d29ebbef32b4227ae35 Mon Sep 17 00:00:00 2001 From: damirka Date: Tue, 17 Aug 2021 13:27:23 +0300 Subject: [PATCH 42/62] try to run it all together --- .github/workflows/acl2.yml | 67 +++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index bb5f58adae..c1d269622b 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -12,41 +12,42 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # - name: Install Rust - # uses: actions-rs/toolchain@v1 - # with: - # profile: minimal - # toolchain: stable - # override: true + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true - # - name: Prepare tgc - # run: | - # cd acl2 && gunzip leo-acl2.lx86cl64.gz - # ls -la . - - # - name: Generate asts - # run: | - # cargo run -p leo-test-framework --bin tgc + - name: Generate asts + run: | + cargo run -p leo-test-framework --bin tgc + # Pull the latest release from the leo-acl2-bin repo, and put it into the + # repo/acl2 directory. After it's done, unpack the tgz file locally. - name: Pull the tgc executable run: | - mkdir tmp; - cd tmp; - curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/latest | sed -n 's/.*"tarball_url": "\(.*\)",.*/\1/p' | xargs -n1 wget -O - -q | tar -xz --strip-components=1 - ls -la - tree . + mkdir acl2 && cd acl2; + wget $(curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/releases/latest \ + | grep "browser_download_url.*.tgz" \ + | cut -d : -f 2,3 \ + | tr -d \" \ + | xargs) - # - name: Run tgc over the asts - # run: | - # ARRAY=(); - # for dir in `ls tmp/tgc`; - # do - # cd tmp/tgc/$dir; # enter the directory - # ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp || ARRAY+=("$dir"); - # cd ../../.. - # done; - # echo "Failures:"; - # for i in ${ARRAY[@]}; - # do - # echo $i; - # done; + tar -xvzf $(ls) + + # Using the prepared ASTs and the pulled and unzipped tgc run theorem generation. + - name: Run tgc over the asts + run: | + ARRAY=(); + for dir in `ls tmp/tgc`; + do + cd tmp/tgc/$dir; # enter the directory + ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp || ARRAY+=("$dir"); + cd ../../.. + done; + echo "Failures:"; + for i in ${ARRAY[@]}; + do + echo $i; + done; From 56996f989e7265121bb861faa81623ace4a71bd8 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 18 Aug 2021 01:09:45 -0700 Subject: [PATCH 43/62] fix ternary bug --- asg/src/expression/ternary.rs | 10 ++++++++- compiler/src/test.rs | 2 +- .../inputs/ternary_explicit_and_implicit.in | 6 ++++++ .../ternary_explicit_and_implicit.leo | 9 ++++++++ .../tests/import_dependency_folder.leo.out | 6 +++--- .../compiler/import_local/import_all.leo.out | 6 +++--- .../compiler/import_local/import_as.leo.out | 6 +++--- .../compiler/import_local/import_dir.leo.out | 6 +++--- .../import_local/import_files.leo.out | 6 +++--- .../compiler/import_local/import_many.leo.out | 6 +++--- .../import_local/import_weird_names.leo.out | 6 +++--- .../import_weird_names_nested.leo.out | 6 +++--- .../statements/assign_ternary.leo.out | 2 +- .../ternary_explicit_and_implicit.leo.out | 21 +++++++++++++++++++ 14 files changed, 71 insertions(+), 27 deletions(-) create mode 100644 tests/compiler/statements/inputs/ternary_explicit_and_implicit.in create mode 100644 tests/compiler/statements/ternary_explicit_and_implicit.leo create mode 100644 tests/expectations/compiler/compiler/statements/ternary_explicit_and_implicit.leo.out diff --git a/asg/src/expression/ternary.rs b/asg/src/expression/ternary.rs index ee071f05e8..e1aed63b7e 100644 --- a/asg/src/expression/ternary.rs +++ b/asg/src/expression/ternary.rs @@ -86,7 +86,15 @@ impl<'a> FromAst<'a, leo_ast::TernaryExpression> for TernaryExpression<'a> { )?); let left: PartialType = if_true.get().get_type().unwrap().into(); - let if_false = Cell::new(<&Expression<'a>>::from_ast(scope, &*value.if_false, expected_type)?); + let if_false = if expected_type.is_none() { + Cell::new(<&Expression<'a>>::from_ast( + scope, + &*value.if_false, + Some(left.clone()), + )?) + } else { + Cell::new(<&Expression<'a>>::from_ast(scope, &*value.if_false, expected_type)?) + }; let right = if_false.get().get_type().unwrap().into(); if left != right { diff --git a/compiler/src/test.rs b/compiler/src/test.rs index d7ccbdedb5..d87ca4a241 100644 --- a/compiler/src/test.rs +++ b/compiler/src/test.rs @@ -68,7 +68,7 @@ pub(crate) fn parse_program( theorem_options: Option, cwd: Option, ) -> Result { - let mut compiler = new_compiler(cwd.unwrap_or("compiler-test".into()), theorem_options); + let mut compiler = new_compiler(cwd.unwrap_or_else(|| "compiler-test".into()), theorem_options); compiler.parse_program_from_string(program_string)?; diff --git a/tests/compiler/statements/inputs/ternary_explicit_and_implicit.in b/tests/compiler/statements/inputs/ternary_explicit_and_implicit.in new file mode 100644 index 0000000000..ef82e41af8 --- /dev/null +++ b/tests/compiler/statements/inputs/ternary_explicit_and_implicit.in @@ -0,0 +1,6 @@ +[main] +x: u8 = 3; +y: bool = true; + +[registers] +a: u8 = 0; \ No newline at end of file diff --git a/tests/compiler/statements/ternary_explicit_and_implicit.leo b/tests/compiler/statements/ternary_explicit_and_implicit.leo new file mode 100644 index 0000000000..d092bc2928 --- /dev/null +++ b/tests/compiler/statements/ternary_explicit_and_implicit.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/ternary_explicit_and_implicit.in +*/ + +function main(x: u8, y: bool) -> u8 { + return y ? x : 2; +} diff --git a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out index 1eeff43f07..eca3cce173 100644 --- a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out +++ b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: d6273a716c2546b210eeefb640b5c34830fb2b2a4195ae0b636843e855fcbc1e - canonicalized_ast: 41a3c4ffe7c243ffc76bc7d3c147f77f71119d64e632581a20eb1cd576752ac3 - type_inferenced_ast: 196e5191c3d8c8cc552b419422b3e1411fa576336f63ae9d5c340bf2a7d62942 + initial_ast: 8c00ae2b8a4f80635ec9277599592828009931229216fb74e49423175a46ebd4 + canonicalized_ast: 99805c27122348834d2a550baccc61771a2234542e4fdd861fc1bf94403e5bc5 + type_inferenced_ast: e5680b8864a5c8edb6c0ea314ca8cfe2e56eaaabfee94fb09702e3b4f538bc24 diff --git a/tests/expectations/compiler/compiler/import_local/import_all.leo.out b/tests/expectations/compiler/compiler/import_local/import_all.leo.out index af0f7a88be..1420722b1c 100644 --- a/tests/expectations/compiler/compiler/import_local/import_all.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_all.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 - canonicalized_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 - type_inferenced_ast: be1c8166ce3ae7f805d8600441996328ce8f45ada3c16c4284f07d07af52ef75 + initial_ast: f1a1c5fb3d3a5d23c30b3eb7f47aeb1211dbcf6f77a3b1ca262b7c231f4488ef + canonicalized_ast: f1a1c5fb3d3a5d23c30b3eb7f47aeb1211dbcf6f77a3b1ca262b7c231f4488ef + type_inferenced_ast: f5189d9b934533ed5225063ffe1adb59508c53e3951a74c03d6c27d41fc7621a diff --git a/tests/expectations/compiler/compiler/import_local/import_as.leo.out b/tests/expectations/compiler/compiler/import_local/import_as.leo.out index bc897c1c3f..349b1d7033 100644 --- a/tests/expectations/compiler/compiler/import_local/import_as.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_as.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 47ef8cd0b57a42612bc9138c6da6e05fbca27c47464acf5af569c2fe0c91dd31 - canonicalized_ast: 39c0b27ba63cc34eed735900912e154031ca1f291aade9d9964ce49e77eeb19e - type_inferenced_ast: 19bfc761f899b48a3e0c4142bac6cbdaceac8230e92422cf9f6a99d9f7eddc6f + initial_ast: 9b093fc03bf985f26e5e57c0b6508bb515535c79a951c9838a5320ba4a702ed8 + canonicalized_ast: d34e1c3c2bbae1f2103e1b5d4058c607dc78af8f62a254947abb991ec6254eeb + type_inferenced_ast: a76a3eef4ef99bcb1ba050e9d3083106082608e838ea94e0ddbb943583c81483 diff --git a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out index ebbd5184aa..34544231d0 100644 --- a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7e0ba7b09b3840a5d4fc9f0d413163ba2de8f207c3818f604f9a71297aac30f3 - canonicalized_ast: 3f7efb61847fd75fed58b70526da8ceffb573a0806521fb30443f341c3d14a45 - type_inferenced_ast: a1baf614c8ab13c1ff978faf8022f90eef4c482261928cb3256ab4d63e20096c + initial_ast: 2b6234a13e1b49f7ac587ea697e113b600bdf8e05437ce0352264234688b00ee + canonicalized_ast: ed79e2c766f81e1d60b6a9a25b59313d8dd3e93cf9dbd7b9cf2ffc7336ecb3ac + type_inferenced_ast: daf4bdd6a544c2f3da08cd7ab67c40688cb52f0eec2c13fa70fa827f42722674 diff --git a/tests/expectations/compiler/compiler/import_local/import_files.leo.out b/tests/expectations/compiler/compiler/import_local/import_files.leo.out index aaaee96823..2bb28eef96 100644 --- a/tests/expectations/compiler/compiler/import_local/import_files.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_files.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 042e056c86e545ce256459a0de20d44c0bae24ff406becba4330e3208c48e180 - canonicalized_ast: 6cab1ab863f40c96d5d6921e2ced0dd00ebe5e9e334d84508af708be19ae8f59 - type_inferenced_ast: 17ff3e62f1c48edfbfb1c35ed4ac542260b59153d85afeca2e707dde217dc675 + initial_ast: 17d120d595b3bd1276d4566a0bef48a90e0d545556d54b83da89d88b17342a1d + canonicalized_ast: 0f9e739ef57e1d870b2c5410f821d14194dd882e315720f207f83933f5c85fda + type_inferenced_ast: 1ecf52246630058f5b4294b015b787ca175c3189660c5f3135d6456fc011a2b5 diff --git a/tests/expectations/compiler/compiler/import_local/import_many.leo.out b/tests/expectations/compiler/compiler/import_local/import_many.leo.out index b379ba5f2e..e9356a68bc 100644 --- a/tests/expectations/compiler/compiler/import_local/import_many.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_many.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 - canonicalized_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 - type_inferenced_ast: 1c983cf518cfafbe158ee3e42aed5cb190863b09aedfc4dd34e0268160ee79e2 + initial_ast: b8decf097c42e00f24432d5d72b4c4c53f404089b913330e972f81494b4c4bfb + canonicalized_ast: b8decf097c42e00f24432d5d72b4c4c53f404089b913330e972f81494b4c4bfb + type_inferenced_ast: ebba4df8a81de92d3bf06d07ab611429653b570e1620405d246f3de5921055e0 diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out index 22e000786a..e1b5244d5b 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 - canonicalized_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 - type_inferenced_ast: 58541200a815edfee41333b9b2b048add269d0924ca17457ecf9fbcbb5032ccf + initial_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c + canonicalized_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c + type_inferenced_ast: 86ef8ab226a58f140de1fcdadc31eb86e4a1930cabf36a8d9a4607233ea6ab80 diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out index e34d9e527a..fdc2a30cc5 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 - canonicalized_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 - type_inferenced_ast: 50c06c3666a830c7f1fd533c412a4e8054fdb494845f4f5d85414b08f1c1a8dd + initial_ast: 9cd9cca5cd79f5db65ebcc4d90cd9c4aedf2310972eb3146b0057352f1164e48 + canonicalized_ast: 9cd9cca5cd79f5db65ebcc4d90cd9c4aedf2310972eb3146b0057352f1164e48 + type_inferenced_ast: dd2d745566c22b0a07d4340563cccf84492707955ac04f910c3a4edfedcbfcef diff --git a/tests/expectations/compiler/compiler/statements/assign_ternary.leo.out b/tests/expectations/compiler/compiler/statements/assign_ternary.leo.out index 6518a49fff..b8f299ef0b 100644 --- a/tests/expectations/compiler/compiler/statements/assign_ternary.leo.out +++ b/tests/expectations/compiler/compiler/statements/assign_ternary.leo.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - " --> compiler-test:4:13\n |\n 4 | let x = true ? x: true;\n | ^^^^^^^^^^^^^^\n |\n = ternary sides had different types: left u32, right bool" + - " --> compiler-test:4:23\n |\n 4 | let x = true ? x: true;\n | ^^^^\n |\n = unexpected type, expected: 'u32', received: 'bool'" diff --git a/tests/expectations/compiler/compiler/statements/ternary_explicit_and_implicit.leo.out b/tests/expectations/compiler/compiler/statements/ternary_explicit_and_implicit.leo.out new file mode 100644 index 0000000000..6536606697 --- /dev/null +++ b/tests/expectations/compiler/compiler/statements/ternary_explicit_and_implicit.leo.out @@ -0,0 +1,21 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 25 + num_constraints: 33 + at: 00318b0f80b01b9e2d5a8154a536deb1545f04abd493a84071ef13dce1a9d92d + bt: 799ee4dc07f6320b8c3dcbd5ebdf6de8a4cf5af8b1edc45dbe5621c8a34fa38d + ct: 7b6ec9eacd65cfa47dfe7e73eb7c8fa4be804a9fb878fddf59fe5d06e7c04489 + output: + - input_file: inputs/ternary_explicit_and_implicit.in + output: + registers: + a: + type: u8 + value: "3" + initial_ast: 720f64a9f5c18e2522d71e844010cc5d6d5dc390bd3fced327e792bf15488a3d + canonicalized_ast: 720f64a9f5c18e2522d71e844010cc5d6d5dc390bd3fced327e792bf15488a3d + type_inferenced_ast: 8347d144d24c35538a83ca0442204b08a35b2eee2dcb3fe92915421515ef60d1 From cf5a23b38f4c76a1f7e3a4aec5ee52af11598ed6 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 18 Aug 2021 02:04:41 -0700 Subject: [PATCH 44/62] type on call expression --- asg/src/expression/call.rs | 1 + ast/src/expression/call.rs | 2 ++ ast/src/reducer/canonicalization.rs | 1 + ast/src/reducer/reconstructing_director.rs | 8 +++++++- ast/src/reducer/reconstructing_reducer.rs | 2 ++ compiler/src/phases/reducing_director.rs | 7 ++++++- compiler/src/test.rs | 2 +- parser/src/parser/expression.rs | 1 + .../circuits/big_self_in_circuit_replacement.leo.out | 6 +++--- .../compiler/circuits/const_self_variable.leo.out | 6 +++--- .../define_circuit_inside_circuit_function.leo.out | 6 +++--- .../compiler/circuits/duplicate_name_context.leo.out | 6 +++--- .../compiler/circuits/inline_member_pass.leo.out | 6 +++--- .../compiler/compiler/circuits/member_function.leo.out | 6 +++--- .../compiler/circuits/member_function_nested.leo.out | 6 +++--- .../compiler/circuits/member_static_function.leo.out | 6 +++--- .../circuits/member_static_function_nested.leo.out | 6 +++--- .../circuits/member_variable_and_function.leo.out | 6 +++--- .../compiler/compiler/circuits/mut_self_variable.leo.out | 6 +++--- .../compiler/circuits/mut_self_variable_branch.leo.out | 6 +++--- .../circuits/mut_self_variable_conditional.leo.out | 6 +++--- .../circuits/mutable_call_immutable_context.leo.out | 6 +++--- .../compiler/compiler/circuits/pedersen_mock.leo.out | 6 +++--- .../compiler/compiler/circuits/self_member.leo.out | 6 +++--- .../compiler/compiler/function/array_input.leo.out | 6 +++--- .../compiler/function/array_params_direct_call.leo.out | 6 +++--- .../compiler/compiler/function/empty.leo.out | 6 +++--- .../compiler/compiler/function/iteration.leo.out | 6 +++--- .../compiler/function/iteration_repeated.leo.out | 6 +++--- .../compiler/compiler/function/multiple_returns.leo.out | 6 +++--- .../compiler/compiler/function/repeated.leo.out | 6 +++--- .../compiler/compiler/function/return.leo.out | 6 +++--- .../compiler/function/return_array_nested_pass.leo.out | 6 +++--- .../compiler/function/return_array_tuple_pass.leo.out | 6 +++--- .../compiler/compiler/function/return_tuple.leo.out | 6 +++--- .../compiler/function/return_tuple_conditional.leo.out | 6 +++--- .../compiler/compiler/function/value_unchanged.leo.out | 6 +++--- .../compiler/global_consts/global_const_types.leo.out | 6 +++--- .../tests/import_dependency_folder.leo.out | 6 +++--- .../compiler/compiler/import_local/import_all.leo.out | 6 +++--- .../compiler/compiler/import_local/import_as.leo.out | 6 +++--- .../compiler/compiler/import_local/import_dir.leo.out | 6 +++--- .../compiler/compiler/import_local/import_files.leo.out | 6 +++--- .../compiler/compiler/import_local/import_many.leo.out | 6 +++--- .../compiler/import_local/import_weird_names.leo.out | 6 +++--- .../import_local/import_weird_names_nested.leo.out | 6 +++--- .../compiler/mutability/circuit_function_mut.leo.out | 6 +++--- .../compiler/compiler/mutability/swap.leo.out | 6 +++--- .../compiler/compiler/string/circuit.leo.out | 6 +++--- .../parser/parser/expression/access/array_access.leo.out | 4 ++++ .../parser/parser/expression/access/call.leo.out | 9 +++++++++ .../parser/parser/expression/access/circuit.leo.out | 1 + .../parser/expression/access/circuit_static.leo.out | 1 + .../parser/parser/expression/unary/negate.leo.out | 1 + .../parser/parser/expression/unary/not.leo.out | 1 + .../expectations/parser/parser/statement/assign.leo.out | 1 + .../parser/parser/statement/definition.leo.out | 8 ++++++++ .../parser/parser/statement/expression.leo.out | 1 + 58 files changed, 171 insertions(+), 126 deletions(-) diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index 41b7cb0660..9d244a6d09 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -234,6 +234,7 @@ impl<'a> Into for &CallExpression<'a> { function: Box::new(target_function), arguments: self.arguments.iter().map(|arg| arg.get().into()).collect(), span: self.span.clone().unwrap_or_default(), + type_: None, } } } diff --git a/ast/src/expression/call.rs b/ast/src/expression/call.rs index 528b751434..80e57599c1 100644 --- a/ast/src/expression/call.rs +++ b/ast/src/expression/call.rs @@ -15,12 +15,14 @@ // along with the Leo library. If not, see . use super::*; +use crate::Type; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct CallExpression { pub function: Box, // todo: make this identifier? pub arguments: Vec, pub span: Span, + pub type_: Option, } impl fmt::Display for CallExpression { diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 0e14208fc1..a2d28ca856 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -274,6 +274,7 @@ impl Canonicalizer { function: Box::new(self.canonicalize_expression(&call.function)), arguments: call.arguments.clone(), span: call.span.clone(), + type_: call.type_.clone(), }); } Expression::Identifier(identifier) => { diff --git a/ast/src/reducer/reconstructing_director.rs b/ast/src/reducer/reconstructing_director.rs index d7710df122..82fb8d73c5 100644 --- a/ast/src/reducer/reconstructing_director.rs +++ b/ast/src/reducer/reconstructing_director.rs @@ -276,7 +276,13 @@ impl ReconstructingDirector { arguments.push(self.reduce_expression(argument)?); } - self.reducer.reduce_call(call, function, arguments) + let type_ = call + .type_ + .as_ref() + .map(|t| self.reduce_type(t, &call.span)) + .transpose()?; + + self.reducer.reduce_call(call, function, arguments, type_) } // Statements diff --git a/ast/src/reducer/reconstructing_reducer.rs b/ast/src/reducer/reconstructing_reducer.rs index 9bac0a88c7..b9a8d25cb2 100644 --- a/ast/src/reducer/reconstructing_reducer.rs +++ b/ast/src/reducer/reconstructing_reducer.rs @@ -245,11 +245,13 @@ pub trait ReconstructingReducer { call: &CallExpression, function: Expression, arguments: Vec, + type_: Option, ) -> Result { Ok(CallExpression { function: Box::new(function), arguments, span: call.span.clone(), + type_, }) } diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/phases/reducing_director.rs index 49480254e0..13a997c149 100644 --- a/compiler/src/phases/reducing_director.rs +++ b/compiler/src/phases/reducing_director.rs @@ -242,7 +242,12 @@ impl CombineAstAsgDirector { arguments.push(self.reduce_expression(ast_arg, asg_arg.get())?); } - self.ast_reducer.reduce_call(ast, *ast.function.clone(), arguments) + self.ast_reducer.reduce_call( + ast, + *ast.function.clone(), + arguments, + Some((&asg.function.get().output).into()), + ) } pub fn reduce_cast( diff --git a/compiler/src/test.rs b/compiler/src/test.rs index d7ccbdedb5..d87ca4a241 100644 --- a/compiler/src/test.rs +++ b/compiler/src/test.rs @@ -68,7 +68,7 @@ pub(crate) fn parse_program( theorem_options: Option, cwd: Option, ) -> Result { - let mut compiler = new_compiler(cwd.unwrap_or("compiler-test".into()), theorem_options); + let mut compiler = new_compiler(cwd.unwrap_or_else(|| "compiler-test".into()), theorem_options); compiler.parse_program_from_string(program_string)?; diff --git a/parser/src/parser/expression.rs b/parser/src/parser/expression.rs index 789ecaf9de..7cb4948b87 100644 --- a/parser/src/parser/expression.rs +++ b/parser/src/parser/expression.rs @@ -481,6 +481,7 @@ impl ParserContext { span: expr.span() + &end_span, function: Box::new(expr), arguments, + type_: None, }); } Token::DoubleColon => { diff --git a/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out b/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out index 7bd0bf3fb0..0464cb5cbb 100644 --- a/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out +++ b/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: aa87a9d1c477e2d5b7ae824fb434188dd6c5c519dd27ebaecd30e44be401ee1b - canonicalized_ast: f188b62839a17478878fe1dfc9863bac20fa1c0c6cf51eae5e13c5f5f79f6c1a - type_inferenced_ast: 9e838aeeebdd2f800c2e7305614f123c27d8390fbadabf1bcb15dae6466669a6 + initial_ast: d9351a67d0a3093691860449744a2465a814beb534a564f57a37d53792f5f08f + canonicalized_ast: f7c3dc7d004fcafed73cae79767931f87611e69bcce552f96053dc0b15ea8a4e + type_inferenced_ast: d51d2af3e436f0ceba986dbceadf8f7247b1416ae8e8d3ab1bf015db99c22f14 diff --git a/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out b/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out index 0dec0b1733..879b877551 100644 --- a/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: da9350459a9579ec5961fc26b81a67a88060caaaea27448fa02f86271227b213 - canonicalized_ast: da9350459a9579ec5961fc26b81a67a88060caaaea27448fa02f86271227b213 - type_inferenced_ast: 2dd2c4378253f239047ae310657e24dae70ba7181d1cf08d89007c2f1a37d332 + initial_ast: 327b797703790e1684fe4979902355c6758ae43fa48c6433b3143bdfdad3133a + canonicalized_ast: 327b797703790e1684fe4979902355c6758ae43fa48c6433b3143bdfdad3133a + type_inferenced_ast: 2ec3cdaa90f73b1bb5c5152debb88c98b409fa6ee5d016fd9ce1f8324379fbdc diff --git a/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out b/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out index 8423b5b6ec..8e5fbf5c86 100644 --- a/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 583cb3219a67fcbb30d241dec9e2860d99db27b109c8d095c10838ea342efd3c - canonicalized_ast: 583cb3219a67fcbb30d241dec9e2860d99db27b109c8d095c10838ea342efd3c - type_inferenced_ast: bbb33dca916b1310a58492ecd4bc74ed03ef3ab87870391839fc8b627f31e941 + initial_ast: 515f585e21334d2bb218fa8d3969f1ac737c9acee6c2b9cd106169ccafb8337b + canonicalized_ast: 515f585e21334d2bb218fa8d3969f1ac737c9acee6c2b9cd106169ccafb8337b + type_inferenced_ast: 4d2e15d60701432d02975a3303b9996a4c5bfd59d720f24e29eb83602a70dc86 diff --git a/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out b/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out index e477b4a944..5dec1b352c 100644 --- a/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out +++ b/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: e96236da6f97f8472930c05f30db95afa0c914060fe3ee908af57dbc1644f6b8 - canonicalized_ast: e96236da6f97f8472930c05f30db95afa0c914060fe3ee908af57dbc1644f6b8 - type_inferenced_ast: 933e32a944dbeba01b9c1600ccdec94370927087a3a2b5511bdf4767b5fecd7b + initial_ast: a303832f3dc7cb53958278c16b3180121830efc84ea48983c82c7b03a0af7f41 + canonicalized_ast: a303832f3dc7cb53958278c16b3180121830efc84ea48983c82c7b03a0af7f41 + type_inferenced_ast: 129549ca68c1d13bc5dcdb48779dcdbef44b414b7c7e3f5c885edb41b74c0cbf diff --git a/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out b/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out index 86e9316902..978f781a07 100644 --- a/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out +++ b/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 489c3e8ccafc04e118846f4009d93dfbf018902fbdcd1dde6798cc853bcd8903 - canonicalized_ast: 4b8614afcbaf258d87202daa83f1340762d9a90f4edd7723b8a83df74acbbeb1 - type_inferenced_ast: 3e23d0db328e40ffa2a1ced543295650aa724a8b2dc795bbca54a40ca726b59a + initial_ast: eefc49094cd3e72a60f8690f237b7de3ba95a2d0ae4179cba5f6668e30a422a7 + canonicalized_ast: 38338c43ada333b96c1f1bdb4f29dd0d09a54dd2c67a20e5972ef3e77ed5e02c + type_inferenced_ast: 9e307fa3a33017578186ca9147f1e9f236eec53bca9394ac598d90a31cd153aa diff --git a/tests/expectations/compiler/compiler/circuits/member_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_function.leo.out index 206329dc34..29130426af 100644 --- a/tests/expectations/compiler/compiler/circuits/member_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 8eacc56577069bef188ac3bbabbceaca5fb8955af1e8ea74ef52f01ce7bd4516 - canonicalized_ast: 8eacc56577069bef188ac3bbabbceaca5fb8955af1e8ea74ef52f01ce7bd4516 - type_inferenced_ast: d5947d1cd599d713fdaafe3cc1084784639c768d5069151dfe7dd0cb02e28ae2 + initial_ast: 059c922bbe6d6ff0f1d3cef49bfceb1b51767edd60288eaa6e5dd7f4d77a993c + canonicalized_ast: 059c922bbe6d6ff0f1d3cef49bfceb1b51767edd60288eaa6e5dd7f4d77a993c + type_inferenced_ast: e40b9068fdd2c1fed983e636b164e889c7b908f3089ca2fa1867cf08b3c0998a diff --git a/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out b/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out index c36f829b9a..3afd8b3536 100644 --- a/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: f4796f1f9215d0c6d42478aae63b1495dfad36eaaec4a981dddac9def85ffef0 - canonicalized_ast: f4796f1f9215d0c6d42478aae63b1495dfad36eaaec4a981dddac9def85ffef0 - type_inferenced_ast: f808f56c8af9d6677bf54e7f777b3023f82144462df704dc4f3e39830be4c109 + initial_ast: f6b65aa140ab77f8236e091391c5f383fd7e732af1f73fa42c3e40ff9164e767 + canonicalized_ast: f6b65aa140ab77f8236e091391c5f383fd7e732af1f73fa42c3e40ff9164e767 + type_inferenced_ast: dfc38e252034884cc5cb52977390ebe412a11b92cf0363fb16d20021e1c48f07 diff --git a/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out index 6630cd07bc..1322d7f52d 100644 --- a/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 75577795f48b9c4f50fed7051e3d76e4b76e3d3b6896ead606d3ebe925e43d2f - canonicalized_ast: 75577795f48b9c4f50fed7051e3d76e4b76e3d3b6896ead606d3ebe925e43d2f - type_inferenced_ast: 60a0557cf60a23b458e3a7ef25299f3fef8cae5c473446b54bb7e98ed91b70f0 + initial_ast: 7de57d20910bf2474c7a0e8c5c0c55f0b3c6857756c859b50924b2111cde74d4 + canonicalized_ast: 7de57d20910bf2474c7a0e8c5c0c55f0b3c6857756c859b50924b2111cde74d4 + type_inferenced_ast: c527d3bbb5d3148960cbce642d89365408cfd092da611b88d87323bfdf858c13 diff --git a/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out b/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out index 14f7a27016..a7551812c1 100644 --- a/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 4c74b65863cddde8ce523495358ab619ec48645dcb8409658a3fb3d7a3821d6d - canonicalized_ast: 45dc35a683e14503f8a1fc40280f05e7d096b49896f115ffa649e76b9cd80941 - type_inferenced_ast: 11af72cfc90adc12c3412e3067ad285a2279de0f4f12af5081dbe27c58b5a3bf + initial_ast: a476268424c783f771f39d2bc2f554111f5caf991153602b4c113b54e282bce4 + canonicalized_ast: d100e1644f1f35ff51a48f3eb1c2431d905a11d6c671e19a6fed1fefd1df55f8 + type_inferenced_ast: 659b23ba47e1da8cca0a0c2a787958378c2e2fd43a14267f4f8bb7a773271feb diff --git a/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out index 7ede51f889..b8921bb620 100644 --- a/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 033ac2bd59dacfd0e1f551feee772337e15a3c9eca8fa64075b1f6c411b2f235 - canonicalized_ast: 033ac2bd59dacfd0e1f551feee772337e15a3c9eca8fa64075b1f6c411b2f235 - type_inferenced_ast: a90d633d8db0a339186dc314f4de35ed970aec22cfccd423f49824ade7dcf70b + initial_ast: 54b8f1a61d85f9a1bb5dbd7824b780f47bef8ca4d4462aa3c9c7ad0b5391e442 + canonicalized_ast: 54b8f1a61d85f9a1bb5dbd7824b780f47bef8ca4d4462aa3c9c7ad0b5391e442 + type_inferenced_ast: 52de8aa926b165005383977ca4ce8d5d3acb4fc8120d92c1b7c73adc86ab20b8 diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out index a7c760ec44..2ba4d57887 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 35c17de2e9d8a63b29cbeaeeb7eebfa886ff4ae536938e571e953ee206ba8a59 - canonicalized_ast: 8f09ad7c9a20220bf8d9fe7e5c84a7c1e99b840fbeb682fb5646df9a05efbd8b - type_inferenced_ast: b1e1e8b1c22a2c98f82d26a1a339952dbe085366b5dc3bb36d71cf4c842739b9 + initial_ast: c803c46b7078be3961d0196d7b79bb425de7e5071a7ad0c108e7d0f14714000c + canonicalized_ast: 1823e58f37aa59a725075ebf83818e790c1247207cbdbff59f6f04eac5472762 + type_inferenced_ast: e97a1fe23c36faf117b436385e36fc252c27453c4ef755b1baafa38ffb6dc634 diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out index 90c520afac..d3563b0215 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 5654f2be64d7879bfa2cb49029bd6c3b757c0eb28dd32744de41a28effae5891 - canonicalized_ast: 42710d4ec40860cbd1a88da9738960c5a07a6a9937436ec474b3f1bbc805aac4 - type_inferenced_ast: d7f138829083963f935922d492a94a693b963d3acee6fadb325be8d99f0e4d19 + initial_ast: 7556b190f383869fc9049c064c3d5d4e1a825f09f97548b81305b8b9f86820e6 + canonicalized_ast: 56e26b65bcfbf82b38b473c2fce4fd6d83a9801a4f801b0c5613b868790e4d5d + type_inferenced_ast: 1d6dff1a4f155e72b5733132eb15ab32135282dc6a44e4fdb35570a8d7a2f90d diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out index d50ce4095d..e1c09cb327 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 46fccf2a1d04ff7bbfb9a88eeceb6cfd39adcf7ce2e2323d4fb83f4ae3dba273 - canonicalized_ast: 222568f9f7b61876690514fdd2dd12419b2e889269a2b7aabd7223d291167da5 - type_inferenced_ast: f1a5656978bd48409401788332b1a1d90c969178e65af06b54d5b4445be84375 + initial_ast: 36d95903089f19385df16163168141e29ee5fe28bc960676dbde9e55715c2db7 + canonicalized_ast: 543653c12ca68358485d6796f59ec763653256569e1adc02997d0d554796423a + type_inferenced_ast: 35dbeec7a557452e1b486ea8c79fe10adadf0c68bf734cb17c6bffb248ba657c diff --git a/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out b/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out index 5ea932e6db..2b2eea16d7 100644 --- a/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: bd8793749cfd151b89162febc55b6bb6de1be867a0009da6a8470106953db630 - canonicalized_ast: 9ecf61f153db9d0912cae6891258e0ebdaecd0da6eef7bbc92c3a6476c7adf6d - type_inferenced_ast: 6908fc70e763ff518a9942a3b930aac64b70075be1b734c2ac93175ca1f16f97 + initial_ast: 98cd5b5508c5edac06dcb56d30cd3f1a773642cfb5d63c10742308d525cfd0c0 + canonicalized_ast: ec9f20897d08d5c9d526ed730311a1c7a3ef9c5ce02638736c3e74fc444d7bf4 + type_inferenced_ast: d378fbfc968b157945b173c2b085417bc110b4666cb9fac4ec2b184c30d5ec24 diff --git a/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out b/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out index bec7e9cfc6..0a8c668530 100644 --- a/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out +++ b/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: c983e5e79b4325ac133ac1a5ff0b1655c646111389991286322b8c16c5833837 - canonicalized_ast: 8dcb714238ef7e9fd3c66a7a12ec4621bb4e9ac5994f1c692215a9f93463ce9e - type_inferenced_ast: ebd34799bd1c6936ca5032812d2466bade58df616cc06e3c6e57151a06b78601 + initial_ast: 266b11febadc70291d48673112ea7c440fb1aa2592ccb671a5fb0bff198716a6 + canonicalized_ast: 07d69501c44f7436263a55cf1eb0b9c8751210c6e9c05af20427486ca4dcf918 + type_inferenced_ast: e9b8ff04cf3e39a9047534842ccbbcea54b546f9dd3e6e5f6491292f78fb4f71 diff --git a/tests/expectations/compiler/compiler/circuits/self_member.leo.out b/tests/expectations/compiler/compiler/circuits/self_member.leo.out index 5311554177..b83d755fc2 100644 --- a/tests/expectations/compiler/compiler/circuits/self_member.leo.out +++ b/tests/expectations/compiler/compiler/circuits/self_member.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: ef90c67bd868ad3d1362b37acad99a97316700c60c9667a4d67b8ad392b2922c - canonicalized_ast: ef90c67bd868ad3d1362b37acad99a97316700c60c9667a4d67b8ad392b2922c - type_inferenced_ast: 636fbf53660cedd9c05b6c361fae19ae5adaae85adc98e888308072ef843f8fa + initial_ast: f5041463460b2bb46e2183f775b9eadba9a9db05269fb2fdc0a75132b20986eb + canonicalized_ast: f5041463460b2bb46e2183f775b9eadba9a9db05269fb2fdc0a75132b20986eb + type_inferenced_ast: a6edbaff381ce5698634fc7d8d86e1d41b61e568942a5363b9295bf600f33ca1 diff --git a/tests/expectations/compiler/compiler/function/array_input.leo.out b/tests/expectations/compiler/compiler/function/array_input.leo.out index 8204e381f2..afe9366375 100644 --- a/tests/expectations/compiler/compiler/function/array_input.leo.out +++ b/tests/expectations/compiler/compiler/function/array_input.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: cbf1d3fe0106bda529af2912783d2ea0505b9d3780f5ca6954c1caaf3381543a - canonicalized_ast: 711c249e5b0c1ac7f8e9dd96e13bdf1c7449f2f0afa994b9c6430f91b40072a9 - type_inferenced_ast: a96aab38c2fa75d08da2a17ed91efd8128067f9f8ad96e151d0c27a2a55355c3 + initial_ast: e9de1d6ec414781d95bb58b3c34f57814118fe62835aa2809b7cd237e2af0b71 + canonicalized_ast: d93cc125794fdd21067d78d77e75d121e3a642ce646e077288c59dc1fa9b0f20 + type_inferenced_ast: d4c628a0cfdbd899b6cad3f194e971d9fdf5093fc677381279242303b6995932 diff --git a/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out b/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out index db9a7a59a9..bd6d53ac9b 100644 --- a/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out +++ b/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 16b635b136d26f8f9b71d9637bd85aa8449d6a93a558669bb44235f969703cba - canonicalized_ast: f46853ed6440686de4f7ed91623575fe2a040e0672580aa06dd2d6fd54dd51b1 - type_inferenced_ast: b36955c7ea4a3894d5857df754e20b6ee2767d84adab7509d50a645cb78af437 + initial_ast: a8734776306f402a7e801a196eafacc9f3053519bfcf5054f3098ed22ced4a96 + canonicalized_ast: 8f16e0db0f6313da3e960ce7777df567f08183709aaffde8428ded1aa22b20f0 + type_inferenced_ast: c20e6523544c998159b78b9242bf1adafa861f78e0a87ab386425a19482174ab diff --git a/tests/expectations/compiler/compiler/function/empty.leo.out b/tests/expectations/compiler/compiler/function/empty.leo.out index 844180d720..73952aa6bd 100644 --- a/tests/expectations/compiler/compiler/function/empty.leo.out +++ b/tests/expectations/compiler/compiler/function/empty.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 2e31236a963bb214beb942fbb0269ec2c08ddf704fd47ce5d0864b1f1fbb2a7a - canonicalized_ast: 186d0d826a29f428034b8782b79d8e3a0cf810f9dde88b5f1062508322c5d7d5 - type_inferenced_ast: 740b33fa80b8d50c88523daf299d79846430a291dd8b034dd5a01a106270610b + initial_ast: 87fc4d2cb8e0004b35835d4e238a82feb82b0ca2df3e3154e9ef599a169b4af5 + canonicalized_ast: 5fc93adb2d8b7cbbda5997a72e624c07cf70f6d8cb6255eb8febb71782500d04 + type_inferenced_ast: 584dfe2869022148ab27d76c7d9afa3518c38ea606b510c4804a5735de92c9ec diff --git a/tests/expectations/compiler/compiler/function/iteration.leo.out b/tests/expectations/compiler/compiler/function/iteration.leo.out index 16dc886ac5..0449d816a5 100644 --- a/tests/expectations/compiler/compiler/function/iteration.leo.out +++ b/tests/expectations/compiler/compiler/function/iteration.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 96155896f4993bd97a8e15281e92c4e9352ed02343bccddb9c3cd0f8ca55b408 - canonicalized_ast: ae4a2dfa82f00621192f117bea664e58768d57376b68a90ce0e15c5bc9535e22 - type_inferenced_ast: 2452ad985e23efbc07a94f2945d406a959aca68ec37e9c349a30edcc12839c04 + initial_ast: 48ae7b7fccc951d9fd28e76f567f283fb0c834b8f203badf5217e805895902a0 + canonicalized_ast: 944e9a3da4b22873b88a1ab2515e26f3fd3f7370945cee1abacabec7c2088354 + type_inferenced_ast: fe935182e4096851326416dcbd9c68035cb9aa030fe796a46343d11c0c96c461 diff --git a/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out b/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out index 8056fc7df4..cc2b3277d7 100644 --- a/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out +++ b/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 55bf6a745bd0da1684239dd5f624a5ead1d5644c15f25e3099ff40c71ce23317 - canonicalized_ast: 929e1e876d7dd5d04ae39dd8d4b0b3fa3f0e8783e39056941115fff337a0ef84 - type_inferenced_ast: bc6903d0764db54fd4938835120ab6fa02575b1b896828876153bb30da28a19a + initial_ast: bad5d54fa6e1c942d37fd260fb1a833396ef9c6353ea4ad9c06f89a7a420fa14 + canonicalized_ast: 856088367fbf5df78db5194cbc0c346216dbcf01efaa22ed59ac4e6654c0d750 + type_inferenced_ast: 0166ae9fa3bbb09720cc7f35c01c8fd5a5a4aea584a521664944aec8099a2a52 diff --git a/tests/expectations/compiler/compiler/function/multiple_returns.leo.out b/tests/expectations/compiler/compiler/function/multiple_returns.leo.out index 1a0e723993..4b530e26d4 100644 --- a/tests/expectations/compiler/compiler/function/multiple_returns.leo.out +++ b/tests/expectations/compiler/compiler/function/multiple_returns.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 4c1138877fd90e6a2728592a085a567f3ba63d4225abedaf517251b8ddce7a6a - canonicalized_ast: 4c1138877fd90e6a2728592a085a567f3ba63d4225abedaf517251b8ddce7a6a - type_inferenced_ast: 7cf351cd0c0dbe9bb2a87397c2273f09482994ca60be8f8044a4e2d074fc7dd4 + initial_ast: 13848d71b5ed9a8626538a425b45c8e2863a25c7ac5d3e205726b5f9d6d18a92 + canonicalized_ast: 13848d71b5ed9a8626538a425b45c8e2863a25c7ac5d3e205726b5f9d6d18a92 + type_inferenced_ast: 92582e0580595dd7e21b3586acc69e20972200e4d28fc531e291898ead064667 diff --git a/tests/expectations/compiler/compiler/function/repeated.leo.out b/tests/expectations/compiler/compiler/function/repeated.leo.out index b535091b49..ec2d33545b 100644 --- a/tests/expectations/compiler/compiler/function/repeated.leo.out +++ b/tests/expectations/compiler/compiler/function/repeated.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 63569735bf4eb8ad55d90df67cf6fefec39579db3326888926142af2cfb26d6f - canonicalized_ast: 63569735bf4eb8ad55d90df67cf6fefec39579db3326888926142af2cfb26d6f - type_inferenced_ast: 542715a7e5c18db26fdadf63bd41e6cb71df4f96bb867eb18ad65c80a965decc + initial_ast: cdd6d6eba721e6bca9e76acdb2845c8e2da16164942c5c533509707d656b7664 + canonicalized_ast: cdd6d6eba721e6bca9e76acdb2845c8e2da16164942c5c533509707d656b7664 + type_inferenced_ast: bb68a6ebb0e5cabfddb62c42ea818150900b77d11c4d8bee69395830f7ad3f4f diff --git a/tests/expectations/compiler/compiler/function/return.leo.out b/tests/expectations/compiler/compiler/function/return.leo.out index 35f3cb6c2a..f1e5e89806 100644 --- a/tests/expectations/compiler/compiler/function/return.leo.out +++ b/tests/expectations/compiler/compiler/function/return.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7195af24acaba1dbba4c8d8848177e7a82e71320a9381e48a2c176e9886699c5 - canonicalized_ast: 7195af24acaba1dbba4c8d8848177e7a82e71320a9381e48a2c176e9886699c5 - type_inferenced_ast: 92e7397b037f436aee2ccd1fb04e95014ed5f1335681c8357592f6a6076cc76c + initial_ast: 92df7901117a5872134a02c2593ad91d4f821f9c4e737b6eaa3c70e47d0c56d3 + canonicalized_ast: 92df7901117a5872134a02c2593ad91d4f821f9c4e737b6eaa3c70e47d0c56d3 + type_inferenced_ast: db5ca1fac0e62fc143e32ff3461081dc2f03d65142fb5f69a5473fa10a5a01d2 diff --git a/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out b/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out index fcca1da90c..d38e00acc7 100644 --- a/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out +++ b/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: b310827701505fb4e4457a1c55557f1754437cd4a49a02a421f15e9fca038ccb - canonicalized_ast: a33daa0e9d07ce990b2c3ea8b71c7f6a700415012b8d6fe04f9245f8d3308b59 - type_inferenced_ast: 896b72d52b23f48531c18035033b48d7b96539592de086d8ada0cd18a6a56eb4 + initial_ast: 24690ec1392fbd96c2ddb5056b5ca0bb95b2427ded3f6cdb320927cc5818b2a6 + canonicalized_ast: 4c080448843b380ca8806a98242de4fdc8ee8c21e6c6e02f8dd79969c9b75373 + type_inferenced_ast: 2cad77b45346d2f237e6e9b53de49bf1ef438beee8093321db3fa64998624d50 diff --git a/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out b/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out index bf5b7f3d89..c58f2eb59a 100644 --- a/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out +++ b/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: b9f2f146319a861d734a70b88cafd0c7a5ea8fde1e9e22687b70400c7457c52a - canonicalized_ast: 1453df7ea8e2245ac6103ac84ac47d2d2dd77a64c74503a1e6b91d5434937c2d - type_inferenced_ast: 08f9c08fcac9ef9da68d227a04f49b9be38b6ce72ffc11ea82acea2cf8fe6b5e + initial_ast: ac6b0e14932396f8e9f85a3315bc7cfdef15d36f359b229a53474cce844a03c8 + canonicalized_ast: cf9081b28cdd68e56334f74f63f3a345a7c7c70279428b4a8ac0c6c8a5812c09 + type_inferenced_ast: cbbae452d1a5e00a194dd2bf6825b9639ceb78b6732d8868e4f6b00392deb49c diff --git a/tests/expectations/compiler/compiler/function/return_tuple.leo.out b/tests/expectations/compiler/compiler/function/return_tuple.leo.out index 25caceeb64..27c1556011 100644 --- a/tests/expectations/compiler/compiler/function/return_tuple.leo.out +++ b/tests/expectations/compiler/compiler/function/return_tuple.leo.out @@ -19,6 +19,6 @@ outputs: r1: type: u32 value: "103" - initial_ast: d4b008869f1527290e9cd0862e3df4204b32683a96d909dbb6c91fc9489ad0e2 - canonicalized_ast: d4b008869f1527290e9cd0862e3df4204b32683a96d909dbb6c91fc9489ad0e2 - type_inferenced_ast: b8ac5ab2d9383543da885cb474f1e9a237c883a8e9facf60692161d439788f90 + initial_ast: 1d456881a8b9924daba1ab93242ceda21ab6517f0adfb2d611042e43ba26461e + canonicalized_ast: 1d456881a8b9924daba1ab93242ceda21ab6517f0adfb2d611042e43ba26461e + type_inferenced_ast: 2c9846396c1ed7077c222213e0fa36b4c004dd03a7c594a807b0292520038074 diff --git a/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out b/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out index 758598b22f..c6c08e18a4 100644 --- a/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out +++ b/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out @@ -19,6 +19,6 @@ outputs: b: type: u32 value: "1" - initial_ast: c429458b4d201fa548eea62e4a2ff8d581f788b7401a03b5f189ae210c3fe132 - canonicalized_ast: c429458b4d201fa548eea62e4a2ff8d581f788b7401a03b5f189ae210c3fe132 - type_inferenced_ast: 1453a4e5252dc0989544abafe9ff5477021ef0f3e8874276e4a989ad23ffaa5a + initial_ast: 3d6141e3d8c7131a0c94df520f0ef0f4bbab536371037eb00f32a2814449b10f + canonicalized_ast: 3d6141e3d8c7131a0c94df520f0ef0f4bbab536371037eb00f32a2814449b10f + type_inferenced_ast: 066d3d6dbc14fa17a690de1afe971efe8bb0df8a59066764579e06fedf8599e8 diff --git a/tests/expectations/compiler/compiler/function/value_unchanged.leo.out b/tests/expectations/compiler/compiler/function/value_unchanged.leo.out index a4e5ddae32..c92cf88707 100644 --- a/tests/expectations/compiler/compiler/function/value_unchanged.leo.out +++ b/tests/expectations/compiler/compiler/function/value_unchanged.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 089803f7197594aeca82cba9bc2eb70b6fdbbf42c007a0949da4c5b1b4f63508 - canonicalized_ast: 415cdab7ff832a06dc7b01e3134b81d36f0efc0efb3ae092c062419c38f57450 - type_inferenced_ast: 91fb5695f3a2c856d2cde8936aaef4cbb94773a2a71b56c00661c72c8fdee50b + initial_ast: de25c4e52b9bcb763ab7220d413230edd794cd18114fb68b2596c562df47d6fd + canonicalized_ast: 816f3e0fd249b00446678e9a117d4bebc1df9d9f6c8f78dd85adef143a3e9352 + type_inferenced_ast: 30aab60a56592166964c3c6c530e2bfcd4efbddcdb15ee96891012a681585bed diff --git a/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out b/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out index 3f2ac74f18..309f17ec5c 100644 --- a/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out +++ b/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "false" - initial_ast: 8b9ad0b83a216048ab6179c6e223f68290059bab1deb72771f72a672ea7a0bf9 - canonicalized_ast: acdf383c635404bccf9612be9c14c96e400496fb231cf3062bce9aa269331c0f - type_inferenced_ast: ab3b8dc3ddfba1affaacf2bc344c658d5b82419544da136e42c810a3f99f3832 + initial_ast: 83a11678cbe927059ac80b31621a768a777980463312843332054491507a1d7c + canonicalized_ast: d6538a71198ea82de94bc76df0aef183fddce985676c23cceb6008518e5542cf + type_inferenced_ast: 7ce28eee23a6e10ea97c1a43345f774f2b76586e1e7c09500ae0e9fd2fd36f37 diff --git a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out index 1eeff43f07..cbf62198af 100644 --- a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out +++ b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: d6273a716c2546b210eeefb640b5c34830fb2b2a4195ae0b636843e855fcbc1e - canonicalized_ast: 41a3c4ffe7c243ffc76bc7d3c147f77f71119d64e632581a20eb1cd576752ac3 - type_inferenced_ast: 196e5191c3d8c8cc552b419422b3e1411fa576336f63ae9d5c340bf2a7d62942 + initial_ast: 385fea62fbb18d0d50d82b6f361b0c08c682ab232b72589abfe22ab156c640fb + canonicalized_ast: dca26c0e783b2e3209a24bc44fc40773014d8761e448915905328901273f4ff0 + type_inferenced_ast: c46aaba5f7b799f430fa9d12521ed8bad3903d8c17da519f5c8cbb1da56d82d4 diff --git a/tests/expectations/compiler/compiler/import_local/import_all.leo.out b/tests/expectations/compiler/compiler/import_local/import_all.leo.out index af0f7a88be..baa806d137 100644 --- a/tests/expectations/compiler/compiler/import_local/import_all.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_all.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 - canonicalized_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 - type_inferenced_ast: be1c8166ce3ae7f805d8600441996328ce8f45ada3c16c4284f07d07af52ef75 + initial_ast: 7e831fcef925cf81371077ac162ed3c8a122696bcc3691f129aacf47db941286 + canonicalized_ast: 7e831fcef925cf81371077ac162ed3c8a122696bcc3691f129aacf47db941286 + type_inferenced_ast: 8fb065bc7683cebf37e8cae42e13db8247c007e74fd58b62fd8ecb1d97f67f77 diff --git a/tests/expectations/compiler/compiler/import_local/import_as.leo.out b/tests/expectations/compiler/compiler/import_local/import_as.leo.out index bc897c1c3f..ffccfeba70 100644 --- a/tests/expectations/compiler/compiler/import_local/import_as.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_as.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 47ef8cd0b57a42612bc9138c6da6e05fbca27c47464acf5af569c2fe0c91dd31 - canonicalized_ast: 39c0b27ba63cc34eed735900912e154031ca1f291aade9d9964ce49e77eeb19e - type_inferenced_ast: 19bfc761f899b48a3e0c4142bac6cbdaceac8230e92422cf9f6a99d9f7eddc6f + initial_ast: ff13c8a5aaa7ae4df3738a33c51f5c314811bc695dde8fdd993be40248c32c30 + canonicalized_ast: bda179d38af6772688c36d9316ee5550b5d0ac857abedf499e5beb8efcfcaadc + type_inferenced_ast: 4cf805fd0a99ee8b335dbe428720082fe12ef69ac3ea2b928431aff0246e0eb2 diff --git a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out index ebbd5184aa..d81aacdcd9 100644 --- a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7e0ba7b09b3840a5d4fc9f0d413163ba2de8f207c3818f604f9a71297aac30f3 - canonicalized_ast: 3f7efb61847fd75fed58b70526da8ceffb573a0806521fb30443f341c3d14a45 - type_inferenced_ast: a1baf614c8ab13c1ff978faf8022f90eef4c482261928cb3256ab4d63e20096c + initial_ast: a7d8eaf643aa12c7c77138b7f7e416e88fe383f6041c7d68542c8bab2d1700bb + canonicalized_ast: f749ae39c4c0aba1da52fa02f809fcbfe6710ec9b405669c506afb3aa945286d + type_inferenced_ast: d517ea5d6a6b59881bf92cf69f37dd9c0d283f05e7d84cfbfe72f0e92a94e02f diff --git a/tests/expectations/compiler/compiler/import_local/import_files.leo.out b/tests/expectations/compiler/compiler/import_local/import_files.leo.out index aaaee96823..06fd420b77 100644 --- a/tests/expectations/compiler/compiler/import_local/import_files.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_files.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 042e056c86e545ce256459a0de20d44c0bae24ff406becba4330e3208c48e180 - canonicalized_ast: 6cab1ab863f40c96d5d6921e2ced0dd00ebe5e9e334d84508af708be19ae8f59 - type_inferenced_ast: 17ff3e62f1c48edfbfb1c35ed4ac542260b59153d85afeca2e707dde217dc675 + initial_ast: bba586b2ea8e1a5ab145d059926dfc46b288dba1a2563fa26f851ec1f0c3fd8e + canonicalized_ast: 3dacbc2c65d335616c89882fdcf1beeed08799fbd6307e1b6b80ddd6662c17d0 + type_inferenced_ast: 5285eb5149cc21273515ed2318e624b07a60001223908d59b8700ba6865518fd diff --git a/tests/expectations/compiler/compiler/import_local/import_many.leo.out b/tests/expectations/compiler/compiler/import_local/import_many.leo.out index b379ba5f2e..e508476420 100644 --- a/tests/expectations/compiler/compiler/import_local/import_many.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_many.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 - canonicalized_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 - type_inferenced_ast: 1c983cf518cfafbe158ee3e42aed5cb190863b09aedfc4dd34e0268160ee79e2 + initial_ast: 3e3e8308a013fc0b7f95d96e6246ed7ddb79eff43ac379b648ac83f954855a4f + canonicalized_ast: 3e3e8308a013fc0b7f95d96e6246ed7ddb79eff43ac379b648ac83f954855a4f + type_inferenced_ast: eba4a650d1dc3a0b3d15080a07d052d41ef7b4c9dfeac5489d6291a3ae161b8d diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out index 22e000786a..e1b5244d5b 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 - canonicalized_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 - type_inferenced_ast: 58541200a815edfee41333b9b2b048add269d0924ca17457ecf9fbcbb5032ccf + initial_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c + canonicalized_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c + type_inferenced_ast: 86ef8ab226a58f140de1fcdadc31eb86e4a1930cabf36a8d9a4607233ea6ab80 diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out index e34d9e527a..ff15a9143c 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 - canonicalized_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 - type_inferenced_ast: 50c06c3666a830c7f1fd533c412a4e8054fdb494845f4f5d85414b08f1c1a8dd + initial_ast: dd316162c260471019781489e499add2b4d7b92c8b3b4a97e81028c8c355300e + canonicalized_ast: dd316162c260471019781489e499add2b4d7b92c8b3b4a97e81028c8c355300e + type_inferenced_ast: d20a15cd27d8783b670949a0a08466414cc46a78146e53f2766eb2c1e83e18a6 diff --git a/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out b/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out index 154b3ce4df..5ecb93be7e 100644 --- a/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out +++ b/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 8db095ba3755c4c0a5c661f82acea4d5088fcc7a1f21445d8f6a76aa349be14c - canonicalized_ast: db2825ad023eb01f420686f407d0411e99d06be1f13116ffce5b18d7e9ceffd6 - type_inferenced_ast: 2afc66cedc72641dbae33927247993fa9b03402889e3a71005888d0e26f34114 + initial_ast: c945d4136b8475c02a035c782811d6e19e67732f58287bc3d07f6e61928388d5 + canonicalized_ast: 71db3be14784c4fe3fe168d47ccc0c481fef735055c3e0f9674266eca7819f7e + type_inferenced_ast: 6f8875f025e24a90c22890e3a067e7466b3edd8bef5cd5f572f7abb8e2405946 diff --git a/tests/expectations/compiler/compiler/mutability/swap.leo.out b/tests/expectations/compiler/compiler/mutability/swap.leo.out index 49d15ca400..7cd3d61362 100644 --- a/tests/expectations/compiler/compiler/mutability/swap.leo.out +++ b/tests/expectations/compiler/compiler/mutability/swap.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "false" - initial_ast: 17828ff8ffc7902cfe67b7816477cf3099c248f7fde312a9792dd311814340c6 - canonicalized_ast: 17828ff8ffc7902cfe67b7816477cf3099c248f7fde312a9792dd311814340c6 - type_inferenced_ast: be55144bf090bcfc6d49170844c89b067b224b241fd953b0b683c70b91baaad4 + initial_ast: 12c76d4ffae96e57256a8277916b4c9b08e50e748df51d2618347973a5e71144 + canonicalized_ast: 12c76d4ffae96e57256a8277916b4c9b08e50e748df51d2618347973a5e71144 + type_inferenced_ast: 82c6b418dc6bb62fdc840e664af988d427082c7c2fc742e1b6fbf500737d630f diff --git a/tests/expectations/compiler/compiler/string/circuit.leo.out b/tests/expectations/compiler/compiler/string/circuit.leo.out index b607e80f47..9e4b7b908f 100644 --- a/tests/expectations/compiler/compiler/string/circuit.leo.out +++ b/tests/expectations/compiler/compiler/string/circuit.leo.out @@ -16,6 +16,6 @@ outputs: out: type: "[char; 13]" value: "\"Hello, World!\"" - initial_ast: 69219c995852ced5fe06a4009c4d58a8b59cc23ed7144ab4f08d4e0d4a6c5798 - canonicalized_ast: c099eab8cd118203aa297b200be1fd331f6e20ed1f19ff87efe16d406f5a0ce0 - type_inferenced_ast: acef5428f299c6cdbd9ac4b644123cf17a379efe025656122e359abe06da7eb8 + initial_ast: f139d8b2991f574d19551be9d229f78dfc03843e1b9b3dc9f41eb48e4895f6c3 + canonicalized_ast: ac3d36634ce48616f7d2f183bfa80fb3ea44ca49dfc4098b6b93f066991476bf + type_inferenced_ast: 8b12f329a6acbb34973450d299f98604411cd973fe09bc8f5d0096389cd9e346 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 5c820cc814..150b0929ba 100644 --- a/tests/expectations/parser/parser/expression/access/array_access.leo.out +++ b/tests/expectations/parser/parser/expression/access/array_access.leo.out @@ -168,6 +168,7 @@ outputs: col_stop: 7 path: test content: "x[0]()" + type_: ~ - ArrayAccess: array: Call: @@ -181,6 +182,7 @@ outputs: col_stop: 4 path: test content: "x()[0]" + type_: ~ index: Value: Implicit: @@ -214,6 +216,7 @@ outputs: col_stop: 5 path: test content: "x(y)::y(x)" + type_: ~ name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" span: line_start: 1 @@ -231,6 +234,7 @@ outputs: col_stop: 11 path: test content: "x(y)::y(x)" + type_: ~ - ArrayAccess: array: TupleAccess: diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out index ed9e9058da..ba9082245e 100644 --- a/tests/expectations/parser/parser/expression/access/call.leo.out +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -13,6 +13,7 @@ outputs: col_stop: 4 path: test content: x() + type_: ~ - Call: function: Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X()\\\"}\"}" @@ -24,6 +25,7 @@ outputs: col_stop: 4 path: test content: X() + type_: ~ - Call: function: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)\\\"}\"}" @@ -36,6 +38,7 @@ outputs: col_stop: 5 path: test content: x(y) + type_: ~ - Call: function: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" @@ -49,6 +52,7 @@ outputs: col_stop: 8 path: test content: "x(y, z)" + type_: ~ - Call: function: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" @@ -63,6 +67,7 @@ outputs: col_stop: 11 path: test content: "x(x, y, z)" + type_: ~ - Call: function: CircuitStaticFunctionAccess: @@ -84,6 +89,7 @@ outputs: col_stop: 7 path: test content: "x::y()" + type_: ~ - Call: function: CircuitStaticFunctionAccess: @@ -106,6 +112,7 @@ outputs: col_stop: 8 path: test content: "x::y(x)" + type_: ~ - Call: function: TupleAccess: @@ -129,6 +136,7 @@ outputs: col_stop: 7 path: test content: x.0(x) + type_: ~ - Call: function: ArrayAccess: @@ -160,3 +168,4 @@ outputs: col_stop: 8 path: test content: "x[0](x)" + type_: ~ diff --git a/tests/expectations/parser/parser/expression/access/circuit.leo.out b/tests/expectations/parser/parser/expression/access/circuit.leo.out index e10176179c..c9b8ff5a75 100644 --- a/tests/expectations/parser/parser/expression/access/circuit.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit.leo.out @@ -66,6 +66,7 @@ outputs: col_stop: 6 path: test content: x.y() + type_: ~ - TupleAccess: tuple: CircuitMemberAccess: diff --git a/tests/expectations/parser/parser/expression/access/circuit_static.leo.out b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out index eed96329a1..d9099c207f 100644 --- a/tests/expectations/parser/parser/expression/access/circuit_static.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out @@ -66,6 +66,7 @@ outputs: col_stop: 7 path: test content: "x::y()" + type_: ~ - TupleAccess: tuple: CircuitStaticFunctionAccess: diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index de785f2be6..3fa2ab005b 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -68,6 +68,7 @@ outputs: col_stop: 5 path: test content: "-x()" + type_: ~ op: Negate span: line_start: 1 diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out index 5c93154572..2f0b89534e 100644 --- a/tests/expectations/parser/parser/expression/unary/not.leo.out +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -68,6 +68,7 @@ outputs: col_stop: 5 path: test content: "!x()" + type_: ~ op: Not span: line_start: 1 diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out index d992c636a2..056c759f45 100644 --- a/tests/expectations/parser/parser/statement/assign.leo.out +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -140,6 +140,7 @@ outputs: col_stop: 8 path: test content: x = x(); + type_: ~ span: line_start: 1 line_stop: 1 diff --git a/tests/expectations/parser/parser/statement/definition.leo.out b/tests/expectations/parser/parser/statement/definition.leo.out index fa12ad7cea..dd9242024a 100644 --- a/tests/expectations/parser/parser/statement/definition.leo.out +++ b/tests/expectations/parser/parser/statement/definition.leo.out @@ -145,6 +145,7 @@ outputs: col_stop: 12 path: test content: let x = x(); + type_: ~ span: line_start: 1 line_stop: 1 @@ -295,6 +296,7 @@ outputs: col_stop: 14 path: test content: const x = x(); + type_: ~ span: line_start: 1 line_stop: 1 @@ -450,6 +452,7 @@ outputs: col_stop: 17 path: test content: "let x: u32 = x();" + type_: ~ span: line_start: 1 line_stop: 1 @@ -605,6 +608,7 @@ outputs: col_stop: 19 path: test content: "const x: u32 = x();" + type_: ~ span: line_start: 1 line_stop: 1 @@ -800,6 +804,7 @@ outputs: col_stop: 17 path: test content: "let (x, y) = x();" + type_: ~ span: line_start: 1 line_stop: 1 @@ -995,6 +1000,7 @@ outputs: col_stop: 19 path: test content: "const (x, y) = x();" + type_: ~ span: line_start: 1 line_stop: 1 @@ -1195,6 +1201,7 @@ outputs: col_stop: 22 path: test content: "let (x, y): u32 = x();" + type_: ~ span: line_start: 1 line_stop: 1 @@ -1395,6 +1402,7 @@ outputs: col_stop: 24 path: test content: "const (x, y): u32 = x();" + type_: ~ span: line_start: 1 line_stop: 1 diff --git a/tests/expectations/parser/parser/statement/expression.leo.out b/tests/expectations/parser/parser/statement/expression.leo.out index f9542ff844..7cf3b04e62 100644 --- a/tests/expectations/parser/parser/statement/expression.leo.out +++ b/tests/expectations/parser/parser/statement/expression.leo.out @@ -85,6 +85,7 @@ outputs: col_stop: 4 path: test content: x(); + type_: ~ span: line_start: 1 line_stop: 1 From 6f8443fdaf39d8e07bcdb099b0812fe0d40122da Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 18 Aug 2021 14:41:27 +0300 Subject: [PATCH 45/62] removes ast snapshots on leo clean --- leo/commands/clean.rs | 9 ++- package/src/outputs/ast_snapshot.rs | 117 ++++++++++++++++++++++++++++ package/src/outputs/mod.rs | 3 + 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 package/src/outputs/ast_snapshot.rs diff --git a/leo/commands/clean.rs b/leo/commands/clean.rs index 83c2503555..d8f1f3d8a4 100644 --- a/leo/commands/clean.rs +++ b/leo/commands/clean.rs @@ -16,7 +16,9 @@ use crate::{commands::Command, context::Context}; use leo_compiler::OutputFile; -use leo_package::outputs::{ChecksumFile, CircuitFile, ProofFile, ProvingKeyFile, VerificationKeyFile}; +use leo_package::outputs::{ + ChecksumFile, CircuitFile, ProofFile, ProvingKeyFile, Snapshot, SnapshotFile, VerificationKeyFile, +}; use anyhow::Result; use structopt::StructOpt; @@ -61,6 +63,11 @@ impl Command for Clean { // Remove the proof from the output directory ProofFile::new(&package_name).remove(&path)?; + // Remove AST snapshots from the output directory + SnapshotFile::new(&package_name, Snapshot::Initial).remove(&path)?; + SnapshotFile::new(&package_name, Snapshot::TypeInference).remove(&path)?; + SnapshotFile::new(&package_name, Snapshot::Canonicalization).remove(&path)?; + Ok(()) } } diff --git a/package/src/outputs/ast_snapshot.rs b/package/src/outputs/ast_snapshot.rs new file mode 100644 index 0000000000..75d2621b1f --- /dev/null +++ b/package/src/outputs/ast_snapshot.rs @@ -0,0 +1,117 @@ +// Copyright (C) 2019-2021 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 . + +//! The serialized circuit output file. + +use crate::{errors::CircuitFileError, outputs::OUTPUTS_DIRECTORY_NAME}; + +use serde::Deserialize; +use std::{ + borrow::Cow, + fmt, + fs::{ + File, {self}, + }, + io::Write, + path::Path, +}; + +/// Enum to handle all 3 types of snapshots. +#[derive(Deserialize)] +pub enum Snapshot { + Initial, + TypeInference, + Canonicalization, +} + +impl fmt::Display for Snapshot { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "{}", + match self { + Self::Initial => "initial_ast", + Self::TypeInference => "type_inferenced_ast", + Self::Canonicalization => "canonicalization_ast", + } + ) + } +} + +pub static AST_SNAPSHOT_FILE_EXTENSION: &str = ".json"; + +/// Generic Snapshot file wrapper. Each package can have up to 3 +/// different snapshots: initial_ast, canonicalization_ast and type_inferenced_ast; +#[derive(Deserialize)] +pub struct SnapshotFile { + pub package_name: String, + pub snapshot: Snapshot, +} + +impl SnapshotFile { + pub fn new(package_name: &str, snapshot: Snapshot) -> Self { + Self { + package_name: package_name.to_string(), + snapshot, + } + } + + pub fn exists_at(&self, path: &Path) -> bool { + let path = self.snapshot_file_path(path); + path.exists() + } + + /// Reads the serialized circuit from the given file path if it exists. + pub fn read_from(&self, path: &Path) -> Result { + let path = self.snapshot_file_path(path); + + fs::read_to_string(&path).map_err(|_| CircuitFileError::FileReadError(path.into_owned())) + } + + /// Writes the given serialized circuit to a file. + pub fn write_to(&self, path: &Path, circuit: String) -> Result<(), CircuitFileError> { + let path = self.snapshot_file_path(path); + + let mut file = File::create(&path)?; + file.write_all(circuit.as_bytes())?; + + Ok(()) + } + + /// Removes the serialized circuit at the given path if it exists. Returns `true` on success, + /// `false` if the file doesn't exist, and `Error` if the file system fails during operation. + pub fn remove(&self, path: &Path) -> Result { + let path = self.snapshot_file_path(path); + if !path.exists() { + return Ok(false); + } + + fs::remove_file(&path).map_err(|_| CircuitFileError::FileRemovalError(path.into_owned()))?; + Ok(true) + } + + fn snapshot_file_path<'a>(&self, path: &'a Path) -> Cow<'a, Path> { + let mut path = Cow::from(path); + if path.is_dir() { + if !path.ends_with(OUTPUTS_DIRECTORY_NAME) { + path.to_mut().push(OUTPUTS_DIRECTORY_NAME); + } + path.to_mut() + .push(format!("{}{}", self.snapshot, AST_SNAPSHOT_FILE_EXTENSION)); + } + path + } +} diff --git a/package/src/outputs/mod.rs b/package/src/outputs/mod.rs index f4c02b8f18..e65058198e 100644 --- a/package/src/outputs/mod.rs +++ b/package/src/outputs/mod.rs @@ -29,5 +29,8 @@ pub use self::proof::*; pub mod proving_key; pub use self::proving_key::*; +pub mod ast_snapshot; +pub use self::ast_snapshot::*; + pub mod verification_key; pub use self::verification_key::*; From bc6ad13930a62f027d673141b37e3d0ebc1cdb42 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 18 Aug 2021 14:53:18 +0300 Subject: [PATCH 46/62] adds exit code and error printing --- .github/workflows/acl2.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index c1d269622b..7ab8908a31 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -39,15 +39,22 @@ jobs: # Using the prepared ASTs and the pulled and unzipped tgc run theorem generation. - name: Run tgc over the asts run: | - ARRAY=(); + errors=(); for dir in `ls tmp/tgc`; do cd tmp/tgc/$dir; # enter the directory - ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp || ARRAY+=("$dir"); + ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp > result.out || errors+=("$dir"); cd ../../.. done; - echo "Failures:"; - for i in ${ARRAY[@]}; - do - echo $i; - done; + + if [ ${#errors[@]} -eq 0 ]; then + echo "Success!" + else + echo "Failures:"; + for i in ${errors[@]}; + do + echo $i; + cat tmp/tgc/$dir.out + done; + exit 1 + fi From 52b2a4a3cb08a646eed917bdef76c8946e337afb Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 18 Aug 2021 17:51:50 +0300 Subject: [PATCH 47/62] final cleanup --- .github/workflows/acl2.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 7ab8908a31..116c19eb12 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -1,9 +1,18 @@ name: Leo-ACL2 on: - push: + pull_request: + push: + branches: + - master + - staging + - trying + paths-ignore: + - 'docs/**' + - 'documentation/**' env: RUST_BACKTRACE: 1 +# This job can only be run on linux (Ubuntu) jobs: acl2: name: leo-acl2 @@ -25,7 +34,7 @@ jobs: # Pull the latest release from the leo-acl2-bin repo, and put it into the # repo/acl2 directory. After it's done, unpack the tgz file locally. - - name: Pull the tgc executable + - name: Pull tgc executable run: | mkdir acl2 && cd acl2; wget $(curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/releases/latest \ @@ -37,7 +46,7 @@ jobs: tar -xvzf $(ls) # Using the prepared ASTs and the pulled and unzipped tgc run theorem generation. - - name: Run tgc over the asts + - name: Run tgc over ASTs run: | errors=(); for dir in `ls tmp/tgc`; From 9caca65409ff4816dbee5d74cf3fb13154eb02f1 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 18 Aug 2021 18:07:05 +0300 Subject: [PATCH 48/62] alphabetical in package/outputs/mod --- package/src/outputs/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/src/outputs/mod.rs b/package/src/outputs/mod.rs index e65058198e..d448130673 100644 --- a/package/src/outputs/mod.rs +++ b/package/src/outputs/mod.rs @@ -14,6 +14,9 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +pub mod ast_snapshot; +pub use self::ast_snapshot::*; + pub mod circuit; pub use self::circuit::*; @@ -29,8 +32,5 @@ pub use self::proof::*; pub mod proving_key; pub use self::proving_key::*; -pub mod ast_snapshot; -pub use self::ast_snapshot::*; - pub mod verification_key; pub use self::verification_key::*; From a91c8b9e6ad5a19585f8343f98c37a4e265e8ea5 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 18 Aug 2021 13:38:50 -0700 Subject: [PATCH 49/62] Revert "type on call expression" This reverts commit cf5a23b38f4c76a1f7e3a4aec5ee52af11598ed6. --- asg/src/expression/call.rs | 1 - ast/src/expression/call.rs | 2 -- ast/src/reducer/canonicalization.rs | 1 - ast/src/reducer/reconstructing_director.rs | 8 +------- ast/src/reducer/reconstructing_reducer.rs | 2 -- compiler/src/phases/reducing_director.rs | 7 +------ compiler/src/test.rs | 2 +- parser/src/parser/expression.rs | 1 - .../circuits/big_self_in_circuit_replacement.leo.out | 6 +++--- .../compiler/circuits/const_self_variable.leo.out | 6 +++--- .../define_circuit_inside_circuit_function.leo.out | 6 +++--- .../compiler/circuits/duplicate_name_context.leo.out | 6 +++--- .../compiler/circuits/inline_member_pass.leo.out | 6 +++--- .../compiler/compiler/circuits/member_function.leo.out | 6 +++--- .../compiler/circuits/member_function_nested.leo.out | 6 +++--- .../compiler/circuits/member_static_function.leo.out | 6 +++--- .../circuits/member_static_function_nested.leo.out | 6 +++--- .../circuits/member_variable_and_function.leo.out | 6 +++--- .../compiler/compiler/circuits/mut_self_variable.leo.out | 6 +++--- .../compiler/circuits/mut_self_variable_branch.leo.out | 6 +++--- .../circuits/mut_self_variable_conditional.leo.out | 6 +++--- .../circuits/mutable_call_immutable_context.leo.out | 6 +++--- .../compiler/compiler/circuits/pedersen_mock.leo.out | 6 +++--- .../compiler/compiler/circuits/self_member.leo.out | 6 +++--- .../compiler/compiler/function/array_input.leo.out | 6 +++--- .../compiler/function/array_params_direct_call.leo.out | 6 +++--- .../compiler/compiler/function/empty.leo.out | 6 +++--- .../compiler/compiler/function/iteration.leo.out | 6 +++--- .../compiler/function/iteration_repeated.leo.out | 6 +++--- .../compiler/compiler/function/multiple_returns.leo.out | 6 +++--- .../compiler/compiler/function/repeated.leo.out | 6 +++--- .../compiler/compiler/function/return.leo.out | 6 +++--- .../compiler/function/return_array_nested_pass.leo.out | 6 +++--- .../compiler/function/return_array_tuple_pass.leo.out | 6 +++--- .../compiler/compiler/function/return_tuple.leo.out | 6 +++--- .../compiler/function/return_tuple_conditional.leo.out | 6 +++--- .../compiler/compiler/function/value_unchanged.leo.out | 6 +++--- .../compiler/global_consts/global_const_types.leo.out | 6 +++--- .../tests/import_dependency_folder.leo.out | 6 +++--- .../compiler/compiler/import_local/import_all.leo.out | 6 +++--- .../compiler/compiler/import_local/import_as.leo.out | 6 +++--- .../compiler/compiler/import_local/import_dir.leo.out | 6 +++--- .../compiler/compiler/import_local/import_files.leo.out | 6 +++--- .../compiler/compiler/import_local/import_many.leo.out | 6 +++--- .../compiler/import_local/import_weird_names.leo.out | 6 +++--- .../import_local/import_weird_names_nested.leo.out | 6 +++--- .../compiler/mutability/circuit_function_mut.leo.out | 6 +++--- .../compiler/compiler/mutability/swap.leo.out | 6 +++--- .../compiler/compiler/string/circuit.leo.out | 6 +++--- .../parser/parser/expression/access/array_access.leo.out | 4 ---- .../parser/parser/expression/access/call.leo.out | 9 --------- .../parser/parser/expression/access/circuit.leo.out | 1 - .../parser/expression/access/circuit_static.leo.out | 1 - .../parser/parser/expression/unary/negate.leo.out | 1 - .../parser/parser/expression/unary/not.leo.out | 1 - .../expectations/parser/parser/statement/assign.leo.out | 1 - .../parser/parser/statement/definition.leo.out | 8 -------- .../parser/parser/statement/expression.leo.out | 1 - 58 files changed, 126 insertions(+), 171 deletions(-) diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index 9d244a6d09..41b7cb0660 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -234,7 +234,6 @@ impl<'a> Into for &CallExpression<'a> { function: Box::new(target_function), arguments: self.arguments.iter().map(|arg| arg.get().into()).collect(), span: self.span.clone().unwrap_or_default(), - type_: None, } } } diff --git a/ast/src/expression/call.rs b/ast/src/expression/call.rs index 80e57599c1..528b751434 100644 --- a/ast/src/expression/call.rs +++ b/ast/src/expression/call.rs @@ -15,14 +15,12 @@ // along with the Leo library. If not, see . use super::*; -use crate::Type; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct CallExpression { pub function: Box, // todo: make this identifier? pub arguments: Vec, pub span: Span, - pub type_: Option, } impl fmt::Display for CallExpression { diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index a2d28ca856..0e14208fc1 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -274,7 +274,6 @@ impl Canonicalizer { function: Box::new(self.canonicalize_expression(&call.function)), arguments: call.arguments.clone(), span: call.span.clone(), - type_: call.type_.clone(), }); } Expression::Identifier(identifier) => { diff --git a/ast/src/reducer/reconstructing_director.rs b/ast/src/reducer/reconstructing_director.rs index 82fb8d73c5..d7710df122 100644 --- a/ast/src/reducer/reconstructing_director.rs +++ b/ast/src/reducer/reconstructing_director.rs @@ -276,13 +276,7 @@ impl ReconstructingDirector { arguments.push(self.reduce_expression(argument)?); } - let type_ = call - .type_ - .as_ref() - .map(|t| self.reduce_type(t, &call.span)) - .transpose()?; - - self.reducer.reduce_call(call, function, arguments, type_) + self.reducer.reduce_call(call, function, arguments) } // Statements diff --git a/ast/src/reducer/reconstructing_reducer.rs b/ast/src/reducer/reconstructing_reducer.rs index b9a8d25cb2..9bac0a88c7 100644 --- a/ast/src/reducer/reconstructing_reducer.rs +++ b/ast/src/reducer/reconstructing_reducer.rs @@ -245,13 +245,11 @@ pub trait ReconstructingReducer { call: &CallExpression, function: Expression, arguments: Vec, - type_: Option, ) -> Result { Ok(CallExpression { function: Box::new(function), arguments, span: call.span.clone(), - type_, }) } diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/phases/reducing_director.rs index 13a997c149..49480254e0 100644 --- a/compiler/src/phases/reducing_director.rs +++ b/compiler/src/phases/reducing_director.rs @@ -242,12 +242,7 @@ impl CombineAstAsgDirector { arguments.push(self.reduce_expression(ast_arg, asg_arg.get())?); } - self.ast_reducer.reduce_call( - ast, - *ast.function.clone(), - arguments, - Some((&asg.function.get().output).into()), - ) + self.ast_reducer.reduce_call(ast, *ast.function.clone(), arguments) } pub fn reduce_cast( diff --git a/compiler/src/test.rs b/compiler/src/test.rs index d87ca4a241..d7ccbdedb5 100644 --- a/compiler/src/test.rs +++ b/compiler/src/test.rs @@ -68,7 +68,7 @@ pub(crate) fn parse_program( theorem_options: Option, cwd: Option, ) -> Result { - let mut compiler = new_compiler(cwd.unwrap_or_else(|| "compiler-test".into()), theorem_options); + let mut compiler = new_compiler(cwd.unwrap_or("compiler-test".into()), theorem_options); compiler.parse_program_from_string(program_string)?; diff --git a/parser/src/parser/expression.rs b/parser/src/parser/expression.rs index 7cb4948b87..789ecaf9de 100644 --- a/parser/src/parser/expression.rs +++ b/parser/src/parser/expression.rs @@ -481,7 +481,6 @@ impl ParserContext { span: expr.span() + &end_span, function: Box::new(expr), arguments, - type_: None, }); } Token::DoubleColon => { diff --git a/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out b/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out index 0464cb5cbb..7bd0bf3fb0 100644 --- a/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out +++ b/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: d9351a67d0a3093691860449744a2465a814beb534a564f57a37d53792f5f08f - canonicalized_ast: f7c3dc7d004fcafed73cae79767931f87611e69bcce552f96053dc0b15ea8a4e - type_inferenced_ast: d51d2af3e436f0ceba986dbceadf8f7247b1416ae8e8d3ab1bf015db99c22f14 + initial_ast: aa87a9d1c477e2d5b7ae824fb434188dd6c5c519dd27ebaecd30e44be401ee1b + canonicalized_ast: f188b62839a17478878fe1dfc9863bac20fa1c0c6cf51eae5e13c5f5f79f6c1a + type_inferenced_ast: 9e838aeeebdd2f800c2e7305614f123c27d8390fbadabf1bcb15dae6466669a6 diff --git a/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out b/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out index 879b877551..0dec0b1733 100644 --- a/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 327b797703790e1684fe4979902355c6758ae43fa48c6433b3143bdfdad3133a - canonicalized_ast: 327b797703790e1684fe4979902355c6758ae43fa48c6433b3143bdfdad3133a - type_inferenced_ast: 2ec3cdaa90f73b1bb5c5152debb88c98b409fa6ee5d016fd9ce1f8324379fbdc + initial_ast: da9350459a9579ec5961fc26b81a67a88060caaaea27448fa02f86271227b213 + canonicalized_ast: da9350459a9579ec5961fc26b81a67a88060caaaea27448fa02f86271227b213 + type_inferenced_ast: 2dd2c4378253f239047ae310657e24dae70ba7181d1cf08d89007c2f1a37d332 diff --git a/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out b/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out index 8e5fbf5c86..8423b5b6ec 100644 --- a/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 515f585e21334d2bb218fa8d3969f1ac737c9acee6c2b9cd106169ccafb8337b - canonicalized_ast: 515f585e21334d2bb218fa8d3969f1ac737c9acee6c2b9cd106169ccafb8337b - type_inferenced_ast: 4d2e15d60701432d02975a3303b9996a4c5bfd59d720f24e29eb83602a70dc86 + initial_ast: 583cb3219a67fcbb30d241dec9e2860d99db27b109c8d095c10838ea342efd3c + canonicalized_ast: 583cb3219a67fcbb30d241dec9e2860d99db27b109c8d095c10838ea342efd3c + type_inferenced_ast: bbb33dca916b1310a58492ecd4bc74ed03ef3ab87870391839fc8b627f31e941 diff --git a/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out b/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out index 5dec1b352c..e477b4a944 100644 --- a/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out +++ b/tests/expectations/compiler/compiler/circuits/duplicate_name_context.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: a303832f3dc7cb53958278c16b3180121830efc84ea48983c82c7b03a0af7f41 - canonicalized_ast: a303832f3dc7cb53958278c16b3180121830efc84ea48983c82c7b03a0af7f41 - type_inferenced_ast: 129549ca68c1d13bc5dcdb48779dcdbef44b414b7c7e3f5c885edb41b74c0cbf + initial_ast: e96236da6f97f8472930c05f30db95afa0c914060fe3ee908af57dbc1644f6b8 + canonicalized_ast: e96236da6f97f8472930c05f30db95afa0c914060fe3ee908af57dbc1644f6b8 + type_inferenced_ast: 933e32a944dbeba01b9c1600ccdec94370927087a3a2b5511bdf4767b5fecd7b diff --git a/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out b/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out index 978f781a07..86e9316902 100644 --- a/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out +++ b/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: eefc49094cd3e72a60f8690f237b7de3ba95a2d0ae4179cba5f6668e30a422a7 - canonicalized_ast: 38338c43ada333b96c1f1bdb4f29dd0d09a54dd2c67a20e5972ef3e77ed5e02c - type_inferenced_ast: 9e307fa3a33017578186ca9147f1e9f236eec53bca9394ac598d90a31cd153aa + initial_ast: 489c3e8ccafc04e118846f4009d93dfbf018902fbdcd1dde6798cc853bcd8903 + canonicalized_ast: 4b8614afcbaf258d87202daa83f1340762d9a90f4edd7723b8a83df74acbbeb1 + type_inferenced_ast: 3e23d0db328e40ffa2a1ced543295650aa724a8b2dc795bbca54a40ca726b59a diff --git a/tests/expectations/compiler/compiler/circuits/member_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_function.leo.out index 29130426af..206329dc34 100644 --- a/tests/expectations/compiler/compiler/circuits/member_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 059c922bbe6d6ff0f1d3cef49bfceb1b51767edd60288eaa6e5dd7f4d77a993c - canonicalized_ast: 059c922bbe6d6ff0f1d3cef49bfceb1b51767edd60288eaa6e5dd7f4d77a993c - type_inferenced_ast: e40b9068fdd2c1fed983e636b164e889c7b908f3089ca2fa1867cf08b3c0998a + initial_ast: 8eacc56577069bef188ac3bbabbceaca5fb8955af1e8ea74ef52f01ce7bd4516 + canonicalized_ast: 8eacc56577069bef188ac3bbabbceaca5fb8955af1e8ea74ef52f01ce7bd4516 + type_inferenced_ast: d5947d1cd599d713fdaafe3cc1084784639c768d5069151dfe7dd0cb02e28ae2 diff --git a/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out b/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out index 3afd8b3536..c36f829b9a 100644 --- a/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: f6b65aa140ab77f8236e091391c5f383fd7e732af1f73fa42c3e40ff9164e767 - canonicalized_ast: f6b65aa140ab77f8236e091391c5f383fd7e732af1f73fa42c3e40ff9164e767 - type_inferenced_ast: dfc38e252034884cc5cb52977390ebe412a11b92cf0363fb16d20021e1c48f07 + initial_ast: f4796f1f9215d0c6d42478aae63b1495dfad36eaaec4a981dddac9def85ffef0 + canonicalized_ast: f4796f1f9215d0c6d42478aae63b1495dfad36eaaec4a981dddac9def85ffef0 + type_inferenced_ast: f808f56c8af9d6677bf54e7f777b3023f82144462df704dc4f3e39830be4c109 diff --git a/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out index 1322d7f52d..6630cd07bc 100644 --- a/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_static_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7de57d20910bf2474c7a0e8c5c0c55f0b3c6857756c859b50924b2111cde74d4 - canonicalized_ast: 7de57d20910bf2474c7a0e8c5c0c55f0b3c6857756c859b50924b2111cde74d4 - type_inferenced_ast: c527d3bbb5d3148960cbce642d89365408cfd092da611b88d87323bfdf858c13 + initial_ast: 75577795f48b9c4f50fed7051e3d76e4b76e3d3b6896ead606d3ebe925e43d2f + canonicalized_ast: 75577795f48b9c4f50fed7051e3d76e4b76e3d3b6896ead606d3ebe925e43d2f + type_inferenced_ast: 60a0557cf60a23b458e3a7ef25299f3fef8cae5c473446b54bb7e98ed91b70f0 diff --git a/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out b/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out index a7551812c1..14f7a27016 100644 --- a/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_static_function_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: a476268424c783f771f39d2bc2f554111f5caf991153602b4c113b54e282bce4 - canonicalized_ast: d100e1644f1f35ff51a48f3eb1c2431d905a11d6c671e19a6fed1fefd1df55f8 - type_inferenced_ast: 659b23ba47e1da8cca0a0c2a787958378c2e2fd43a14267f4f8bb7a773271feb + initial_ast: 4c74b65863cddde8ce523495358ab619ec48645dcb8409658a3fb3d7a3821d6d + canonicalized_ast: 45dc35a683e14503f8a1fc40280f05e7d096b49896f115ffa649e76b9cd80941 + type_inferenced_ast: 11af72cfc90adc12c3412e3067ad285a2279de0f4f12af5081dbe27c58b5a3bf diff --git a/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out index b8921bb620..7ede51f889 100644 --- a/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 54b8f1a61d85f9a1bb5dbd7824b780f47bef8ca4d4462aa3c9c7ad0b5391e442 - canonicalized_ast: 54b8f1a61d85f9a1bb5dbd7824b780f47bef8ca4d4462aa3c9c7ad0b5391e442 - type_inferenced_ast: 52de8aa926b165005383977ca4ce8d5d3acb4fc8120d92c1b7c73adc86ab20b8 + initial_ast: 033ac2bd59dacfd0e1f551feee772337e15a3c9eca8fa64075b1f6c411b2f235 + canonicalized_ast: 033ac2bd59dacfd0e1f551feee772337e15a3c9eca8fa64075b1f6c411b2f235 + type_inferenced_ast: a90d633d8db0a339186dc314f4de35ed970aec22cfccd423f49824ade7dcf70b diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out index 2ba4d57887..a7c760ec44 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: c803c46b7078be3961d0196d7b79bb425de7e5071a7ad0c108e7d0f14714000c - canonicalized_ast: 1823e58f37aa59a725075ebf83818e790c1247207cbdbff59f6f04eac5472762 - type_inferenced_ast: e97a1fe23c36faf117b436385e36fc252c27453c4ef755b1baafa38ffb6dc634 + initial_ast: 35c17de2e9d8a63b29cbeaeeb7eebfa886ff4ae536938e571e953ee206ba8a59 + canonicalized_ast: 8f09ad7c9a20220bf8d9fe7e5c84a7c1e99b840fbeb682fb5646df9a05efbd8b + type_inferenced_ast: b1e1e8b1c22a2c98f82d26a1a339952dbe085366b5dc3bb36d71cf4c842739b9 diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out index d3563b0215..90c520afac 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7556b190f383869fc9049c064c3d5d4e1a825f09f97548b81305b8b9f86820e6 - canonicalized_ast: 56e26b65bcfbf82b38b473c2fce4fd6d83a9801a4f801b0c5613b868790e4d5d - type_inferenced_ast: 1d6dff1a4f155e72b5733132eb15ab32135282dc6a44e4fdb35570a8d7a2f90d + initial_ast: 5654f2be64d7879bfa2cb49029bd6c3b757c0eb28dd32744de41a28effae5891 + canonicalized_ast: 42710d4ec40860cbd1a88da9738960c5a07a6a9937436ec474b3f1bbc805aac4 + type_inferenced_ast: d7f138829083963f935922d492a94a693b963d3acee6fadb325be8d99f0e4d19 diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out index e1c09cb327..d50ce4095d 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 36d95903089f19385df16163168141e29ee5fe28bc960676dbde9e55715c2db7 - canonicalized_ast: 543653c12ca68358485d6796f59ec763653256569e1adc02997d0d554796423a - type_inferenced_ast: 35dbeec7a557452e1b486ea8c79fe10adadf0c68bf734cb17c6bffb248ba657c + initial_ast: 46fccf2a1d04ff7bbfb9a88eeceb6cfd39adcf7ce2e2323d4fb83f4ae3dba273 + canonicalized_ast: 222568f9f7b61876690514fdd2dd12419b2e889269a2b7aabd7223d291167da5 + type_inferenced_ast: f1a5656978bd48409401788332b1a1d90c969178e65af06b54d5b4445be84375 diff --git a/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out b/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out index 2b2eea16d7..5ea932e6db 100644 --- a/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 98cd5b5508c5edac06dcb56d30cd3f1a773642cfb5d63c10742308d525cfd0c0 - canonicalized_ast: ec9f20897d08d5c9d526ed730311a1c7a3ef9c5ce02638736c3e74fc444d7bf4 - type_inferenced_ast: d378fbfc968b157945b173c2b085417bc110b4666cb9fac4ec2b184c30d5ec24 + initial_ast: bd8793749cfd151b89162febc55b6bb6de1be867a0009da6a8470106953db630 + canonicalized_ast: 9ecf61f153db9d0912cae6891258e0ebdaecd0da6eef7bbc92c3a6476c7adf6d + type_inferenced_ast: 6908fc70e763ff518a9942a3b930aac64b70075be1b734c2ac93175ca1f16f97 diff --git a/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out b/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out index 0a8c668530..bec7e9cfc6 100644 --- a/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out +++ b/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 266b11febadc70291d48673112ea7c440fb1aa2592ccb671a5fb0bff198716a6 - canonicalized_ast: 07d69501c44f7436263a55cf1eb0b9c8751210c6e9c05af20427486ca4dcf918 - type_inferenced_ast: e9b8ff04cf3e39a9047534842ccbbcea54b546f9dd3e6e5f6491292f78fb4f71 + initial_ast: c983e5e79b4325ac133ac1a5ff0b1655c646111389991286322b8c16c5833837 + canonicalized_ast: 8dcb714238ef7e9fd3c66a7a12ec4621bb4e9ac5994f1c692215a9f93463ce9e + type_inferenced_ast: ebd34799bd1c6936ca5032812d2466bade58df616cc06e3c6e57151a06b78601 diff --git a/tests/expectations/compiler/compiler/circuits/self_member.leo.out b/tests/expectations/compiler/compiler/circuits/self_member.leo.out index b83d755fc2..5311554177 100644 --- a/tests/expectations/compiler/compiler/circuits/self_member.leo.out +++ b/tests/expectations/compiler/compiler/circuits/self_member.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: f5041463460b2bb46e2183f775b9eadba9a9db05269fb2fdc0a75132b20986eb - canonicalized_ast: f5041463460b2bb46e2183f775b9eadba9a9db05269fb2fdc0a75132b20986eb - type_inferenced_ast: a6edbaff381ce5698634fc7d8d86e1d41b61e568942a5363b9295bf600f33ca1 + initial_ast: ef90c67bd868ad3d1362b37acad99a97316700c60c9667a4d67b8ad392b2922c + canonicalized_ast: ef90c67bd868ad3d1362b37acad99a97316700c60c9667a4d67b8ad392b2922c + type_inferenced_ast: 636fbf53660cedd9c05b6c361fae19ae5adaae85adc98e888308072ef843f8fa diff --git a/tests/expectations/compiler/compiler/function/array_input.leo.out b/tests/expectations/compiler/compiler/function/array_input.leo.out index afe9366375..8204e381f2 100644 --- a/tests/expectations/compiler/compiler/function/array_input.leo.out +++ b/tests/expectations/compiler/compiler/function/array_input.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: e9de1d6ec414781d95bb58b3c34f57814118fe62835aa2809b7cd237e2af0b71 - canonicalized_ast: d93cc125794fdd21067d78d77e75d121e3a642ce646e077288c59dc1fa9b0f20 - type_inferenced_ast: d4c628a0cfdbd899b6cad3f194e971d9fdf5093fc677381279242303b6995932 + initial_ast: cbf1d3fe0106bda529af2912783d2ea0505b9d3780f5ca6954c1caaf3381543a + canonicalized_ast: 711c249e5b0c1ac7f8e9dd96e13bdf1c7449f2f0afa994b9c6430f91b40072a9 + type_inferenced_ast: a96aab38c2fa75d08da2a17ed91efd8128067f9f8ad96e151d0c27a2a55355c3 diff --git a/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out b/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out index bd6d53ac9b..db9a7a59a9 100644 --- a/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out +++ b/tests/expectations/compiler/compiler/function/array_params_direct_call.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: a8734776306f402a7e801a196eafacc9f3053519bfcf5054f3098ed22ced4a96 - canonicalized_ast: 8f16e0db0f6313da3e960ce7777df567f08183709aaffde8428ded1aa22b20f0 - type_inferenced_ast: c20e6523544c998159b78b9242bf1adafa861f78e0a87ab386425a19482174ab + initial_ast: 16b635b136d26f8f9b71d9637bd85aa8449d6a93a558669bb44235f969703cba + canonicalized_ast: f46853ed6440686de4f7ed91623575fe2a040e0672580aa06dd2d6fd54dd51b1 + type_inferenced_ast: b36955c7ea4a3894d5857df754e20b6ee2767d84adab7509d50a645cb78af437 diff --git a/tests/expectations/compiler/compiler/function/empty.leo.out b/tests/expectations/compiler/compiler/function/empty.leo.out index 73952aa6bd..844180d720 100644 --- a/tests/expectations/compiler/compiler/function/empty.leo.out +++ b/tests/expectations/compiler/compiler/function/empty.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 87fc4d2cb8e0004b35835d4e238a82feb82b0ca2df3e3154e9ef599a169b4af5 - canonicalized_ast: 5fc93adb2d8b7cbbda5997a72e624c07cf70f6d8cb6255eb8febb71782500d04 - type_inferenced_ast: 584dfe2869022148ab27d76c7d9afa3518c38ea606b510c4804a5735de92c9ec + initial_ast: 2e31236a963bb214beb942fbb0269ec2c08ddf704fd47ce5d0864b1f1fbb2a7a + canonicalized_ast: 186d0d826a29f428034b8782b79d8e3a0cf810f9dde88b5f1062508322c5d7d5 + type_inferenced_ast: 740b33fa80b8d50c88523daf299d79846430a291dd8b034dd5a01a106270610b diff --git a/tests/expectations/compiler/compiler/function/iteration.leo.out b/tests/expectations/compiler/compiler/function/iteration.leo.out index 0449d816a5..16dc886ac5 100644 --- a/tests/expectations/compiler/compiler/function/iteration.leo.out +++ b/tests/expectations/compiler/compiler/function/iteration.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 48ae7b7fccc951d9fd28e76f567f283fb0c834b8f203badf5217e805895902a0 - canonicalized_ast: 944e9a3da4b22873b88a1ab2515e26f3fd3f7370945cee1abacabec7c2088354 - type_inferenced_ast: fe935182e4096851326416dcbd9c68035cb9aa030fe796a46343d11c0c96c461 + initial_ast: 96155896f4993bd97a8e15281e92c4e9352ed02343bccddb9c3cd0f8ca55b408 + canonicalized_ast: ae4a2dfa82f00621192f117bea664e58768d57376b68a90ce0e15c5bc9535e22 + type_inferenced_ast: 2452ad985e23efbc07a94f2945d406a959aca68ec37e9c349a30edcc12839c04 diff --git a/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out b/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out index cc2b3277d7..8056fc7df4 100644 --- a/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out +++ b/tests/expectations/compiler/compiler/function/iteration_repeated.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: bad5d54fa6e1c942d37fd260fb1a833396ef9c6353ea4ad9c06f89a7a420fa14 - canonicalized_ast: 856088367fbf5df78db5194cbc0c346216dbcf01efaa22ed59ac4e6654c0d750 - type_inferenced_ast: 0166ae9fa3bbb09720cc7f35c01c8fd5a5a4aea584a521664944aec8099a2a52 + initial_ast: 55bf6a745bd0da1684239dd5f624a5ead1d5644c15f25e3099ff40c71ce23317 + canonicalized_ast: 929e1e876d7dd5d04ae39dd8d4b0b3fa3f0e8783e39056941115fff337a0ef84 + type_inferenced_ast: bc6903d0764db54fd4938835120ab6fa02575b1b896828876153bb30da28a19a diff --git a/tests/expectations/compiler/compiler/function/multiple_returns.leo.out b/tests/expectations/compiler/compiler/function/multiple_returns.leo.out index 4b530e26d4..1a0e723993 100644 --- a/tests/expectations/compiler/compiler/function/multiple_returns.leo.out +++ b/tests/expectations/compiler/compiler/function/multiple_returns.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 13848d71b5ed9a8626538a425b45c8e2863a25c7ac5d3e205726b5f9d6d18a92 - canonicalized_ast: 13848d71b5ed9a8626538a425b45c8e2863a25c7ac5d3e205726b5f9d6d18a92 - type_inferenced_ast: 92582e0580595dd7e21b3586acc69e20972200e4d28fc531e291898ead064667 + initial_ast: 4c1138877fd90e6a2728592a085a567f3ba63d4225abedaf517251b8ddce7a6a + canonicalized_ast: 4c1138877fd90e6a2728592a085a567f3ba63d4225abedaf517251b8ddce7a6a + type_inferenced_ast: 7cf351cd0c0dbe9bb2a87397c2273f09482994ca60be8f8044a4e2d074fc7dd4 diff --git a/tests/expectations/compiler/compiler/function/repeated.leo.out b/tests/expectations/compiler/compiler/function/repeated.leo.out index ec2d33545b..b535091b49 100644 --- a/tests/expectations/compiler/compiler/function/repeated.leo.out +++ b/tests/expectations/compiler/compiler/function/repeated.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: cdd6d6eba721e6bca9e76acdb2845c8e2da16164942c5c533509707d656b7664 - canonicalized_ast: cdd6d6eba721e6bca9e76acdb2845c8e2da16164942c5c533509707d656b7664 - type_inferenced_ast: bb68a6ebb0e5cabfddb62c42ea818150900b77d11c4d8bee69395830f7ad3f4f + initial_ast: 63569735bf4eb8ad55d90df67cf6fefec39579db3326888926142af2cfb26d6f + canonicalized_ast: 63569735bf4eb8ad55d90df67cf6fefec39579db3326888926142af2cfb26d6f + type_inferenced_ast: 542715a7e5c18db26fdadf63bd41e6cb71df4f96bb867eb18ad65c80a965decc diff --git a/tests/expectations/compiler/compiler/function/return.leo.out b/tests/expectations/compiler/compiler/function/return.leo.out index f1e5e89806..35f3cb6c2a 100644 --- a/tests/expectations/compiler/compiler/function/return.leo.out +++ b/tests/expectations/compiler/compiler/function/return.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 92df7901117a5872134a02c2593ad91d4f821f9c4e737b6eaa3c70e47d0c56d3 - canonicalized_ast: 92df7901117a5872134a02c2593ad91d4f821f9c4e737b6eaa3c70e47d0c56d3 - type_inferenced_ast: db5ca1fac0e62fc143e32ff3461081dc2f03d65142fb5f69a5473fa10a5a01d2 + initial_ast: 7195af24acaba1dbba4c8d8848177e7a82e71320a9381e48a2c176e9886699c5 + canonicalized_ast: 7195af24acaba1dbba4c8d8848177e7a82e71320a9381e48a2c176e9886699c5 + type_inferenced_ast: 92e7397b037f436aee2ccd1fb04e95014ed5f1335681c8357592f6a6076cc76c diff --git a/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out b/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out index d38e00acc7..fcca1da90c 100644 --- a/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out +++ b/tests/expectations/compiler/compiler/function/return_array_nested_pass.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 24690ec1392fbd96c2ddb5056b5ca0bb95b2427ded3f6cdb320927cc5818b2a6 - canonicalized_ast: 4c080448843b380ca8806a98242de4fdc8ee8c21e6c6e02f8dd79969c9b75373 - type_inferenced_ast: 2cad77b45346d2f237e6e9b53de49bf1ef438beee8093321db3fa64998624d50 + initial_ast: b310827701505fb4e4457a1c55557f1754437cd4a49a02a421f15e9fca038ccb + canonicalized_ast: a33daa0e9d07ce990b2c3ea8b71c7f6a700415012b8d6fe04f9245f8d3308b59 + type_inferenced_ast: 896b72d52b23f48531c18035033b48d7b96539592de086d8ada0cd18a6a56eb4 diff --git a/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out b/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out index c58f2eb59a..bf5b7f3d89 100644 --- a/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out +++ b/tests/expectations/compiler/compiler/function/return_array_tuple_pass.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: ac6b0e14932396f8e9f85a3315bc7cfdef15d36f359b229a53474cce844a03c8 - canonicalized_ast: cf9081b28cdd68e56334f74f63f3a345a7c7c70279428b4a8ac0c6c8a5812c09 - type_inferenced_ast: cbbae452d1a5e00a194dd2bf6825b9639ceb78b6732d8868e4f6b00392deb49c + initial_ast: b9f2f146319a861d734a70b88cafd0c7a5ea8fde1e9e22687b70400c7457c52a + canonicalized_ast: 1453df7ea8e2245ac6103ac84ac47d2d2dd77a64c74503a1e6b91d5434937c2d + type_inferenced_ast: 08f9c08fcac9ef9da68d227a04f49b9be38b6ce72ffc11ea82acea2cf8fe6b5e diff --git a/tests/expectations/compiler/compiler/function/return_tuple.leo.out b/tests/expectations/compiler/compiler/function/return_tuple.leo.out index 27c1556011..25caceeb64 100644 --- a/tests/expectations/compiler/compiler/function/return_tuple.leo.out +++ b/tests/expectations/compiler/compiler/function/return_tuple.leo.out @@ -19,6 +19,6 @@ outputs: r1: type: u32 value: "103" - initial_ast: 1d456881a8b9924daba1ab93242ceda21ab6517f0adfb2d611042e43ba26461e - canonicalized_ast: 1d456881a8b9924daba1ab93242ceda21ab6517f0adfb2d611042e43ba26461e - type_inferenced_ast: 2c9846396c1ed7077c222213e0fa36b4c004dd03a7c594a807b0292520038074 + initial_ast: d4b008869f1527290e9cd0862e3df4204b32683a96d909dbb6c91fc9489ad0e2 + canonicalized_ast: d4b008869f1527290e9cd0862e3df4204b32683a96d909dbb6c91fc9489ad0e2 + type_inferenced_ast: b8ac5ab2d9383543da885cb474f1e9a237c883a8e9facf60692161d439788f90 diff --git a/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out b/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out index c6c08e18a4..758598b22f 100644 --- a/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out +++ b/tests/expectations/compiler/compiler/function/return_tuple_conditional.leo.out @@ -19,6 +19,6 @@ outputs: b: type: u32 value: "1" - initial_ast: 3d6141e3d8c7131a0c94df520f0ef0f4bbab536371037eb00f32a2814449b10f - canonicalized_ast: 3d6141e3d8c7131a0c94df520f0ef0f4bbab536371037eb00f32a2814449b10f - type_inferenced_ast: 066d3d6dbc14fa17a690de1afe971efe8bb0df8a59066764579e06fedf8599e8 + initial_ast: c429458b4d201fa548eea62e4a2ff8d581f788b7401a03b5f189ae210c3fe132 + canonicalized_ast: c429458b4d201fa548eea62e4a2ff8d581f788b7401a03b5f189ae210c3fe132 + type_inferenced_ast: 1453a4e5252dc0989544abafe9ff5477021ef0f3e8874276e4a989ad23ffaa5a diff --git a/tests/expectations/compiler/compiler/function/value_unchanged.leo.out b/tests/expectations/compiler/compiler/function/value_unchanged.leo.out index c92cf88707..a4e5ddae32 100644 --- a/tests/expectations/compiler/compiler/function/value_unchanged.leo.out +++ b/tests/expectations/compiler/compiler/function/value_unchanged.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: de25c4e52b9bcb763ab7220d413230edd794cd18114fb68b2596c562df47d6fd - canonicalized_ast: 816f3e0fd249b00446678e9a117d4bebc1df9d9f6c8f78dd85adef143a3e9352 - type_inferenced_ast: 30aab60a56592166964c3c6c530e2bfcd4efbddcdb15ee96891012a681585bed + initial_ast: 089803f7197594aeca82cba9bc2eb70b6fdbbf42c007a0949da4c5b1b4f63508 + canonicalized_ast: 415cdab7ff832a06dc7b01e3134b81d36f0efc0efb3ae092c062419c38f57450 + type_inferenced_ast: 91fb5695f3a2c856d2cde8936aaef4cbb94773a2a71b56c00661c72c8fdee50b diff --git a/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out b/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out index 309f17ec5c..3f2ac74f18 100644 --- a/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out +++ b/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "false" - initial_ast: 83a11678cbe927059ac80b31621a768a777980463312843332054491507a1d7c - canonicalized_ast: d6538a71198ea82de94bc76df0aef183fddce985676c23cceb6008518e5542cf - type_inferenced_ast: 7ce28eee23a6e10ea97c1a43345f774f2b76586e1e7c09500ae0e9fd2fd36f37 + initial_ast: 8b9ad0b83a216048ab6179c6e223f68290059bab1deb72771f72a672ea7a0bf9 + canonicalized_ast: acdf383c635404bccf9612be9c14c96e400496fb231cf3062bce9aa269331c0f + type_inferenced_ast: ab3b8dc3ddfba1affaacf2bc344c658d5b82419544da136e42c810a3f99f3832 diff --git a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out index cbf62198af..1eeff43f07 100644 --- a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out +++ b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 385fea62fbb18d0d50d82b6f361b0c08c682ab232b72589abfe22ab156c640fb - canonicalized_ast: dca26c0e783b2e3209a24bc44fc40773014d8761e448915905328901273f4ff0 - type_inferenced_ast: c46aaba5f7b799f430fa9d12521ed8bad3903d8c17da519f5c8cbb1da56d82d4 + initial_ast: d6273a716c2546b210eeefb640b5c34830fb2b2a4195ae0b636843e855fcbc1e + canonicalized_ast: 41a3c4ffe7c243ffc76bc7d3c147f77f71119d64e632581a20eb1cd576752ac3 + type_inferenced_ast: 196e5191c3d8c8cc552b419422b3e1411fa576336f63ae9d5c340bf2a7d62942 diff --git a/tests/expectations/compiler/compiler/import_local/import_all.leo.out b/tests/expectations/compiler/compiler/import_local/import_all.leo.out index baa806d137..af0f7a88be 100644 --- a/tests/expectations/compiler/compiler/import_local/import_all.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_all.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7e831fcef925cf81371077ac162ed3c8a122696bcc3691f129aacf47db941286 - canonicalized_ast: 7e831fcef925cf81371077ac162ed3c8a122696bcc3691f129aacf47db941286 - type_inferenced_ast: 8fb065bc7683cebf37e8cae42e13db8247c007e74fd58b62fd8ecb1d97f67f77 + initial_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 + canonicalized_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 + type_inferenced_ast: be1c8166ce3ae7f805d8600441996328ce8f45ada3c16c4284f07d07af52ef75 diff --git a/tests/expectations/compiler/compiler/import_local/import_as.leo.out b/tests/expectations/compiler/compiler/import_local/import_as.leo.out index ffccfeba70..bc897c1c3f 100644 --- a/tests/expectations/compiler/compiler/import_local/import_as.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_as.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: ff13c8a5aaa7ae4df3738a33c51f5c314811bc695dde8fdd993be40248c32c30 - canonicalized_ast: bda179d38af6772688c36d9316ee5550b5d0ac857abedf499e5beb8efcfcaadc - type_inferenced_ast: 4cf805fd0a99ee8b335dbe428720082fe12ef69ac3ea2b928431aff0246e0eb2 + initial_ast: 47ef8cd0b57a42612bc9138c6da6e05fbca27c47464acf5af569c2fe0c91dd31 + canonicalized_ast: 39c0b27ba63cc34eed735900912e154031ca1f291aade9d9964ce49e77eeb19e + type_inferenced_ast: 19bfc761f899b48a3e0c4142bac6cbdaceac8230e92422cf9f6a99d9f7eddc6f diff --git a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out index d81aacdcd9..ebbd5184aa 100644 --- a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: a7d8eaf643aa12c7c77138b7f7e416e88fe383f6041c7d68542c8bab2d1700bb - canonicalized_ast: f749ae39c4c0aba1da52fa02f809fcbfe6710ec9b405669c506afb3aa945286d - type_inferenced_ast: d517ea5d6a6b59881bf92cf69f37dd9c0d283f05e7d84cfbfe72f0e92a94e02f + initial_ast: 7e0ba7b09b3840a5d4fc9f0d413163ba2de8f207c3818f604f9a71297aac30f3 + canonicalized_ast: 3f7efb61847fd75fed58b70526da8ceffb573a0806521fb30443f341c3d14a45 + type_inferenced_ast: a1baf614c8ab13c1ff978faf8022f90eef4c482261928cb3256ab4d63e20096c diff --git a/tests/expectations/compiler/compiler/import_local/import_files.leo.out b/tests/expectations/compiler/compiler/import_local/import_files.leo.out index 06fd420b77..aaaee96823 100644 --- a/tests/expectations/compiler/compiler/import_local/import_files.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_files.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: bba586b2ea8e1a5ab145d059926dfc46b288dba1a2563fa26f851ec1f0c3fd8e - canonicalized_ast: 3dacbc2c65d335616c89882fdcf1beeed08799fbd6307e1b6b80ddd6662c17d0 - type_inferenced_ast: 5285eb5149cc21273515ed2318e624b07a60001223908d59b8700ba6865518fd + initial_ast: 042e056c86e545ce256459a0de20d44c0bae24ff406becba4330e3208c48e180 + canonicalized_ast: 6cab1ab863f40c96d5d6921e2ced0dd00ebe5e9e334d84508af708be19ae8f59 + type_inferenced_ast: 17ff3e62f1c48edfbfb1c35ed4ac542260b59153d85afeca2e707dde217dc675 diff --git a/tests/expectations/compiler/compiler/import_local/import_many.leo.out b/tests/expectations/compiler/compiler/import_local/import_many.leo.out index e508476420..b379ba5f2e 100644 --- a/tests/expectations/compiler/compiler/import_local/import_many.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_many.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 3e3e8308a013fc0b7f95d96e6246ed7ddb79eff43ac379b648ac83f954855a4f - canonicalized_ast: 3e3e8308a013fc0b7f95d96e6246ed7ddb79eff43ac379b648ac83f954855a4f - type_inferenced_ast: eba4a650d1dc3a0b3d15080a07d052d41ef7b4c9dfeac5489d6291a3ae161b8d + initial_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 + canonicalized_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 + type_inferenced_ast: 1c983cf518cfafbe158ee3e42aed5cb190863b09aedfc4dd34e0268160ee79e2 diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out index e1b5244d5b..22e000786a 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c - canonicalized_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c - type_inferenced_ast: 86ef8ab226a58f140de1fcdadc31eb86e4a1930cabf36a8d9a4607233ea6ab80 + initial_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 + canonicalized_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 + type_inferenced_ast: 58541200a815edfee41333b9b2b048add269d0924ca17457ecf9fbcbb5032ccf diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out index ff15a9143c..e34d9e527a 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: dd316162c260471019781489e499add2b4d7b92c8b3b4a97e81028c8c355300e - canonicalized_ast: dd316162c260471019781489e499add2b4d7b92c8b3b4a97e81028c8c355300e - type_inferenced_ast: d20a15cd27d8783b670949a0a08466414cc46a78146e53f2766eb2c1e83e18a6 + initial_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 + canonicalized_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 + type_inferenced_ast: 50c06c3666a830c7f1fd533c412a4e8054fdb494845f4f5d85414b08f1c1a8dd diff --git a/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out b/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out index 5ecb93be7e..154b3ce4df 100644 --- a/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out +++ b/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: c945d4136b8475c02a035c782811d6e19e67732f58287bc3d07f6e61928388d5 - canonicalized_ast: 71db3be14784c4fe3fe168d47ccc0c481fef735055c3e0f9674266eca7819f7e - type_inferenced_ast: 6f8875f025e24a90c22890e3a067e7466b3edd8bef5cd5f572f7abb8e2405946 + initial_ast: 8db095ba3755c4c0a5c661f82acea4d5088fcc7a1f21445d8f6a76aa349be14c + canonicalized_ast: db2825ad023eb01f420686f407d0411e99d06be1f13116ffce5b18d7e9ceffd6 + type_inferenced_ast: 2afc66cedc72641dbae33927247993fa9b03402889e3a71005888d0e26f34114 diff --git a/tests/expectations/compiler/compiler/mutability/swap.leo.out b/tests/expectations/compiler/compiler/mutability/swap.leo.out index 7cd3d61362..49d15ca400 100644 --- a/tests/expectations/compiler/compiler/mutability/swap.leo.out +++ b/tests/expectations/compiler/compiler/mutability/swap.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "false" - initial_ast: 12c76d4ffae96e57256a8277916b4c9b08e50e748df51d2618347973a5e71144 - canonicalized_ast: 12c76d4ffae96e57256a8277916b4c9b08e50e748df51d2618347973a5e71144 - type_inferenced_ast: 82c6b418dc6bb62fdc840e664af988d427082c7c2fc742e1b6fbf500737d630f + initial_ast: 17828ff8ffc7902cfe67b7816477cf3099c248f7fde312a9792dd311814340c6 + canonicalized_ast: 17828ff8ffc7902cfe67b7816477cf3099c248f7fde312a9792dd311814340c6 + type_inferenced_ast: be55144bf090bcfc6d49170844c89b067b224b241fd953b0b683c70b91baaad4 diff --git a/tests/expectations/compiler/compiler/string/circuit.leo.out b/tests/expectations/compiler/compiler/string/circuit.leo.out index 9e4b7b908f..b607e80f47 100644 --- a/tests/expectations/compiler/compiler/string/circuit.leo.out +++ b/tests/expectations/compiler/compiler/string/circuit.leo.out @@ -16,6 +16,6 @@ outputs: out: type: "[char; 13]" value: "\"Hello, World!\"" - initial_ast: f139d8b2991f574d19551be9d229f78dfc03843e1b9b3dc9f41eb48e4895f6c3 - canonicalized_ast: ac3d36634ce48616f7d2f183bfa80fb3ea44ca49dfc4098b6b93f066991476bf - type_inferenced_ast: 8b12f329a6acbb34973450d299f98604411cd973fe09bc8f5d0096389cd9e346 + initial_ast: 69219c995852ced5fe06a4009c4d58a8b59cc23ed7144ab4f08d4e0d4a6c5798 + canonicalized_ast: c099eab8cd118203aa297b200be1fd331f6e20ed1f19ff87efe16d406f5a0ce0 + type_inferenced_ast: acef5428f299c6cdbd9ac4b644123cf17a379efe025656122e359abe06da7eb8 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 150b0929ba..5c820cc814 100644 --- a/tests/expectations/parser/parser/expression/access/array_access.leo.out +++ b/tests/expectations/parser/parser/expression/access/array_access.leo.out @@ -168,7 +168,6 @@ outputs: col_stop: 7 path: test content: "x[0]()" - type_: ~ - ArrayAccess: array: Call: @@ -182,7 +181,6 @@ outputs: col_stop: 4 path: test content: "x()[0]" - type_: ~ index: Value: Implicit: @@ -216,7 +214,6 @@ outputs: col_stop: 5 path: test content: "x(y)::y(x)" - type_: ~ name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" span: line_start: 1 @@ -234,7 +231,6 @@ outputs: col_stop: 11 path: test content: "x(y)::y(x)" - type_: ~ - ArrayAccess: array: TupleAccess: diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out index ba9082245e..ed9e9058da 100644 --- a/tests/expectations/parser/parser/expression/access/call.leo.out +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -13,7 +13,6 @@ outputs: col_stop: 4 path: test content: x() - type_: ~ - Call: function: Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X()\\\"}\"}" @@ -25,7 +24,6 @@ outputs: col_stop: 4 path: test content: X() - type_: ~ - Call: function: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y)\\\"}\"}" @@ -38,7 +36,6 @@ outputs: col_stop: 5 path: test content: x(y) - type_: ~ - Call: function: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(y, z)\\\"}\"}" @@ -52,7 +49,6 @@ outputs: col_stop: 8 path: test content: "x(y, z)" - type_: ~ - Call: function: Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x(x, y, z)\\\"}\"}" @@ -67,7 +63,6 @@ outputs: col_stop: 11 path: test content: "x(x, y, z)" - type_: ~ - Call: function: CircuitStaticFunctionAccess: @@ -89,7 +84,6 @@ outputs: col_stop: 7 path: test content: "x::y()" - type_: ~ - Call: function: CircuitStaticFunctionAccess: @@ -112,7 +106,6 @@ outputs: col_stop: 8 path: test content: "x::y(x)" - type_: ~ - Call: function: TupleAccess: @@ -136,7 +129,6 @@ outputs: col_stop: 7 path: test content: x.0(x) - type_: ~ - Call: function: ArrayAccess: @@ -168,4 +160,3 @@ outputs: col_stop: 8 path: test content: "x[0](x)" - type_: ~ diff --git a/tests/expectations/parser/parser/expression/access/circuit.leo.out b/tests/expectations/parser/parser/expression/access/circuit.leo.out index c9b8ff5a75..e10176179c 100644 --- a/tests/expectations/parser/parser/expression/access/circuit.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit.leo.out @@ -66,7 +66,6 @@ outputs: col_stop: 6 path: test content: x.y() - type_: ~ - TupleAccess: tuple: CircuitMemberAccess: diff --git a/tests/expectations/parser/parser/expression/access/circuit_static.leo.out b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out index d9099c207f..eed96329a1 100644 --- a/tests/expectations/parser/parser/expression/access/circuit_static.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out @@ -66,7 +66,6 @@ outputs: col_stop: 7 path: test content: "x::y()" - type_: ~ - TupleAccess: tuple: CircuitStaticFunctionAccess: diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index 3fa2ab005b..de785f2be6 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -68,7 +68,6 @@ outputs: col_stop: 5 path: test content: "-x()" - type_: ~ op: Negate span: line_start: 1 diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out index 2f0b89534e..5c93154572 100644 --- a/tests/expectations/parser/parser/expression/unary/not.leo.out +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -68,7 +68,6 @@ outputs: col_stop: 5 path: test content: "!x()" - type_: ~ op: Not span: line_start: 1 diff --git a/tests/expectations/parser/parser/statement/assign.leo.out b/tests/expectations/parser/parser/statement/assign.leo.out index 056c759f45..d992c636a2 100644 --- a/tests/expectations/parser/parser/statement/assign.leo.out +++ b/tests/expectations/parser/parser/statement/assign.leo.out @@ -140,7 +140,6 @@ outputs: col_stop: 8 path: test content: x = x(); - type_: ~ span: line_start: 1 line_stop: 1 diff --git a/tests/expectations/parser/parser/statement/definition.leo.out b/tests/expectations/parser/parser/statement/definition.leo.out index dd9242024a..fa12ad7cea 100644 --- a/tests/expectations/parser/parser/statement/definition.leo.out +++ b/tests/expectations/parser/parser/statement/definition.leo.out @@ -145,7 +145,6 @@ outputs: col_stop: 12 path: test content: let x = x(); - type_: ~ span: line_start: 1 line_stop: 1 @@ -296,7 +295,6 @@ outputs: col_stop: 14 path: test content: const x = x(); - type_: ~ span: line_start: 1 line_stop: 1 @@ -452,7 +450,6 @@ outputs: col_stop: 17 path: test content: "let x: u32 = x();" - type_: ~ span: line_start: 1 line_stop: 1 @@ -608,7 +605,6 @@ outputs: col_stop: 19 path: test content: "const x: u32 = x();" - type_: ~ span: line_start: 1 line_stop: 1 @@ -804,7 +800,6 @@ outputs: col_stop: 17 path: test content: "let (x, y) = x();" - type_: ~ span: line_start: 1 line_stop: 1 @@ -1000,7 +995,6 @@ outputs: col_stop: 19 path: test content: "const (x, y) = x();" - type_: ~ span: line_start: 1 line_stop: 1 @@ -1201,7 +1195,6 @@ outputs: col_stop: 22 path: test content: "let (x, y): u32 = x();" - type_: ~ span: line_start: 1 line_stop: 1 @@ -1402,7 +1395,6 @@ outputs: col_stop: 24 path: test content: "const (x, y): u32 = x();" - type_: ~ span: line_start: 1 line_stop: 1 diff --git a/tests/expectations/parser/parser/statement/expression.leo.out b/tests/expectations/parser/parser/statement/expression.leo.out index 7cf3b04e62..f9542ff844 100644 --- a/tests/expectations/parser/parser/statement/expression.leo.out +++ b/tests/expectations/parser/parser/statement/expression.leo.out @@ -85,7 +85,6 @@ outputs: col_stop: 4 path: test content: x(); - type_: ~ span: line_start: 1 line_stop: 1 From 56c66fa4ba4ef8e031b80215617d9ba7a4085fc9 Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 18 Aug 2021 14:31:06 -0700 Subject: [PATCH 50/62] testing and clean up --- asg/src/expression/call.rs | 1 + asg/src/expression/circuit_access.rs | 1 + asg/src/statement/mod.rs | 4 +-- ast/src/expression/circuit_member_access.rs | 1 + ast/src/reducer/canonicalization.rs | 6 ++-- ast/src/reducer/reconstructing_director.rs | 9 +++-- ast/src/reducer/reconstructing_reducer.rs | 2 ++ ast/src/statements/statement.rs | 2 +- compiler/src/phases/reducing_director.rs | 35 ++++++++++++++----- compiler/src/test.rs | 2 +- parser/src/parser/expression.rs | 1 + parser/src/parser/statement.rs | 2 +- .../compiler/array/complex_access.leo.out | 6 ++-- .../compiler/compiler/array/registers.leo.out | 6 ++-- .../compiler/compiler/char/circuit.leo.out | 6 ++-- .../big_self_in_circuit_replacement.leo.out | 6 ++-- .../circuits/const_self_variable.leo.out | 6 ++-- ...ne_circuit_inside_circuit_function.leo.out | 6 ++-- .../compiler/compiler/circuits/inline.leo.out | 6 ++-- .../circuits/inline_member_pass.leo.out | 6 ++-- .../compiler/circuits/member_function.leo.out | 6 ++-- .../circuits/member_function_nested.leo.out | 6 ++-- .../compiler/circuits/member_variable.leo.out | 6 ++-- .../member_variable_and_function.leo.out | 6 ++-- .../circuits/mut_self_variable.leo.out | 6 ++-- .../circuits/mut_self_variable_branch.leo.out | 6 ++-- .../mut_self_variable_conditional.leo.out | 6 ++-- .../compiler/circuits/mut_variable.leo.out | 6 ++-- .../mutable_call_immutable_context.leo.out | 6 ++-- .../compiler/circuits/pedersen_mock.leo.out | 6 ++-- .../compiler/circuits/self_member.leo.out | 6 ++-- .../function/multiple_returns_main.leo.out | 6 ++-- .../global_consts/global_const_types.leo.out | 6 ++-- .../tests/import_dependency_folder.leo.out | 6 ++-- .../compiler/import_local/import_all.leo.out | 6 ++-- .../compiler/import_local/import_as.leo.out | 6 ++-- .../compiler/import_local/import_dir.leo.out | 6 ++-- .../import_local/import_files.leo.out | 6 ++-- .../compiler/import_local/import_many.leo.out | 6 ++-- .../import_local/import_weird_names.leo.out | 6 ++-- .../import_weird_names_nested.leo.out | 6 ++-- .../basic.leo.out | 6 ++-- .../token_withdraw.leo.out | 6 ++-- .../program_state/access_all.leo.out | 6 ++-- .../program_state/access_state.leo.out | 6 ++-- .../mutability/circuit_function_mut.leo.out | 6 ++-- .../mutability/circuit_variable_mut.leo.out | 6 ++-- .../statements/compound_assignment.leo.out | 6 ++-- .../compiler/compiler/string/circuit.leo.out | 6 ++-- .../access/array_range_access.leo.out | 8 +++++ .../parser/expression/access/circuit.leo.out | 7 ++++ .../parser/expression/unary/negate.leo.out | 1 + .../parser/expression/unary/not.leo.out | 1 + 53 files changed, 177 insertions(+), 128 deletions(-) diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index 41b7cb0660..1c060191f0 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -90,6 +90,7 @@ impl<'a> FromAst<'a, leo_ast::CallExpression> for CallExpression<'a> { circuit: ast_circuit, name, span, + .. }) => { let target = <&Expression<'a>>::from_ast(scope, &**ast_circuit, None)?; let circuit = match target.get_type() { diff --git a/asg/src/expression/circuit_access.rs b/asg/src/expression/circuit_access.rs index e945c8f902..8edb0250f6 100644 --- a/asg/src/expression/circuit_access.rs +++ b/asg/src/expression/circuit_access.rs @@ -214,6 +214,7 @@ impl<'a> Into for &CircuitAccessExpression<'a> { circuit: Box::new(target.into()), name: self.member.clone(), span: self.span.clone().unwrap_or_default(), + type_: None, }) } else { leo_ast::Expression::CircuitStaticFunctionAccess(leo_ast::CircuitStaticFunctionAccessExpression { diff --git a/asg/src/statement/mod.rs b/asg/src/statement/mod.rs index c564eac4b8..f4503fe3ee 100644 --- a/asg/src/statement/mod.rs +++ b/asg/src/statement/mod.rs @@ -94,7 +94,7 @@ impl<'a> FromAst<'a, leo_ast::Statement> for &'a Statement<'a> { scope, statement, None, )?)) } - Iteration(statement) => Self::from_ast(scope, statement, None)?, + Iteration(ref statement) => Self::from_ast(scope, &**statement, None)?, Console(statement) => scope .context .alloc_statement(Statement::Console(ConsoleStatement::from_ast(scope, statement, None)?)), @@ -120,7 +120,7 @@ impl<'a> Into for &Statement<'a> { Definition(statement) => leo_ast::Statement::Definition(statement.into()), Assign(statement) => leo_ast::Statement::Assign(statement.into()), Conditional(statement) => leo_ast::Statement::Conditional(statement.into()), - Iteration(statement) => leo_ast::Statement::Iteration(statement.into()), + Iteration(statement) => leo_ast::Statement::Iteration(Box::new(statement.into())), Console(statement) => leo_ast::Statement::Console(statement.into()), Expression(statement) => leo_ast::Statement::Expression(statement.into()), Block(statement) => leo_ast::Statement::Block(statement.into()), diff --git a/ast/src/expression/circuit_member_access.rs b/ast/src/expression/circuit_member_access.rs index a86c5a85d1..8592a3f1b0 100644 --- a/ast/src/expression/circuit_member_access.rs +++ b/ast/src/expression/circuit_member_access.rs @@ -21,6 +21,7 @@ pub struct CircuitMemberAccessExpression { pub circuit: Box, pub name: Identifier, pub span: Span, + pub type_: Option, } impl fmt::Display for CircuitMemberAccessExpression { diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 0e14208fc1..b3ad9197a4 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -75,6 +75,7 @@ impl Canonicalizer { circuit: left, name: identifier, span: span.clone(), + type_: None, })); } } @@ -260,6 +261,7 @@ impl Canonicalizer { circuit: Box::new(self.canonicalize_expression(&circuit_member_access.circuit)), name: circuit_member_access.name.clone(), span: circuit_member_access.span.clone(), + type_: None, }); } Expression::CircuitStaticFunctionAccess(circuit_static_func_access) => { @@ -383,14 +385,14 @@ impl Canonicalizer { let stop = self.canonicalize_expression(&iteration.stop); let block = self.canonicalize_block(&iteration.block); - Statement::Iteration(IterationStatement { + Statement::Iteration(Box::new(IterationStatement { variable: iteration.variable.clone(), start, stop, inclusive: iteration.inclusive, block, span: iteration.span.clone(), - }) + })) } Statement::Console(console_function_call) => { let function = match &console_function_call.function { diff --git a/ast/src/reducer/reconstructing_director.rs b/ast/src/reducer/reconstructing_director.rs index d7710df122..9dedf95f5a 100644 --- a/ast/src/reducer/reconstructing_director.rs +++ b/ast/src/reducer/reconstructing_director.rs @@ -252,9 +252,14 @@ impl ReconstructingDirector { ) -> Result { let circuit = self.reduce_expression(&circuit_member_access.circuit)?; let name = self.reduce_identifier(&circuit_member_access.name)?; + let type_ = circuit_member_access + .type_ + .as_ref() + .map(|type_| self.reduce_type(type_, &circuit_member_access.span)) + .transpose()?; self.reducer - .reduce_circuit_member_access(circuit_member_access, circuit, name) + .reduce_circuit_member_access(circuit_member_access, circuit, name, type_) } pub fn reduce_circuit_static_fn_access( @@ -286,7 +291,7 @@ impl ReconstructingDirector { Statement::Definition(definition) => Statement::Definition(self.reduce_definition(definition)?), Statement::Assign(assign) => Statement::Assign(self.reduce_assign(assign)?), Statement::Conditional(conditional) => Statement::Conditional(self.reduce_conditional(conditional)?), - Statement::Iteration(iteration) => Statement::Iteration(self.reduce_iteration(iteration)?), + Statement::Iteration(iteration) => Statement::Iteration(Box::new(self.reduce_iteration(iteration)?)), Statement::Console(console) => Statement::Console(self.reduce_console(console)?), Statement::Expression(expression) => Statement::Expression(self.reduce_expression_statement(expression)?), Statement::Block(block) => Statement::Block(self.reduce_block(block)?), diff --git a/ast/src/reducer/reconstructing_reducer.rs b/ast/src/reducer/reconstructing_reducer.rs index 9bac0a88c7..9df0b6a0c1 100644 --- a/ast/src/reducer/reconstructing_reducer.rs +++ b/ast/src/reducer/reconstructing_reducer.rs @@ -219,11 +219,13 @@ pub trait ReconstructingReducer { circuit_member_access: &CircuitMemberAccessExpression, circuit: Expression, name: Identifier, + type_: Option, ) -> Result { Ok(CircuitMemberAccessExpression { circuit: Box::new(circuit), name, span: circuit_member_access.span.clone(), + type_, }) } diff --git a/ast/src/statements/statement.rs b/ast/src/statements/statement.rs index f60c019edb..26f049fce4 100644 --- a/ast/src/statements/statement.rs +++ b/ast/src/statements/statement.rs @@ -27,7 +27,7 @@ pub enum Statement { Definition(DefinitionStatement), Assign(AssignStatement), Conditional(ConditionalStatement), - Iteration(IterationStatement), + Iteration(Box), Console(ConsoleStatement), Expression(ExpressionStatement), Block(Block), diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/phases/reducing_director.rs index 49480254e0..e36ff3e583 100644 --- a/compiler/src/phases/reducing_director.rs +++ b/compiler/src/phases/reducing_director.rs @@ -232,17 +232,31 @@ impl CombineAstAsgDirector { ast: &AstCallExpression, asg: &AsgCallExpression, ) -> Result { - // TODO FIGURE IT OUT - // let function = self.reduce_expression(&ast.function, asg.function.get())?; - // let target = asg.target.get().map(|exp| self.reduce_expression()) - // Is this needed? + let mut function = *ast.function.clone(); + + if self.options.type_inference_enabled() { + let function_type: Option = asg + .target + .get() + .map(|target| { + (target as &dyn leo_asg::ExpressionNode) + .get_type() + .as_ref() + .map(|t| t.into()) + }) + .flatten(); + if let AstExpression::CircuitMemberAccess(mut access) = function { + access.type_ = function_type; + function = AstExpression::CircuitMemberAccess(access); + } + } let mut arguments = vec![]; for (ast_arg, asg_arg) in ast.arguments.iter().zip(asg.arguments.iter()) { arguments.push(self.reduce_expression(ast_arg, asg_arg.get())?); } - self.ast_reducer.reduce_call(ast, *ast.function.clone(), arguments) + self.ast_reducer.reduce_call(ast, function, arguments) } pub fn reduce_cast( @@ -259,14 +273,19 @@ impl CombineAstAsgDirector { pub fn reduce_circuit_member_access( &mut self, ast: &CircuitMemberAccessExpression, - _asg: &AsgCircuitAccessExpression, + asg: &AsgCircuitAccessExpression, ) -> Result { // let circuit = self.reduce_expression(&circuit_member_access.circuit)?; // let name = self.reduce_identifier(&circuit_member_access.name)?; // let target = input.target.get().map(|e| self.reduce_expression(e)); + let type_ = if self.options.type_inference_enabled() { + Some(leo_ast::Type::Circuit(asg.circuit.get().name.borrow().clone())) + } else { + None + }; self.ast_reducer - .reduce_circuit_member_access(ast, *ast.circuit.clone(), ast.name.clone()) + .reduce_circuit_member_access(ast, *ast.circuit.clone(), ast.name.clone(), type_) } pub fn reduce_circuit_static_fn_access( @@ -445,7 +464,7 @@ impl CombineAstAsgDirector { AstStatement::Expression(self.reduce_expression_statement(ast, asg)?) } (AstStatement::Iteration(ast), AsgStatement::Iteration(asg)) => { - AstStatement::Iteration(self.reduce_iteration(ast, asg)?) + AstStatement::Iteration(Box::new(self.reduce_iteration(ast, asg)?)) } (AstStatement::Return(ast), AsgStatement::Return(asg)) => { AstStatement::Return(self.reduce_return(ast, asg)?) diff --git a/compiler/src/test.rs b/compiler/src/test.rs index d7ccbdedb5..d87ca4a241 100644 --- a/compiler/src/test.rs +++ b/compiler/src/test.rs @@ -68,7 +68,7 @@ pub(crate) fn parse_program( theorem_options: Option, cwd: Option, ) -> Result { - let mut compiler = new_compiler(cwd.unwrap_or("compiler-test".into()), theorem_options); + let mut compiler = new_compiler(cwd.unwrap_or_else(|| "compiler-test".into()), theorem_options); compiler.parse_program_from_string(program_string)?; diff --git a/parser/src/parser/expression.rs b/parser/src/parser/expression.rs index 789ecaf9de..b378c50315 100644 --- a/parser/src/parser/expression.rs +++ b/parser/src/parser/expression.rs @@ -450,6 +450,7 @@ impl ParserContext { span: expr.span() + &ident.span, circuit: Box::new(expr), name: ident, + type_: None, }); } else if let Some((num, span)) = self.eat_int() { expr = Expression::TupleAccess(TupleAccessExpression { diff --git a/parser/src/parser/statement.rs b/parser/src/parser/statement.rs index 1448dad6bc..c9a37dc9e5 100644 --- a/parser/src/parser/statement.rs +++ b/parser/src/parser/statement.rs @@ -89,7 +89,7 @@ impl ParserContext { match &self.peek()?.token { Token::Return => Ok(Statement::Return(self.parse_return_statement()?)), Token::If => Ok(Statement::Conditional(self.parse_conditional_statement()?)), - Token::For => Ok(Statement::Iteration(self.parse_loop_statement()?)), + Token::For => Ok(Statement::Iteration(Box::new(self.parse_loop_statement()?))), Token::Console => Ok(Statement::Console(self.parse_console_statement()?)), Token::Let | Token::Const => Ok(Statement::Definition(self.parse_definition_statement()?)), Token::LeftCurly => Ok(Statement::Block(self.parse_block()?)), diff --git a/tests/expectations/compiler/compiler/array/complex_access.leo.out b/tests/expectations/compiler/compiler/array/complex_access.leo.out index b90f25e21b..a19f966b00 100644 --- a/tests/expectations/compiler/compiler/array/complex_access.leo.out +++ b/tests/expectations/compiler/compiler/array/complex_access.leo.out @@ -16,6 +16,6 @@ outputs: out: type: bool value: "true" - initial_ast: 9808de8c342c41e060d3d3134eb168c8d8cc3ff0641cb8d9779a1746b9fa1687 - canonicalized_ast: 1479a9afd623ad11ca137555fd86a3f0a6da39641d5b2da712273242541c246e - type_inferenced_ast: 9bf998e088b9cce0f40a0326fa8e744c88d8168e04c563a2fbd6a57acd23da1f + initial_ast: 3e3ba85223f07d8df95f7ad67db3037eefbdff41f6f656ad423ee72af2d00d1d + canonicalized_ast: e4e6a8c0e82d4f7d5d6e325dccd81394be5440592d4e68390fba144a8ef9b9da + type_inferenced_ast: fa54884de7afa0466b0d86f141711a2485297334553e5071fdf6f14ae9f35aed diff --git a/tests/expectations/compiler/compiler/array/registers.leo.out b/tests/expectations/compiler/compiler/array/registers.leo.out index 9960fc5374..5dbde4c3cb 100644 --- a/tests/expectations/compiler/compiler/array/registers.leo.out +++ b/tests/expectations/compiler/compiler/array/registers.leo.out @@ -22,6 +22,6 @@ outputs: r: type: "[u8; 3]" value: "\"123\"" - initial_ast: 81dd2c459d5a1bff4963fb2cfdc67348183061934025b96739dc05c7b65a2a8b - canonicalized_ast: 81dd2c459d5a1bff4963fb2cfdc67348183061934025b96739dc05c7b65a2a8b - type_inferenced_ast: fcb8de69c92dff4a4adb8a160fc3b78042f394cd0dc627c5bf06820a095d7012 + initial_ast: b3db525091621f7c96908a112c405a1e222e86bc9909e238d6716cf0ea3359c7 + canonicalized_ast: b3db525091621f7c96908a112c405a1e222e86bc9909e238d6716cf0ea3359c7 + type_inferenced_ast: d19ec51bcaeab5ce9c458f093cf37b62597ae327fd3c1cd12aa011d52e51ecab diff --git a/tests/expectations/compiler/compiler/char/circuit.leo.out b/tests/expectations/compiler/compiler/char/circuit.leo.out index 65ee2bb59e..eda5d67ff5 100644 --- a/tests/expectations/compiler/compiler/char/circuit.leo.out +++ b/tests/expectations/compiler/compiler/char/circuit.leo.out @@ -100,6 +100,6 @@ outputs: r: type: char value: "'\\u{1f62d}'" - initial_ast: 680d480560e2a187669f5bf3c328cee1865021cbe4c19f3350db843d312b6406 - canonicalized_ast: 680d480560e2a187669f5bf3c328cee1865021cbe4c19f3350db843d312b6406 - type_inferenced_ast: 385365a7d46c458c2d5f94690acc53191bf234bcdb928a9efc454c33ba06718a + initial_ast: 83dc2100bd08cc90ce293f2fbf8865b83226c682ff5599947e2b830243295621 + canonicalized_ast: 83dc2100bd08cc90ce293f2fbf8865b83226c682ff5599947e2b830243295621 + type_inferenced_ast: d55e454409b858468acd7d1c5da2fca281b97d3f21f857d180d5edd0a8575f26 diff --git a/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out b/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out index 7bd0bf3fb0..48eef5f149 100644 --- a/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out +++ b/tests/expectations/compiler/compiler/circuits/big_self_in_circuit_replacement.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: aa87a9d1c477e2d5b7ae824fb434188dd6c5c519dd27ebaecd30e44be401ee1b - canonicalized_ast: f188b62839a17478878fe1dfc9863bac20fa1c0c6cf51eae5e13c5f5f79f6c1a - type_inferenced_ast: 9e838aeeebdd2f800c2e7305614f123c27d8390fbadabf1bcb15dae6466669a6 + initial_ast: 9b1c67bf2331fe4da11b6b867d5c76fcf448619a6073e5d6db5afa27c89a4499 + canonicalized_ast: 664905b95a1dcd37b30f5ccc2b752b676692fff3e66e48877c3009a1bcce5d8c + type_inferenced_ast: 05050c06a9a39f5966f635be432347abd80dfc98e6ac79ab44c6806c24563281 diff --git a/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out b/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out index 0dec0b1733..ffba47c97e 100644 --- a/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/const_self_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: da9350459a9579ec5961fc26b81a67a88060caaaea27448fa02f86271227b213 - canonicalized_ast: da9350459a9579ec5961fc26b81a67a88060caaaea27448fa02f86271227b213 - type_inferenced_ast: 2dd2c4378253f239047ae310657e24dae70ba7181d1cf08d89007c2f1a37d332 + initial_ast: d0a8dc662c95787e6aec31df6e69c1d21cfffa21769127be1054b0b620c0cc0b + canonicalized_ast: d0a8dc662c95787e6aec31df6e69c1d21cfffa21769127be1054b0b620c0cc0b + type_inferenced_ast: c866d4b57ac01d16715eb5fa02a6f093d443a672173a8da62b6e1dd4c9ee4081 diff --git a/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out b/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out index 8423b5b6ec..c1d9100359 100644 --- a/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/define_circuit_inside_circuit_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 583cb3219a67fcbb30d241dec9e2860d99db27b109c8d095c10838ea342efd3c - canonicalized_ast: 583cb3219a67fcbb30d241dec9e2860d99db27b109c8d095c10838ea342efd3c - type_inferenced_ast: bbb33dca916b1310a58492ecd4bc74ed03ef3ab87870391839fc8b627f31e941 + initial_ast: 017de7aca61c81bbed015e878e128c3cb5e795ccd3e7a77ef3f1b54b3d1ce18b + canonicalized_ast: 017de7aca61c81bbed015e878e128c3cb5e795ccd3e7a77ef3f1b54b3d1ce18b + type_inferenced_ast: c2c44fbee1f8e5c021d51ac239905b78ceebfce1e1de47b9713b8350afdd6f6e diff --git a/tests/expectations/compiler/compiler/circuits/inline.leo.out b/tests/expectations/compiler/compiler/circuits/inline.leo.out index 859d29d610..4286743f7e 100644 --- a/tests/expectations/compiler/compiler/circuits/inline.leo.out +++ b/tests/expectations/compiler/compiler/circuits/inline.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: u32 value: "100" - initial_ast: 7a6b3abb44b3770f98b45c1f961539ae538e1b5fb2b62ae7bffeaf2209739bc3 - canonicalized_ast: 7a6b3abb44b3770f98b45c1f961539ae538e1b5fb2b62ae7bffeaf2209739bc3 - type_inferenced_ast: 88703ec6b9780a1e7629b14afd0e3da35ff4d68f968db2926242f745d6f61b4d + initial_ast: c7830ab4fe672f5563a211fea5f81494ca551bdb78279124249374d30f978259 + canonicalized_ast: c7830ab4fe672f5563a211fea5f81494ca551bdb78279124249374d30f978259 + type_inferenced_ast: ac748f5effbf5533a45bb3b9e323abe278c0198e8293f383163e1226d6342b3e diff --git a/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out b/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out index 86e9316902..d6864542df 100644 --- a/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out +++ b/tests/expectations/compiler/compiler/circuits/inline_member_pass.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 489c3e8ccafc04e118846f4009d93dfbf018902fbdcd1dde6798cc853bcd8903 - canonicalized_ast: 4b8614afcbaf258d87202daa83f1340762d9a90f4edd7723b8a83df74acbbeb1 - type_inferenced_ast: 3e23d0db328e40ffa2a1ced543295650aa724a8b2dc795bbca54a40ca726b59a + initial_ast: c0383e677f30f3f3ae1d50118cd802f15bc038700ad29c8af8d1ca75af32ea15 + canonicalized_ast: 84b2c3ce0552288c687a1f87acd0682ad208e2c84a7a5c6f1616bd13ade21e62 + type_inferenced_ast: 3b671726641fff32235e6726954c18b1bc5fff4cc9f2e33138c19b9abd82d36c diff --git a/tests/expectations/compiler/compiler/circuits/member_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_function.leo.out index 206329dc34..88399d2b1c 100644 --- a/tests/expectations/compiler/compiler/circuits/member_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 8eacc56577069bef188ac3bbabbceaca5fb8955af1e8ea74ef52f01ce7bd4516 - canonicalized_ast: 8eacc56577069bef188ac3bbabbceaca5fb8955af1e8ea74ef52f01ce7bd4516 - type_inferenced_ast: d5947d1cd599d713fdaafe3cc1084784639c768d5069151dfe7dd0cb02e28ae2 + initial_ast: ba78462720a15b8f4d65b2b7493a7ed78c749cd099fd6a3e79b4d627bbe50ddb + canonicalized_ast: ba78462720a15b8f4d65b2b7493a7ed78c749cd099fd6a3e79b4d627bbe50ddb + type_inferenced_ast: 2d936fece3722aad24dd322dd8773438ad6553082f4839fe044e77ab8d656dec diff --git a/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out b/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out index c36f829b9a..ceb767d436 100644 --- a/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_function_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: f4796f1f9215d0c6d42478aae63b1495dfad36eaaec4a981dddac9def85ffef0 - canonicalized_ast: f4796f1f9215d0c6d42478aae63b1495dfad36eaaec4a981dddac9def85ffef0 - type_inferenced_ast: f808f56c8af9d6677bf54e7f777b3023f82144462df704dc4f3e39830be4c109 + initial_ast: 2ecd73052650570a730f782fa6f74dec155b964ab49a70eee1dea41e43f626f0 + canonicalized_ast: 2ecd73052650570a730f782fa6f74dec155b964ab49a70eee1dea41e43f626f0 + type_inferenced_ast: 5d704c7c544e92d1cc01a214a475fe784f08f8f26398b075424966357e82eca4 diff --git a/tests/expectations/compiler/compiler/circuits/member_variable.leo.out b/tests/expectations/compiler/compiler/circuits/member_variable.leo.out index 3d5447716c..2b9f439a12 100644 --- a/tests/expectations/compiler/compiler/circuits/member_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 701fc149d818f5cfc5c0a2465c46ca76c42d6d558ec0077960a37ae179f401b0 - canonicalized_ast: 701fc149d818f5cfc5c0a2465c46ca76c42d6d558ec0077960a37ae179f401b0 - type_inferenced_ast: 6a3729bb8e9948a84a0fd5a825510420f57ec7979695dc816795a83258a415e8 + initial_ast: 71687b176dd206b1c4f74be132b52e80add9072f42d492f27d64e04ffeec0449 + canonicalized_ast: 71687b176dd206b1c4f74be132b52e80add9072f42d492f27d64e04ffeec0449 + type_inferenced_ast: b71e2bedba29671049b59392cef640f33d6d889a91eb2848878e7e465b58f0ba diff --git a/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out b/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out index 7ede51f889..ba6bab87bd 100644 --- a/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out +++ b/tests/expectations/compiler/compiler/circuits/member_variable_and_function.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 033ac2bd59dacfd0e1f551feee772337e15a3c9eca8fa64075b1f6c411b2f235 - canonicalized_ast: 033ac2bd59dacfd0e1f551feee772337e15a3c9eca8fa64075b1f6c411b2f235 - type_inferenced_ast: a90d633d8db0a339186dc314f4de35ed970aec22cfccd423f49824ade7dcf70b + initial_ast: 63de15e8c8bd9ddbe813568e831df03f1b5d61b73552ffc7663f88254a667675 + canonicalized_ast: 63de15e8c8bd9ddbe813568e831df03f1b5d61b73552ffc7663f88254a667675 + type_inferenced_ast: a0252ac4dd8d899b9de2245a0a9da52e2d453724a1460729bf9080bd85e25918 diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out index a7c760ec44..ad5c2fa6bc 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 35c17de2e9d8a63b29cbeaeeb7eebfa886ff4ae536938e571e953ee206ba8a59 - canonicalized_ast: 8f09ad7c9a20220bf8d9fe7e5c84a7c1e99b840fbeb682fb5646df9a05efbd8b - type_inferenced_ast: b1e1e8b1c22a2c98f82d26a1a339952dbe085366b5dc3bb36d71cf4c842739b9 + initial_ast: b79a2575c7197fbf84fde3f76907b090df3276ee19226b8cf29e085e1bca293f + canonicalized_ast: 679f991e238383bbdacab1c73c3fb74bb48cb4e28cb0a1056320f66d9f5bdef7 + type_inferenced_ast: bed66d5177af10f49f9606dbaf0d907cc2edf54d9ba8cbebb78ce6597a3d4ed5 diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out index 90c520afac..e19e94af06 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable_branch.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 5654f2be64d7879bfa2cb49029bd6c3b757c0eb28dd32744de41a28effae5891 - canonicalized_ast: 42710d4ec40860cbd1a88da9738960c5a07a6a9937436ec474b3f1bbc805aac4 - type_inferenced_ast: d7f138829083963f935922d492a94a693b963d3acee6fadb325be8d99f0e4d19 + initial_ast: 1604eadec9fd814ed2a25a47d65ba466923085e42535fdde616ab91b84df58b6 + canonicalized_ast: 780f1b481da6ceb8370fbf1623dffe9e221e1eaeb49a508e65f23a9e6fd66c2e + type_inferenced_ast: 6ad36ae09c6a97c3f6e0c17e067b5b8f7249ddfdcf82299772600fe57fd21d05 diff --git a/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out b/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out index d50ce4095d..ec66d5e11f 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_self_variable_conditional.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 46fccf2a1d04ff7bbfb9a88eeceb6cfd39adcf7ce2e2323d4fb83f4ae3dba273 - canonicalized_ast: 222568f9f7b61876690514fdd2dd12419b2e889269a2b7aabd7223d291167da5 - type_inferenced_ast: f1a5656978bd48409401788332b1a1d90c969178e65af06b54d5b4445be84375 + initial_ast: 64a1b6b1a6ee85c634ca751a4e02aa79241292bb5d85c6203bcd58cd7118c250 + canonicalized_ast: b42168f9136f4d24344749de5d965094b25ef02fca3ff2fafcca4261fe0498fe + type_inferenced_ast: 88447d445a55f04f55d8cb6cb7874c2b4fe58c4f31183fbe3e8ef8b0cbdd8dd9 diff --git a/tests/expectations/compiler/compiler/circuits/mut_variable.leo.out b/tests/expectations/compiler/compiler/circuits/mut_variable.leo.out index bff2c8dada..88e076a930 100644 --- a/tests/expectations/compiler/compiler/circuits/mut_variable.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mut_variable.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 684a9fc0a433525dfbe52d8037588845ad55782b2c1b046bd91049c3b9d9ea4c - canonicalized_ast: 684a9fc0a433525dfbe52d8037588845ad55782b2c1b046bd91049c3b9d9ea4c - type_inferenced_ast: 1fce4132eea4711a6b42fab47478d3608d16df3930554350ed46d865162f7043 + initial_ast: dbd9f87921535e5269952220b41d1e2494988fe55bc4d9c339591deb50a8deec + canonicalized_ast: dbd9f87921535e5269952220b41d1e2494988fe55bc4d9c339591deb50a8deec + type_inferenced_ast: a2a0d048a15f73bea5dc90da534ec3660e3b8b83129332508c6c80a7f4dabece diff --git a/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out b/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out index 5ea932e6db..a10941daab 100644 --- a/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out +++ b/tests/expectations/compiler/compiler/circuits/mutable_call_immutable_context.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: bd8793749cfd151b89162febc55b6bb6de1be867a0009da6a8470106953db630 - canonicalized_ast: 9ecf61f153db9d0912cae6891258e0ebdaecd0da6eef7bbc92c3a6476c7adf6d - type_inferenced_ast: 6908fc70e763ff518a9942a3b930aac64b70075be1b734c2ac93175ca1f16f97 + initial_ast: f273c6ca514a9741c6ffd81f4988a8a871ab431dc005cdcf23fd40c133e55d6c + canonicalized_ast: 1d6ac1e465454c9cd8dce30c67cd86b5f0e22d8703a1876cb8874f995777aacb + type_inferenced_ast: 14e96eb628e8226fad23b3cf26015dcda3833227460b03490c89fa6b3e8622f8 diff --git a/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out b/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out index bec7e9cfc6..8cd14653d1 100644 --- a/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out +++ b/tests/expectations/compiler/compiler/circuits/pedersen_mock.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: c983e5e79b4325ac133ac1a5ff0b1655c646111389991286322b8c16c5833837 - canonicalized_ast: 8dcb714238ef7e9fd3c66a7a12ec4621bb4e9ac5994f1c692215a9f93463ce9e - type_inferenced_ast: ebd34799bd1c6936ca5032812d2466bade58df616cc06e3c6e57151a06b78601 + initial_ast: 9b6b6e753c84f5711fdf93ed977cce28edc91ffb3cbbf111ea7ed338ca6b530a + canonicalized_ast: 1ba4f5a98aea455a3177098c8c48141030999a5e0d54f4bcc7073d4f11d9ab90 + type_inferenced_ast: 7c195b6b9a50cd004d70e8db1b7056dcb7a44aef114e97864e0d9587d1edc65e diff --git a/tests/expectations/compiler/compiler/circuits/self_member.leo.out b/tests/expectations/compiler/compiler/circuits/self_member.leo.out index 5311554177..e1e8379d8a 100644 --- a/tests/expectations/compiler/compiler/circuits/self_member.leo.out +++ b/tests/expectations/compiler/compiler/circuits/self_member.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: ef90c67bd868ad3d1362b37acad99a97316700c60c9667a4d67b8ad392b2922c - canonicalized_ast: ef90c67bd868ad3d1362b37acad99a97316700c60c9667a4d67b8ad392b2922c - type_inferenced_ast: 636fbf53660cedd9c05b6c361fae19ae5adaae85adc98e888308072ef843f8fa + initial_ast: 99f9f8472dad22d652fd62a10a172571a6e99996c670e51d548315921c925ca0 + canonicalized_ast: 99f9f8472dad22d652fd62a10a172571a6e99996c670e51d548315921c925ca0 + type_inferenced_ast: 4ad3ac0c4dd7a77adf119c87f6f8debe9b289b9a1624cf8c003e594e0e195bdc diff --git a/tests/expectations/compiler/compiler/function/multiple_returns_main.leo.out b/tests/expectations/compiler/compiler/function/multiple_returns_main.leo.out index da27b1ea91..9c9021e8cc 100644 --- a/tests/expectations/compiler/compiler/function/multiple_returns_main.leo.out +++ b/tests/expectations/compiler/compiler/function/multiple_returns_main.leo.out @@ -19,6 +19,6 @@ outputs: r1: type: bool value: "true" - initial_ast: 5a3189a6167d84e140e6e8d2dbfcbb35de5b02927733de0c1143ede46f2fbcf2 - canonicalized_ast: 5a3189a6167d84e140e6e8d2dbfcbb35de5b02927733de0c1143ede46f2fbcf2 - type_inferenced_ast: 7bc19e1d45f6cd7d88edb80aa02c5d92021d0cfc6473d9404f513bda95b30b6b + initial_ast: ba47abf40aa1a020c02c89341ce5ef7e5e6f0fc4fe8d915c22f0dc1bb8b74087 + canonicalized_ast: ba47abf40aa1a020c02c89341ce5ef7e5e6f0fc4fe8d915c22f0dc1bb8b74087 + type_inferenced_ast: a385d28baf03fe2580535e63d2fce42657a43a6057f9ff47e8b1c1425de96452 diff --git a/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out b/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out index 3f2ac74f18..2cf4230e93 100644 --- a/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out +++ b/tests/expectations/compiler/compiler/global_consts/global_const_types.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "false" - initial_ast: 8b9ad0b83a216048ab6179c6e223f68290059bab1deb72771f72a672ea7a0bf9 - canonicalized_ast: acdf383c635404bccf9612be9c14c96e400496fb231cf3062bce9aa269331c0f - type_inferenced_ast: ab3b8dc3ddfba1affaacf2bc344c658d5b82419544da136e42c810a3f99f3832 + initial_ast: 5bd6dae2912e7905dd03c40fce64b09c1de66ce1d5c555e96fad0a3e3af0630f + canonicalized_ast: 49ed4dc186c5d21f0d174d7256587b545193ec541d0d87e5f9cbacedbed03245 + type_inferenced_ast: 063cb49f47e467cef48e38e8fe16d10f917bdf6d55a0adee26a955d69a67c18a diff --git a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out index 1eeff43f07..eca3cce173 100644 --- a/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out +++ b/tests/expectations/compiler/compiler/import_dependency/tests/import_dependency_folder.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: d6273a716c2546b210eeefb640b5c34830fb2b2a4195ae0b636843e855fcbc1e - canonicalized_ast: 41a3c4ffe7c243ffc76bc7d3c147f77f71119d64e632581a20eb1cd576752ac3 - type_inferenced_ast: 196e5191c3d8c8cc552b419422b3e1411fa576336f63ae9d5c340bf2a7d62942 + initial_ast: 8c00ae2b8a4f80635ec9277599592828009931229216fb74e49423175a46ebd4 + canonicalized_ast: 99805c27122348834d2a550baccc61771a2234542e4fdd861fc1bf94403e5bc5 + type_inferenced_ast: e5680b8864a5c8edb6c0ea314ca8cfe2e56eaaabfee94fb09702e3b4f538bc24 diff --git a/tests/expectations/compiler/compiler/import_local/import_all.leo.out b/tests/expectations/compiler/compiler/import_local/import_all.leo.out index af0f7a88be..1420722b1c 100644 --- a/tests/expectations/compiler/compiler/import_local/import_all.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_all.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 - canonicalized_ast: 1a78fdc95fad861e53d1b0463228701df726fa0bf5092bd94d1d35f57c8c2a94 - type_inferenced_ast: be1c8166ce3ae7f805d8600441996328ce8f45ada3c16c4284f07d07af52ef75 + initial_ast: f1a1c5fb3d3a5d23c30b3eb7f47aeb1211dbcf6f77a3b1ca262b7c231f4488ef + canonicalized_ast: f1a1c5fb3d3a5d23c30b3eb7f47aeb1211dbcf6f77a3b1ca262b7c231f4488ef + type_inferenced_ast: f5189d9b934533ed5225063ffe1adb59508c53e3951a74c03d6c27d41fc7621a diff --git a/tests/expectations/compiler/compiler/import_local/import_as.leo.out b/tests/expectations/compiler/compiler/import_local/import_as.leo.out index bc897c1c3f..349b1d7033 100644 --- a/tests/expectations/compiler/compiler/import_local/import_as.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_as.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 47ef8cd0b57a42612bc9138c6da6e05fbca27c47464acf5af569c2fe0c91dd31 - canonicalized_ast: 39c0b27ba63cc34eed735900912e154031ca1f291aade9d9964ce49e77eeb19e - type_inferenced_ast: 19bfc761f899b48a3e0c4142bac6cbdaceac8230e92422cf9f6a99d9f7eddc6f + initial_ast: 9b093fc03bf985f26e5e57c0b6508bb515535c79a951c9838a5320ba4a702ed8 + canonicalized_ast: d34e1c3c2bbae1f2103e1b5d4058c607dc78af8f62a254947abb991ec6254eeb + type_inferenced_ast: a76a3eef4ef99bcb1ba050e9d3083106082608e838ea94e0ddbb943583c81483 diff --git a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out index ebbd5184aa..34544231d0 100644 --- a/tests/expectations/compiler/compiler/import_local/import_dir.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_dir.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7e0ba7b09b3840a5d4fc9f0d413163ba2de8f207c3818f604f9a71297aac30f3 - canonicalized_ast: 3f7efb61847fd75fed58b70526da8ceffb573a0806521fb30443f341c3d14a45 - type_inferenced_ast: a1baf614c8ab13c1ff978faf8022f90eef4c482261928cb3256ab4d63e20096c + initial_ast: 2b6234a13e1b49f7ac587ea697e113b600bdf8e05437ce0352264234688b00ee + canonicalized_ast: ed79e2c766f81e1d60b6a9a25b59313d8dd3e93cf9dbd7b9cf2ffc7336ecb3ac + type_inferenced_ast: daf4bdd6a544c2f3da08cd7ab67c40688cb52f0eec2c13fa70fa827f42722674 diff --git a/tests/expectations/compiler/compiler/import_local/import_files.leo.out b/tests/expectations/compiler/compiler/import_local/import_files.leo.out index aaaee96823..2bb28eef96 100644 --- a/tests/expectations/compiler/compiler/import_local/import_files.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_files.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 042e056c86e545ce256459a0de20d44c0bae24ff406becba4330e3208c48e180 - canonicalized_ast: 6cab1ab863f40c96d5d6921e2ced0dd00ebe5e9e334d84508af708be19ae8f59 - type_inferenced_ast: 17ff3e62f1c48edfbfb1c35ed4ac542260b59153d85afeca2e707dde217dc675 + initial_ast: 17d120d595b3bd1276d4566a0bef48a90e0d545556d54b83da89d88b17342a1d + canonicalized_ast: 0f9e739ef57e1d870b2c5410f821d14194dd882e315720f207f83933f5c85fda + type_inferenced_ast: 1ecf52246630058f5b4294b015b787ca175c3189660c5f3135d6456fc011a2b5 diff --git a/tests/expectations/compiler/compiler/import_local/import_many.leo.out b/tests/expectations/compiler/compiler/import_local/import_many.leo.out index b379ba5f2e..e9356a68bc 100644 --- a/tests/expectations/compiler/compiler/import_local/import_many.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_many.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 - canonicalized_ast: ad1dd786c43b4d3de69b6e162bed3f01a0a53f0643e6fd2d95f12c98dfa16855 - type_inferenced_ast: 1c983cf518cfafbe158ee3e42aed5cb190863b09aedfc4dd34e0268160ee79e2 + initial_ast: b8decf097c42e00f24432d5d72b4c4c53f404089b913330e972f81494b4c4bfb + canonicalized_ast: b8decf097c42e00f24432d5d72b4c4c53f404089b913330e972f81494b4c4bfb + type_inferenced_ast: ebba4df8a81de92d3bf06d07ab611429653b570e1620405d246f3de5921055e0 diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out index 22e000786a..e1b5244d5b 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 - canonicalized_ast: 6a099d784f82bb8065c8efdd2b4018089d968a7f57cbab3406df3ec5d0612410 - type_inferenced_ast: 58541200a815edfee41333b9b2b048add269d0924ca17457ecf9fbcbb5032ccf + initial_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c + canonicalized_ast: 2e52456f9df93f41894195cca7658fc90b2fd91b08b356105a96394ca586c06c + type_inferenced_ast: 86ef8ab226a58f140de1fcdadc31eb86e4a1930cabf36a8d9a4607233ea6ab80 diff --git a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out index e34d9e527a..fdc2a30cc5 100644 --- a/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out +++ b/tests/expectations/compiler/compiler/import_local/import_weird_names_nested.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 - canonicalized_ast: 98debe360fb6fbede5a9db625cbc2e4e4dfddcb23f40e3914e909157334e1d70 - type_inferenced_ast: 50c06c3666a830c7f1fd533c412a4e8054fdb494845f4f5d85414b08f1c1a8dd + initial_ast: 9cd9cca5cd79f5db65ebcc4d90cd9c4aedf2310972eb3146b0057352f1164e48 + canonicalized_ast: 9cd9cca5cd79f5db65ebcc4d90cd9c4aedf2310972eb3146b0057352f1164e48 + type_inferenced_ast: dd2d745566c22b0a07d4340563cccf84492707955ac04f910c3a4edfedcbfcef diff --git a/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/basic.leo.out b/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/basic.leo.out index 31fec7b550..481518aae6 100644 --- a/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/basic.leo.out +++ b/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/basic.leo.out @@ -16,6 +16,6 @@ outputs: b: type: bool value: "true" - initial_ast: 1c5370b54401931103a9aee59aadbc05dd747e758a20dcf9665ba181777d76d5 - canonicalized_ast: 1c5370b54401931103a9aee59aadbc05dd747e758a20dcf9665ba181777d76d5 - type_inferenced_ast: 04a1f100613ccf2f49733ecc76c83058d78c14c03fc4817df117eaa9a8296c66 + initial_ast: 7bca73fcc59e8e6d650c4a373b5d5ff213313921747ac90a4bfc2991d6fc64e1 + canonicalized_ast: 7bca73fcc59e8e6d650c4a373b5d5ff213313921747ac90a4bfc2991d6fc64e1 + type_inferenced_ast: ce2f3b04378b21d025bbeb2e068c5213c10649f4b9424108c4b644df3a40628b diff --git a/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/token_withdraw.leo.out b/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/token_withdraw.leo.out index 9996d2ff80..82775a3a52 100644 --- a/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/token_withdraw.leo.out +++ b/tests/expectations/compiler/compiler/input_files/program_input_and_program_state/token_withdraw.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 1ef884c7c1e9e5a806bc5dce27cd68f33b3cddf5c1ebf930a292fd6adb5762ce - canonicalized_ast: 1ef884c7c1e9e5a806bc5dce27cd68f33b3cddf5c1ebf930a292fd6adb5762ce - type_inferenced_ast: aeedb43de348c034bee08c8df80d0fb2e8f9e7f11989e57cfa4fb8bbf876eb83 + initial_ast: e3ed0c2d5a80c3204622b6eab8ba40478c7d368c7f0d438bc368d3960352c481 + canonicalized_ast: e3ed0c2d5a80c3204622b6eab8ba40478c7d368c7f0d438bc368d3960352c481 + type_inferenced_ast: 3484caa99ad87d5d0f7e78aa796ee852b5ac151d197f6d6eddd83a10c0124f12 diff --git a/tests/expectations/compiler/compiler/input_files/program_state/access_all.leo.out b/tests/expectations/compiler/compiler/input_files/program_state/access_all.leo.out index b77180760f..ca2c8d4683 100644 --- a/tests/expectations/compiler/compiler/input_files/program_state/access_all.leo.out +++ b/tests/expectations/compiler/compiler/input_files/program_state/access_all.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 6f08333f0f602b1ef25d548da7f5f5a611a4409281e3412fe380c367a76bac24 - canonicalized_ast: 6f08333f0f602b1ef25d548da7f5f5a611a4409281e3412fe380c367a76bac24 - type_inferenced_ast: 3a05ae6705cfc5a344631563ed43c3caf73c1762bef0b4a4165ae73e1466e27f + initial_ast: 396f04c5dd0931574b1b0ae902b34e4ef8b3726fd416408817880c5682248ff1 + canonicalized_ast: 396f04c5dd0931574b1b0ae902b34e4ef8b3726fd416408817880c5682248ff1 + type_inferenced_ast: 558a38b4db2ccd6aebe783126779507ab1d15a2ab1dbc2cab059781eac3c1406 diff --git a/tests/expectations/compiler/compiler/input_files/program_state/access_state.leo.out b/tests/expectations/compiler/compiler/input_files/program_state/access_state.leo.out index b8140088f6..272e755571 100644 --- a/tests/expectations/compiler/compiler/input_files/program_state/access_state.leo.out +++ b/tests/expectations/compiler/compiler/input_files/program_state/access_state.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 0eabec3e7bd9d1b1ca1666329f7bd3ad9d3095d209c94f83a19b60e78857375f - canonicalized_ast: 0eabec3e7bd9d1b1ca1666329f7bd3ad9d3095d209c94f83a19b60e78857375f - type_inferenced_ast: c6fb6168c1089361909edf6d76a9d3cba97a2f907821eb7f71198f1fb6bb1310 + initial_ast: c548108297c45d7200d2ac2ba63508cf054c7155276cdf36edfd253b3e08760b + canonicalized_ast: c548108297c45d7200d2ac2ba63508cf054c7155276cdf36edfd253b3e08760b + type_inferenced_ast: b9175a900de11b17c46fd577284edcbea0edcf3623cb4aa2c6a0dbddc7aa0a62 diff --git a/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out b/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out index 154b3ce4df..950b98b0a0 100644 --- a/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out +++ b/tests/expectations/compiler/compiler/mutability/circuit_function_mut.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 8db095ba3755c4c0a5c661f82acea4d5088fcc7a1f21445d8f6a76aa349be14c - canonicalized_ast: db2825ad023eb01f420686f407d0411e99d06be1f13116ffce5b18d7e9ceffd6 - type_inferenced_ast: 2afc66cedc72641dbae33927247993fa9b03402889e3a71005888d0e26f34114 + initial_ast: 5a240aa18f18fa86a93f9afe164fa57be60e02d0c17c53c7c85acde1f8f1521b + canonicalized_ast: 2730cf8fd4d2dfeebe7fa59513b3771036ba4592ebf49b2bb79184d61a94b816 + type_inferenced_ast: 698f855d2dec5e71dfe6eafb71feeaf7310ae891cac97146c045e29ca7927907 diff --git a/tests/expectations/compiler/compiler/mutability/circuit_variable_mut.leo.out b/tests/expectations/compiler/compiler/mutability/circuit_variable_mut.leo.out index a780c83f31..af415cdffc 100644 --- a/tests/expectations/compiler/compiler/mutability/circuit_variable_mut.leo.out +++ b/tests/expectations/compiler/compiler/mutability/circuit_variable_mut.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: 7671936b5d58627c508151bd0a851661e929424791064674180e651e5f9d7f8b - canonicalized_ast: 7671936b5d58627c508151bd0a851661e929424791064674180e651e5f9d7f8b - type_inferenced_ast: 08ccc60dc31ebf449c8a359dca037f99b22cd971fe4c5b5606310fa0fe9cd1a9 + initial_ast: 3cd87b63238cd5c3b4a81ff70705b81520c0918f8c96981a5bdb883969e93fce + canonicalized_ast: 3cd87b63238cd5c3b4a81ff70705b81520c0918f8c96981a5bdb883969e93fce + type_inferenced_ast: 4430b0cf1e6840545eade12d3a190bdd5a7697f43c35550973ffa708b5eb8230 diff --git a/tests/expectations/compiler/compiler/statements/compound_assignment.leo.out b/tests/expectations/compiler/compiler/statements/compound_assignment.leo.out index a791a74ca9..a11e6b0812 100644 --- a/tests/expectations/compiler/compiler/statements/compound_assignment.leo.out +++ b/tests/expectations/compiler/compiler/statements/compound_assignment.leo.out @@ -16,6 +16,6 @@ outputs: r0: type: bool value: "true" - initial_ast: cac8070caf7819b61e0f1d5fc3557c76957acb69e958b6cdfc793c416f0b9fd0 - canonicalized_ast: e678afe5d42eb07b14965803f080cbda55b8c01f65ddf417367a75949223a27f - type_inferenced_ast: c100f9c558b94b2c89b78da4867e2ed5e6bc4de8ec6f3218d64c26ba9c73b428 + initial_ast: 8b2329e734f6303814a0d966ae4c6f73759ac27c4aaf0c4d4c0dce2246432c89 + canonicalized_ast: b9e26a9fb7eda254c88415dc27d78c5fe8188d2744cfe9ca1eee14884bea29b2 + type_inferenced_ast: 12452254a2646aaee22ad23816f20a1cbfa0a30b1113f566b3e868d1c9c896e4 diff --git a/tests/expectations/compiler/compiler/string/circuit.leo.out b/tests/expectations/compiler/compiler/string/circuit.leo.out index b607e80f47..efe058f195 100644 --- a/tests/expectations/compiler/compiler/string/circuit.leo.out +++ b/tests/expectations/compiler/compiler/string/circuit.leo.out @@ -16,6 +16,6 @@ outputs: out: type: "[char; 13]" value: "\"Hello, World!\"" - initial_ast: 69219c995852ced5fe06a4009c4d58a8b59cc23ed7144ab4f08d4e0d4a6c5798 - canonicalized_ast: c099eab8cd118203aa297b200be1fd331f6e20ed1f19ff87efe16d406f5a0ce0 - type_inferenced_ast: acef5428f299c6cdbd9ac4b644123cf17a379efe025656122e359abe06da7eb8 + initial_ast: d9722744752d1e520000486349f5d81a1ac504489f2e70a04e01da0a452dd0ae + canonicalized_ast: a50aea84d29aff20e79082266ba91642b2db0e0cc606c25b8862ea6cc1d041ae + type_inferenced_ast: 8a3c5b0362e97f14d48031df035d8e97c5bc46b3d77f107b149922d6c5c72ccb diff --git a/tests/expectations/parser/parser/expression/access/array_range_access.leo.out b/tests/expectations/parser/parser/expression/access/array_range_access.leo.out index 10b02e133d..347e4242ec 100644 --- a/tests/expectations/parser/parser/expression/access/array_range_access.leo.out +++ b/tests/expectations/parser/parser/expression/access/array_range_access.leo.out @@ -280,6 +280,7 @@ outputs: col_stop: 6 path: test content: "x[x.y..]" + type_: ~ right: ~ span: line_start: 1 @@ -304,6 +305,7 @@ outputs: col_stop: 8 path: test content: "x[..y.x]" + type_: ~ span: line_start: 1 line_stop: 1 @@ -326,6 +328,7 @@ outputs: col_stop: 6 path: test content: "x[x.y..y.x]" + type_: ~ right: CircuitMemberAccess: circuit: @@ -338,6 +341,7 @@ outputs: col_stop: 11 path: test content: "x[x.y..y.x]" + type_: ~ span: line_start: 1 line_stop: 1 @@ -362,6 +366,7 @@ outputs: col_stop: 6 path: test content: "x[x.y.x..y.x.y]" + type_: ~ name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" span: line_start: 1 @@ -370,6 +375,7 @@ outputs: col_stop: 8 path: test content: "x[x.y.x..y.x.y]" + type_: ~ right: CircuitMemberAccess: circuit: @@ -384,6 +390,7 @@ outputs: col_stop: 13 path: test content: "x[x.y.x..y.x.y]" + type_: ~ name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" span: line_start: 1 @@ -392,6 +399,7 @@ outputs: col_stop: 15 path: test content: "x[x.y.x..y.x.y]" + type_: ~ span: line_start: 1 line_stop: 1 diff --git a/tests/expectations/parser/parser/expression/access/circuit.leo.out b/tests/expectations/parser/parser/expression/access/circuit.leo.out index e10176179c..ea1fa03f59 100644 --- a/tests/expectations/parser/parser/expression/access/circuit.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit.leo.out @@ -13,6 +13,7 @@ outputs: col_stop: 4 path: test content: x.y + type_: ~ - CircuitMemberAccess: circuit: Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" @@ -24,6 +25,7 @@ outputs: col_stop: 4 path: test content: X.Y + type_: ~ - CircuitMemberAccess: circuit: CircuitMemberAccess: @@ -37,6 +39,7 @@ outputs: col_stop: 4 path: test content: x.y.z + type_: ~ name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" span: line_start: 1 @@ -45,6 +48,7 @@ outputs: col_stop: 6 path: test content: x.y.z + type_: ~ - Call: function: CircuitMemberAccess: @@ -58,6 +62,7 @@ outputs: col_stop: 4 path: test content: x.y() + type_: ~ arguments: [] span: line_start: 1 @@ -79,6 +84,7 @@ outputs: col_stop: 4 path: test content: x.y.0 + type_: ~ index: value: "0" span: @@ -101,6 +107,7 @@ outputs: col_stop: 4 path: test content: "x.y[1]" + type_: ~ index: Value: Implicit: diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index de785f2be6..c82dc0a4d2 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -26,6 +26,7 @@ outputs: col_stop: 5 path: test content: "-x.y" + type_: ~ op: Negate span: line_start: 1 diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out index 5c93154572..b8cf87c334 100644 --- a/tests/expectations/parser/parser/expression/unary/not.leo.out +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -26,6 +26,7 @@ outputs: col_stop: 5 path: test content: "!x.y" + type_: ~ op: Not span: line_start: 1 From 2c7a2b804df9b018378b0b71856d30d0137e6ed6 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 10:46:28 +0300 Subject: [PATCH 51/62] adds type inference stage --- .github/workflows/acl2.yml | 1 + test-framework/src/bin/tgc.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 116c19eb12..9c915bd84c 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -53,6 +53,7 @@ jobs: do cd tmp/tgc/$dir; # enter the directory ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp > result.out || errors+=("$dir"); + ./../../../acl2/tgc type-inference canonicalization_ast.json type_inferenced_ast.json type-inference-theorem.lisp || errors+=("$dir"); cd ../../.. done; diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs index 29594aba89..ff0ebb36a5 100644 --- a/test-framework/src/bin/tgc.rs +++ b/test-framework/src/bin/tgc.rs @@ -97,7 +97,7 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { .unwrap_or(PathBuf::from(path)); // Write all files into the directory. - let (initial, canonicalized, _type_inferenced) = generate_asts(cwd, text)?; + let (initial, canonicalized, type_inferenced) = generate_asts(cwd, text)?; target.push("initial_ast.json"); fs::write(target.clone(), initial)?; @@ -105,6 +105,10 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { target.push("canonicalization_ast.json"); fs::write(target.clone(), canonicalized)?; + target.pop(); + + target.push("type_inferenced_ast.json"); + fs::write(target.clone(), type_inferenced)?; } } @@ -133,7 +137,8 @@ fn handle_error(res: Result<(), Box>) { match res { Ok(_) => (), Err(err) => { - eprintln!("Error: {}", err); + // eprintln!("Error: {}", err); + panic!(); std::process::exit(1); } } From 35f56cd648591375773cfaa4803cbe7b6a5d1da1 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 11:14:13 +0300 Subject: [PATCH 52/62] more intelligent system for printing out failures --- .github/workflows/acl2.yml | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 9c915bd84c..b56a9e3268 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -48,23 +48,36 @@ jobs: # Using the prepared ASTs and the pulled and unzipped tgc run theorem generation. - name: Run tgc over ASTs run: | - errors=(); + canonicalization_errors=(); + type_inference_errors=(); for dir in `ls tmp/tgc`; do cd tmp/tgc/$dir; # enter the directory - ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp > result.out || errors+=("$dir"); - ./../../../acl2/tgc type-inference canonicalization_ast.json type_inferenced_ast.json type-inference-theorem.lisp || errors+=("$dir"); + ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp > canonicalization_result.out || canonicalization_errors+=("$dir"); + ./../../../acl2/tgc type-inference canonicalization_ast.json type_inferenced_ast.json type-inference-theorem.lisp > type_inference_result.out || type_inference_errors+=("$dir"); cd ../../.. done; - if [ ${#errors[@]} -eq 0 ]; then - echo "Success!" + if [ ${#canonicalization_errors[@]} -eq 0 ]; then + echo "Canonicalization - Success!" else - echo "Failures:"; - for i in ${errors[@]}; + echo "Canonicalization Failures:"; + for i in ${canonicalization_errors[@]}; do echo $i; - cat tmp/tgc/$dir.out + cat tmp/tgc/$dir/canonicalization_result.out + done; + exit 1 + fi + + if [ ${#type_inference_errors[@]} -eq 0 ]; then + echo "Type Inference - Success!" + else + echo "Type Inference Failures:"; + for i in ${type_inference_errors[@]}; + do + echo $i; + cat tmp/tgc/$dir/type_inference_result.out done; exit 1 fi From 060513bffa28eaca2a1337a718f486d056f05233 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 13:28:22 +0300 Subject: [PATCH 53/62] cleanup and remove panic --- .github/workflows/acl2.yml | 2 +- test-framework/src/bin/tgc.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index b56a9e3268..fe752b81df 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -30,7 +30,7 @@ jobs: - name: Generate asts run: | - cargo run -p leo-test-framework --bin tgc + cargo -q run -p leo-test-framework --bin tgc # Pull the latest release from the leo-acl2-bin repo, and put it into the # repo/acl2 directory. After it's done, unpack the tgz file locally. diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs index ff0ebb36a5..b6f677bbff 100644 --- a/test-framework/src/bin/tgc.rs +++ b/test-framework/src/bin/tgc.rs @@ -137,8 +137,7 @@ fn handle_error(res: Result<(), Box>) { match res { Ok(_) => (), Err(err) => { - // eprintln!("Error: {}", err); - panic!(); + eprintln!("Error: {}", err); std::process::exit(1); } } From 79fb41eac43018e8f814ece2b996ed4d4836fed4 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 17:03:12 +0300 Subject: [PATCH 54/62] fmt --- leo/commands/clean.rs | 4 +++- package/src/outputs/ast_snapshot.rs | 10 +++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/leo/commands/clean.rs b/leo/commands/clean.rs index 6e09bcfa43..4b1f85b67b 100644 --- a/leo/commands/clean.rs +++ b/leo/commands/clean.rs @@ -17,7 +17,9 @@ use crate::{commands::Command, context::Context}; use leo_compiler::OutputFile; use leo_errors::Result; -use leo_package::outputs::{ChecksumFile, CircuitFile, ProofFile, ProvingKeyFile, Snapshot, SnapshotFile, VerificationKeyFile}; +use leo_package::outputs::{ + ChecksumFile, CircuitFile, ProofFile, ProvingKeyFile, Snapshot, SnapshotFile, VerificationKeyFile, +}; use structopt::StructOpt; use tracing::span::Span; diff --git a/package/src/outputs/ast_snapshot.rs b/package/src/outputs/ast_snapshot.rs index 7b910e1a0d..e48a9977ec 100644 --- a/package/src/outputs/ast_snapshot.rs +++ b/package/src/outputs/ast_snapshot.rs @@ -20,12 +20,7 @@ use crate::outputs::OUTPUTS_DIRECTORY_NAME; use leo_errors::{PackageError, Result}; use serde::Deserialize; -use std::{ - borrow::Cow, - fmt, - fs, - path::Path, -}; +use std::{borrow::Cow, fmt, fs, path::Path}; /// Enum to handle all 3 types of snapshots. #[derive(Deserialize)] @@ -76,7 +71,8 @@ impl SnapshotFile { pub fn read_from(&self, path: &Path) -> Result { let path = self.snapshot_file_path(path); - let result = fs::read_to_string(&path).map_err(|_| PackageError::failed_to_read_snapshot_file(path.into_owned()))?; + let result = + fs::read_to_string(&path).map_err(|_| PackageError::failed_to_read_snapshot_file(path.into_owned()))?; Ok(result) } From cddc0d62b1aee9acfbf826f0b541f2b677f06120 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 20:10:15 +0300 Subject: [PATCH 55/62] skip access_all test --- .github/workflows/acl2.yml | 2 +- test-framework/src/bin/tgc.rs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index fe752b81df..e68e32cf31 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -30,7 +30,7 @@ jobs: - name: Generate asts run: | - cargo -q run -p leo-test-framework --bin tgc + cargo -q run -p leo-test-framework --bin tgc -- --skip access_all # Pull the latest release from the leo-acl2-bin repo, and put it into the # repo/acl2 directory. After it's done, unpack the tgz file locally. diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs index b6f677bbff..bf420ae2ce 100644 --- a/test-framework/src/bin/tgc.rs +++ b/test-framework/src/bin/tgc.rs @@ -36,8 +36,11 @@ struct Opt { )] path: PathBuf, - #[structopt(short, long, help = "Filter test names and run only matching")] + #[structopt(short, long, help = "Run only for test that match pattern")] filter: Option, + + #[structopt(short, long, help = "Skip tests matching pattern")] + skip: Option, } fn main() { @@ -76,6 +79,13 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { } } + // If skip flag is used, don't run tests matching the pattern. + if let Some(skip_name) = &opt.skip { + if test_name.contains(skip_name) { + continue; + } + } + test_name.push_str(&format!("_{}", index)); // Create directory for this file. From 529c06623bd9e0e47c1df6bc7aee1a34e97a25ce Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 20:21:59 +0300 Subject: [PATCH 56/62] fix logging, print list of failures first --- .github/workflows/acl2.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index e68e32cf31..66169b694e 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -62,9 +62,14 @@ jobs: echo "Canonicalization - Success!" else echo "Canonicalization Failures:"; - for i in ${canonicalization_errors[@]}; + for $dir in ${canonicalization_errors[@]}; + do + echo $dir; + done; + + echo "Attaching logs:" + for $dir in ${canonicalization_errors[@]}; do - echo $i; cat tmp/tgc/$dir/canonicalization_result.out done; exit 1 @@ -74,10 +79,16 @@ jobs: echo "Type Inference - Success!" else echo "Type Inference Failures:"; - for i in ${type_inference_errors[@]}; + for $dir in ${type_inference_errors[@]}; + do + echo $dir; + done; + + echo "Attaching logs:" + for $dir in ${type_inference_errors[@]}; do - echo $i; cat tmp/tgc/$dir/type_inference_result.out done; + exit 1 fi From 5453225b5d426168b4e916c120b6b7b5ed666e5f Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 20:28:43 +0300 Subject: [PATCH 57/62] fix bash variables --- .github/workflows/acl2.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 66169b694e..ecfff270ae 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -62,13 +62,13 @@ jobs: echo "Canonicalization - Success!" else echo "Canonicalization Failures:"; - for $dir in ${canonicalization_errors[@]}; + for dir in ${canonicalization_errors[@]}; do echo $dir; done; echo "Attaching logs:" - for $dir in ${canonicalization_errors[@]}; + for dir in ${canonicalization_errors[@]}; do cat tmp/tgc/$dir/canonicalization_result.out done; @@ -79,13 +79,13 @@ jobs: echo "Type Inference - Success!" else echo "Type Inference Failures:"; - for $dir in ${type_inference_errors[@]}; + for dir in ${type_inference_errors[@]}; do echo $dir; done; echo "Attaching logs:" - for $dir in ${type_inference_errors[@]}; + for dir in ${type_inference_errors[@]}; do cat tmp/tgc/$dir/type_inference_result.out done; From 9389e4f6ec6f71dd8406fb827bd8b49e2db164d2 Mon Sep 17 00:00:00 2001 From: damirka Date: Thu, 19 Aug 2021 20:50:48 +0300 Subject: [PATCH 58/62] improved directory naming and skip pattern now allows multiple --- test-framework/src/bin/tgc.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs index bf420ae2ce..b1eb48afe6 100644 --- a/test-framework/src/bin/tgc.rs +++ b/test-framework/src/bin/tgc.rs @@ -40,7 +40,7 @@ struct Opt { filter: Option, #[structopt(short, long, help = "Skip tests matching pattern")] - skip: Option, + skip: Option>, } fn main() { @@ -59,7 +59,7 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { } // Prepare directory for placing results. - for (index, (path, text)) in tests.iter().enumerate() { + 'main_loop: for (index, (path, text)) in tests.iter().enumerate() { if let Some(config) = extract_test_config(text) { // Skip namespaces that we don't need; also skip failure tests. if config.namespace != "Compile" || config.expectation == Expectation::Fail { @@ -67,10 +67,10 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { } let mut test_name = path - .split(std::path::MAIN_SEPARATOR) + .split("tests/") .last() .unwrap() - .replace(".leo", ""); + .replace(std::path::MAIN_SEPARATOR, "_"); // Filter out the tests that do not match pattern, if pattern is set. if let Some(filter) = &opt.filter { @@ -80,9 +80,12 @@ fn run_with_args(opt: Opt) -> Result<(), Box> { } // If skip flag is used, don't run tests matching the pattern. - if let Some(skip_name) = &opt.skip { - if test_name.contains(skip_name) { - continue; + if let Some(skips) = &opt.skip { + for skip_pattern in skips { + if test_name.contains(skip_pattern) { + println!("Skipping: {} because of {}", test_name, skip_pattern); + continue 'main_loop; + } } } From 05d04e2a43b6e0530d1e5567e8dd9636d5ce62f2 Mon Sep 17 00:00:00 2001 From: damirka Date: Sat, 21 Aug 2021 20:56:08 +0300 Subject: [PATCH 59/62] disable type inference checks --- .github/workflows/acl2.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index ecfff270ae..9f7b5caa82 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -54,7 +54,8 @@ jobs: do cd tmp/tgc/$dir; # enter the directory ./../../../acl2/tgc canonicalization initial_ast.json canonicalization_ast.json canonicalization-theorem.lisp > canonicalization_result.out || canonicalization_errors+=("$dir"); - ./../../../acl2/tgc type-inference canonicalization_ast.json type_inferenced_ast.json type-inference-theorem.lisp > type_inference_result.out || type_inference_errors+=("$dir"); + # Disabling Type inference for now + # ./../../../acl2/tgc type-inference canonicalization_ast.json type_inferenced_ast.json type-inference-theorem.lisp > type_inference_result.out || type_inference_errors+=("$dir"); cd ../../.. done; From 63ac4b79a309567ce7495b21010ff78a12c2a138 Mon Sep 17 00:00:00 2001 From: damirka Date: Sat, 21 Aug 2021 21:04:58 +0300 Subject: [PATCH 60/62] update implementation, follow recent changes in imports --- .github/workflows/acl2.yml | 2 +- test-framework/src/bin/tgc.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acl2.yml b/.github/workflows/acl2.yml index 9f7b5caa82..d9fc9c4af4 100644 --- a/.github/workflows/acl2.yml +++ b/.github/workflows/acl2.yml @@ -30,7 +30,7 @@ jobs: - name: Generate asts run: | - cargo -q run -p leo-test-framework --bin tgc -- --skip access_all + cargo -q run -p leo-test-framework --bin tgc # Pull the latest release from the leo-acl2-bin repo, and put it into the # repo/acl2 directory. After it's done, unpack the tgz file locally. diff --git a/test-framework/src/bin/tgc.rs b/test-framework/src/bin/tgc.rs index b1eb48afe6..fc62bcb413 100644 --- a/test-framework/src/bin/tgc.rs +++ b/test-framework/src/bin/tgc.rs @@ -136,7 +136,11 @@ fn generate_asts(path: PathBuf, text: &String) -> Result<(String, String, String ast.canonicalize()?; let canonicalized = ast.to_json_string()?; - let asg = Asg::new(thread_leaked_context(), &ast, &mut ImportParser::new(path))?; + let asg = Asg::new( + thread_leaked_context(), + &ast, + &mut ImportParser::new(path, Default::default()), + )?; let type_inferenced = TypeInferencePhase::default() .phase_ast(&ast.into_repr(), &asg.clone().into_repr()) From fd3d7d0624c786e241b270847bbeb273f888b0c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 17:25:05 +0300 Subject: [PATCH 61/62] Bump serde_yaml from 0.8.18 to 0.8.19 (#1289) Bumps [serde_yaml](https://github.com/dtolnay/serde-yaml) from 0.8.18 to 0.8.19. - [Release notes](https://github.com/dtolnay/serde-yaml/releases) - [Commits](https://github.com/dtolnay/serde-yaml/compare/0.8.18...0.8.19) --- updated-dependencies: - dependency-name: serde_yaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d76817cbf0..9b2df3cd37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2414,12 +2414,12 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039ba818c784248423789eec090aab9fb566c7b94d6ebbfa1814a9fd52c8afb2" +checksum = "6375dbd828ed6964c3748e4ef6d18e7a175d408ffe184bca01698d0c73f915a9" dependencies = [ "dtoa", - "linked-hash-map", + "indexmap", "serde", "yaml-rust", ] From 695a949cffee7b33f6a814debbb55c942d7a3c25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 17:25:19 +0300 Subject: [PATCH 62/62] Bump serde from 1.0.127 to 1.0.128 (#1288) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.127 to 1.0.128. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- errors/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9b2df3cd37..701dc9d718 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2361,9 +2361,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8" +checksum = "1056a0db1978e9dbf0f6e4fca677f6f9143dc1c19de346f22cac23e422196834" dependencies = [ "serde_derive", ] @@ -2380,9 +2380,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" +checksum = "13af2fbb8b60a8950d6c72a56d2095c28870367cc8e10c55e9745bac4995a2c4" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", diff --git a/errors/Cargo.toml b/errors/Cargo.toml index 362716882b..79da65dc14 100644 --- a/errors/Cargo.toml +++ b/errors/Cargo.toml @@ -41,7 +41,7 @@ version = "0.3.61" version = "2.0" [dependencies.serde] -version = "1.0.126" +version = "1.0.128" features = [ "derive", "rc" ] [dependencies.tendril]