From ab033ff857b1c16d421795a32f5cd887f0e18aff Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 12 Apr 2021 15:59:23 +0300 Subject: [PATCH 01/30] updates login procedure - locally stored token is now verified on leo login and removed if expired - we allow re-login when credentials or token are passed (did not before) - we now store username alongside jwt --- leo/api.rs | 20 ++++++++-- leo/commands/package/login.rs | 68 ++++++++++++++++++++-------------- leo/commands/package/logout.rs | 4 +- leo/config.rs | 22 ++++++++++- 4 files changed, 78 insertions(+), 36 deletions(-) diff --git a/leo/api.rs b/leo/api.rs index 23e12b3578..311c1da53b 100644 --- a/leo/api.rs +++ b/leo/api.rs @@ -20,7 +20,7 @@ use reqwest::{ Method, StatusCode, }; -use serde::Serialize; +use serde::{Deserialize, Serialize}; /// Trait describes API Routes and Request bodies, struct which implements /// Route MUST also support Serialize to be usable in Api::run_route(r: Route) @@ -184,12 +184,18 @@ impl Route for Login { /// Handler for 'my_profile' route. Meant to be used to get profile details but /// in current application is used to check if user is logged in. Any non-200 response -/// is treated as Unauthorized +/// is treated as Unauthorized. #[derive(Serialize)] pub struct Profile {} +#[derive(Deserialize)] +pub struct ProfileResponse { + username: String, +} + impl Route for Profile { - type Output = bool; + // Some with Username is success, None is failure. + type Output = Option; const AUTH: bool = true; const METHOD: Method = Method::GET; @@ -197,6 +203,12 @@ impl Route for Profile { fn process(&self, res: Response) -> Result { // this may be extended for more precise error handling - Ok(res.status() == 200) + let status = res.status(); + if status == StatusCode::OK { + let body: ProfileResponse = res.json()?; + return Ok(Some(body.username)); + } + + Ok(None) } } diff --git a/leo/commands/package/login.rs b/leo/commands/package/login.rs index 495f52b6e5..960b7727fc 100644 --- a/leo/commands/package/login.rs +++ b/leo/commands/package/login.rs @@ -59,34 +59,15 @@ impl Command for Login { } fn apply(self, context: Context, _: Self::Input) -> Result { - // quick hack to check if user is already logged in. ;) - if context.api.auth_token().is_some() { - tracing::info!("You are already logged in"); - return Ok(context.api.auth_token().unwrap()); - }; - - let mut api = context.api; + let mut api = context.clone().api; // ...or trying to use arguments to either get token or user-pass - let token = match (self.token, self.user, self.pass) { - // Login using existing token, use get_profile route for that - (Some(token), _, _) => { - tracing::info!("Token passed, checking..."); - - api.set_auth_token(token.clone()); - - let is_ok = api.run_route(ProfileRoute {})?; - if !is_ok { - return Err(anyhow!("Supplied token is incorrect")); - }; - - token - } - - // Login using username and password + let (token, username) = match (self.token, self.user, self.pass) { + // Login using username and password if they were passed. Even if token already + // exists login procedure will be done first (we need that for expired credentials). (None, Some(email_username), Some(password)) => { let login = LoginRoute { - email_username, + email_username: email_username.clone(), password, }; @@ -98,17 +79,48 @@ impl Command for Login { return Err(anyhow!("Unable to get token")); }; - tok_opt.unwrap() + (tok_opt.unwrap(), email_username) + } + + // Login with token, use get_profile route to verify that. + (Some(token), _, _) => { + tracing::info!("Token passed, checking..."); + + api.set_auth_token(token.clone()); + + match api.run_route(ProfileRoute {})? { + Some(username) => (token, username), + None => return Err(anyhow!("Supplied token is incorrect")), + } } // In case token or login/pass were not passed as arguments - (_, _, _) => return Err(anyhow!("No credentials provided")), + (_, _, _) => { + // Check locally stored token if there is. + let token = context.api.auth_token(); + + match token { + Some(token) => { + tracing::info!("Found locally stored credentials, verifying..."); + + if let Some(username) = api.run_route(ProfileRoute {})? { + (token, username) + } else { + remove_token_and_username()?; + return Err(anyhow!( + "Stored credentials are incorrect or expired, please login again" + )); + } + } + None => return Err(anyhow!("No credentials provided")), + } + } }; // write token either after logging or if it was passed - write_token(token.as_str())?; + write_token_and_username(token.as_str(), username.as_str())?; - tracing::info!("Success! You are now logged in!"); + tracing::info!("Success! You are logged in!"); Ok(token) } diff --git a/leo/commands/package/logout.rs b/leo/commands/package/logout.rs index c6018854ef..a18e29351b 100644 --- a/leo/commands/package/logout.rs +++ b/leo/commands/package/logout.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, config::remove_token, context::Context}; +use crate::{commands::Command, config::remove_token_and_username, context::Context}; use anyhow::Result; use std::io::ErrorKind; @@ -41,7 +41,7 @@ impl Command for Logout { fn apply(self, _context: Context, _: Self::Input) -> Result { // the only error we're interested here is NotFound // however err in this case can also be of kind PermissionDenied or other - if let Err(err) = remove_token() { + if let Err(err) = remove_token_and_username() { match err.kind() { ErrorKind::NotFound => { tracing::info!("you are not logged in"); diff --git a/leo/config.rs b/leo/config.rs index 11de847b70..ae85bc3d2c 100644 --- a/leo/config.rs +++ b/leo/config.rs @@ -32,6 +32,7 @@ use serde::{Deserialize, Serialize}; pub const LEO_CREDENTIALS_FILE: &str = "credentials"; pub const LEO_CONFIG_FILE: &str = "config.toml"; +pub const LEO_USERNAME_FILE: &str = "username"; lazy_static! { pub static ref LEO_CONFIG_DIRECTORY: PathBuf = { @@ -44,6 +45,11 @@ lazy_static! { path.push(LEO_CREDENTIALS_FILE); path }; + pub static ref LEO_USERNAME_PATH: PathBuf = { + let mut path = LEO_CONFIG_DIRECTORY.to_path_buf(); + path.push(LEO_USERNAME_FILE); + path + }; pub static ref LEO_CONFIG_PATH: PathBuf = { let mut path = LEO_CONFIG_DIRECTORY.to_path_buf(); path.push(LEO_CONFIG_FILE); @@ -129,7 +135,7 @@ impl Config { } } -pub fn write_token(token: &str) -> Result<(), io::Error> { +pub fn write_token_and_username(token: &str, username: &str) -> Result<(), io::Error> { let config_dir = LEO_CONFIG_DIRECTORY.clone(); // Create Leo config directory if it not exists @@ -139,6 +145,10 @@ pub fn write_token(token: &str) -> Result<(), io::Error> { let mut credentials = File::create(&LEO_CREDENTIALS_PATH.to_path_buf())?; credentials.write_all(&token.as_bytes())?; + + let mut username_file = File::create(&LEO_USERNAME_PATH.to_path_buf())?; + username_file.write_all(&username.as_bytes())?; + Ok(()) } @@ -149,7 +159,15 @@ pub fn read_token() -> Result { Ok(buf) } -pub fn remove_token() -> Result<(), io::Error> { +pub fn read_username() -> Result { + let mut username = File::open(&LEO_USERNAME_PATH.to_path_buf())?; + let mut buf = String::new(); + username.read_to_string(&mut buf)?; + Ok(buf) +} + +pub fn remove_token_and_username() -> Result<(), io::Error> { fs::remove_file(&LEO_CREDENTIALS_PATH.to_path_buf())?; + fs::remove_file(&LEO_USERNAME_PATH.to_path_buf())?; Ok(()) } From f3c97390ee5c198a53bd67e50836045b44c6fbfb Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 12 Apr 2021 16:54:37 +0300 Subject: [PATCH 02/30] adds name substitution on leo new and init - only adds a name if user is already logged in - if not, puts [AUTHOR] as it was previously - before publishing author field is checked in Leo.toml and better error message returned --- .circleci/leo-login-logout.sh | 7 +++- .circleci/leo-new.sh | 5 +++ leo/commands/init.rs | 14 ++++---- leo/commands/new.rs | 6 ++-- leo/commands/package/publish.rs | 17 ++++++++-- package/src/lib.rs | 9 ++++-- package/src/package.rs | 9 ++++-- package/src/root/manifest.rs | 15 ++++++--- package/tests/initialize/initialize.rs | 44 ++++++++++++++++++++++---- 9 files changed, 99 insertions(+), 27 deletions(-) diff --git a/.circleci/leo-login-logout.sh b/.circleci/leo-login-logout.sh index 1353b18d72..4fd69df050 100755 --- a/.circleci/leo-login-logout.sh +++ b/.circleci/leo-login-logout.sh @@ -1,7 +1,12 @@ # leo login & logout -$LEO new my-app && cd my-app || exit 1 $LEO login -u "$ALEO_PM_USERNAME" -p "$ALEO_PM_PASSWORD" +$LEO new my-app && cd my-app || exit 1 + +# verify that in Leo.toml there's a line with $ALEO_PM_USERNAME; +# because at the time of calling `leo new` user is logged in and we're expecting substitution +[[ $(cat Leo.toml | grep "\[$ALEO_PM_USERNAME\]" | wc -l) -eq 1 ]] || exit 1 + $LEO add howard/silly-sudoku $LEO remove silly-sudoku $LEO logout diff --git a/.circleci/leo-new.sh b/.circleci/leo-new.sh index cb24618546..6f90b785dd 100755 --- a/.circleci/leo-new.sh +++ b/.circleci/leo-new.sh @@ -1,4 +1,9 @@ $LEO new hello-world ls -la cd hello-world && ls -la + +# verify that in Leo.toml there's a placeholder for author +# because at the time of calling `leo new` user is not logged in +[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 1 ]] || exit 1 + $LEO run diff --git a/leo/commands/init.rs b/leo/commands/init.rs index a4d07a9137..98b63a755c 100644 --- a/leo/commands/init.rs +++ b/leo/commands/init.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::{commands::Command, config::*, context::Context}; use leo_package::LeoPackage; use anyhow::{anyhow, Result}; @@ -43,6 +43,11 @@ impl Command for Init { // Derive the package directory path. let path = current_dir()?; + // Check that the current package directory path exists. + if !path.exists() { + return Err(anyhow!("Directory does not exist")); + } + // Check that the given package name is valid. let package_name = path .file_stem() @@ -53,12 +58,9 @@ impl Command for Init { return Err(anyhow!("Invalid Leo project name")); } - // Check that the current package directory path exists. - if !path.exists() { - return Err(anyhow!("Directory does not exist")); - } + let username = read_username().ok(); - LeoPackage::initialize(&package_name, false, &path)?; + LeoPackage::initialize(&package_name, false, &path, username)?; Ok(()) } diff --git a/leo/commands/new.rs b/leo/commands/new.rs index c77448cfc4..df9a92e376 100644 --- a/leo/commands/new.rs +++ b/leo/commands/new.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{commands::Command, context::Context}; +use crate::{commands::Command, config::*, context::Context}; use leo_package::LeoPackage; use anyhow::{anyhow, Result}; @@ -49,6 +49,8 @@ impl Command for New { return Err(anyhow!("Invalid Leo project name")); } + let username = read_username().ok(); + // Derive the package directory path. let mut path = current_dir()?; path.push(&package_name); @@ -61,7 +63,7 @@ impl Command for New { // Create the package directory fs::create_dir_all(&path).map_err(|err| anyhow!("Could not create directory {}", err))?; - LeoPackage::initialize(&package_name, false, &path)?; + LeoPackage::initialize(&package_name, false, &path, username)?; Ok(()) } diff --git a/leo/commands/package/publish.rs b/leo/commands/package/publish.rs index 088949600b..acfe69912f 100644 --- a/leo/commands/package/publish.rs +++ b/leo/commands/package/publish.rs @@ -19,7 +19,10 @@ use crate::{ commands::Command, context::{Context, PACKAGE_MANAGER_URL}, }; -use leo_package::{outputs::OutputsDirectory, root::ZipFile}; +use leo_package::{ + outputs::OutputsDirectory, + root::{ZipFile, AUTHOR_PLACEHOLDER}, +}; use anyhow::{anyhow, Result}; use reqwest::{ @@ -70,11 +73,19 @@ impl Command for Publish { }; let package_remote = manifest.get_package_remote().unwrap(); + let username = package_remote.clone().author; - // Create the output directory + // Prevent most common error before accessing API. + if username == AUTHOR_PLACEHOLDER { + return Err(anyhow!( + "Package author is not set. Specify package author in [remote] section of Leo.toml" + )); + } + + // Create the output directory. OutputsDirectory::create(&path)?; - // Create zip file + // Create zip file. let zip_file = ZipFile::new(&package_name); if zip_file.exists_at(&path) { tracing::debug!("Existing package zip file found. Clearing it to regenerate."); diff --git a/package/src/lib.rs b/package/src/lib.rs index eb7cf4bb00..8006282739 100644 --- a/package/src/lib.rs +++ b/package/src/lib.rs @@ -33,8 +33,13 @@ pub struct LeoPackage; impl LeoPackage { /// Initializes a Leo package at the given path. - pub fn initialize(package_name: &str, is_lib: bool, path: &Path) -> Result<(), PackageError> { - package::Package::initialize(package_name, is_lib, path) + pub fn initialize( + package_name: &str, + is_lib: bool, + path: &Path, + author: Option, + ) -> Result<(), PackageError> { + package::Package::initialize(package_name, is_lib, path, author) } /// Returns `true` if the given Leo package name is valid. diff --git a/package/src/package.rs b/package/src/package.rs index 4ae9e2e92d..cf09d3509c 100644 --- a/package/src/package.rs +++ b/package/src/package.rs @@ -197,7 +197,12 @@ impl Package { } /// Creates a package at the given path - pub fn initialize(package_name: &str, is_lib: bool, path: &Path) -> Result<(), PackageError> { + pub fn initialize( + package_name: &str, + is_lib: bool, + path: &Path, + author: Option, + ) -> Result<(), PackageError> { // First, verify that this directory is not already initialized as a Leo package. { if !Self::can_initialize(package_name, is_lib, path) { @@ -210,7 +215,7 @@ impl Package { // Next, initialize this directory as a Leo package. { // Create the manifest file. - Manifest::new(&package_name)?.write_to(&path)?; + Manifest::new(&package_name, author)?.write_to(&path)?; // Verify that the .gitignore file does not exist. if !Gitignore::exists_at(&path) { diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 540749fcdc..4ec11007fd 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -26,6 +26,7 @@ use std::{ }; pub const MANIFEST_FILENAME: &str = "Leo.toml"; +pub const AUTHOR_PLACEHOLDER: &str = "[AUTHOR]"; #[derive(Clone, Deserialize)] pub struct Remote { @@ -39,10 +40,10 @@ pub struct Manifest { } impl Manifest { - pub fn new(package_name: &str) -> Result { + pub fn new(package_name: &str, author: Option) -> Result { Ok(Self { project: Package::new(package_name)?, - remote: None, + remote: author.map(|author| Remote { author }), }) } @@ -90,6 +91,11 @@ impl Manifest { } fn template(&self) -> String { + let author = self + .remote + .clone() + .map_or(AUTHOR_PLACEHOLDER.to_string(), |remote| remote.author); + format!( r#"[project] name = "{name}" @@ -98,9 +104,10 @@ description = "The {name} package" license = "MIT" [remote] -author = "[AUTHOR]" # Add your Aleo Package Manager username, team's name, or organization's name. +author = "{author}" # Add your Aleo Package Manager username, team's name, or organization's name. "#, - name = self.project.name + name = self.project.name, + author = author ) } } diff --git a/package/tests/initialize/initialize.rs b/package/tests/initialize/initialize.rs index 5e1b98bde8..67bd922ef7 100644 --- a/package/tests/initialize/initialize.rs +++ b/package/tests/initialize/initialize.rs @@ -32,7 +32,29 @@ fn initialize_valid_package() { assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); // Initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_ok()); + assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_ok()); + + // Ensure a package is initialized at the `test_directory` + assert!(Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); +} + +#[test] +fn initialize_valid_package_with_author() { + let test_directory = test_dir(); + + // Ensure a package can be initialized at the `test_directory` + assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); + + // Initialize a package at the `test_directory` + assert!( + Package::initialize( + TEST_PACKAGE_NAME, + false, + &test_directory, + Some(String::from("test_user")) + ) + .is_ok() + ); // Ensure a package is initialized at the `test_directory` assert!(Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); @@ -52,13 +74,13 @@ fn initialize_fails_with_existing_manifest() { assert!(Package::can_initialize(TEST_PACKAGE_NAME, false, &test_directory)); // Manually add a manifest file to the `test_directory` - Manifest::new(TEST_PACKAGE_NAME) + Manifest::new(TEST_PACKAGE_NAME, None) .unwrap() .write_to(&test_directory) .unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_err()); // Ensure package is not initialized at the `test_directory` assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); @@ -76,7 +98,7 @@ fn initialize_fails_with_existing_library_file() { LibraryFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, true, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, true, &test_directory, None).is_err()); // Ensure package is not initialized at the `test_directory` assert!(!Package::is_initialized(TEST_PACKAGE_NAME, true, &test_directory)); @@ -94,7 +116,15 @@ fn initialize_fails_with_existing_input_file() { InputFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!( + Package::initialize( + TEST_PACKAGE_NAME, + false, + &test_directory, + Some(String::from("test_user")) + ) + .is_err() + ); // Ensure package is not initialized at the `test_directory` assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); @@ -112,7 +142,7 @@ fn initialize_fails_with_existing_state_file() { StateFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_err()); // Ensure package is not initialized at the `test_directory` assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); @@ -130,7 +160,7 @@ fn initialize_fails_with_existing_main_file() { MainFile::new(TEST_PACKAGE_NAME).write_to(&test_directory).unwrap(); // Attempt to initialize a package at the `test_directory` - assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory).is_err()); + assert!(Package::initialize(TEST_PACKAGE_NAME, false, &test_directory, None).is_err()); // Ensure package is not initialized at the `test_directory` assert!(!Package::is_initialized(TEST_PACKAGE_NAME, false, &test_directory)); From 9104ed4f912cf2ab783b518f9997f564757b194c Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 12 Apr 2021 17:12:07 +0300 Subject: [PATCH 03/30] debug .ci --- .circleci/leo-login-logout.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/leo-login-logout.sh b/.circleci/leo-login-logout.sh index 4fd69df050..c160c5f658 100755 --- a/.circleci/leo-login-logout.sh +++ b/.circleci/leo-login-logout.sh @@ -3,6 +3,9 @@ $LEO login -u "$ALEO_PM_USERNAME" -p "$ALEO_PM_PASSWORD" $LEO new my-app && cd my-app || exit 1 +cat Leo.toml +which wc + # verify that in Leo.toml there's a line with $ALEO_PM_USERNAME; # because at the time of calling `leo new` user is logged in and we're expecting substitution [[ $(cat Leo.toml | grep "\[$ALEO_PM_USERNAME\]" | wc -l) -eq 1 ]] || exit 1 From fee71becadb11bee7cc6f1375771df8434baa2a3 Mon Sep 17 00:00:00 2001 From: damirka Date: Mon, 12 Apr 2021 17:21:13 +0300 Subject: [PATCH 04/30] fixes ci not showing credentials --- .circleci/leo-login-logout.sh | 8 ++++---- .circleci/r | 0 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 .circleci/r diff --git a/.circleci/leo-login-logout.sh b/.circleci/leo-login-logout.sh index c160c5f658..c1fe2d067d 100755 --- a/.circleci/leo-login-logout.sh +++ b/.circleci/leo-login-logout.sh @@ -4,11 +4,11 @@ $LEO login -u "$ALEO_PM_USERNAME" -p "$ALEO_PM_PASSWORD" $LEO new my-app && cd my-app || exit 1 cat Leo.toml -which wc -# verify that in Leo.toml there's a line with $ALEO_PM_USERNAME; -# because at the time of calling `leo new` user is logged in and we're expecting substitution -[[ $(cat Leo.toml | grep "\[$ALEO_PM_USERNAME\]" | wc -l) -eq 1 ]] || exit 1 +# verify that in Leo.toml there's no line with [AUTHOR]; +# since CI does not allow showing credentials, we won't see it in the file; +# so the only way to test is to make sure that there's just no [AUTHOR] there +[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 0 ]] || exit 1 $LEO add howard/silly-sudoku $LEO remove silly-sudoku diff --git a/.circleci/r b/.circleci/r new file mode 100644 index 0000000000..e69de29bb2 From ccd7a197caddd8d8b8dcbc0698c6aa090f51d29d Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 14 Apr 2021 18:01:14 +0300 Subject: [PATCH 05/30] changed context-specific to specific in loops --- asg/src/statement/iteration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asg/src/statement/iteration.rs b/asg/src/statement/iteration.rs index e6d97ca0a2..5e080acc75 100644 --- a/asg/src/statement/iteration.rs +++ b/asg/src/statement/iteration.rs @@ -54,7 +54,7 @@ impl<'a> FromAst<'a, leo_ast::IterationStatement> for &'a Statement<'a> { statement: &leo_ast::IterationStatement, _expected_type: Option>, ) -> Result { - let expected_index_type = Some(PartialType::Integer(None, Some(IntegerType::U32))); + let expected_index_type = Some(PartialType::Integer(Some(IntegerType::U32), None)); let start = <&Expression<'a>>::from_ast(scope, &statement.start, expected_index_type.clone())?; let stop = <&Expression<'a>>::from_ast(scope, &statement.stop, expected_index_type)?; From 794e0f10952e7d7a8a828ab3ed0701d7e523c1d2 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 14 Apr 2021 18:09:52 +0300 Subject: [PATCH 06/30] adds test for that scenario --- compiler/tests/statements/iteration_type_fail.leo | 9 +++++++++ compiler/tests/statements/mod.rs | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 compiler/tests/statements/iteration_type_fail.leo diff --git a/compiler/tests/statements/iteration_type_fail.leo b/compiler/tests/statements/iteration_type_fail.leo new file mode 100644 index 0000000000..644253a8b9 --- /dev/null +++ b/compiler/tests/statements/iteration_type_fail.leo @@ -0,0 +1,9 @@ +// code sample is from fuzzing bug +// https://github.com/AleoHQ/leo/issues/758 +function main ( + x: u8, +) { + for y in 0u8..10u8 { + let z = y > x; + } +} \ No newline at end of file diff --git a/compiler/tests/statements/mod.rs b/compiler/tests/statements/mod.rs index 8566d67576..d9be9023c3 100644 --- a/compiler/tests/statements/mod.rs +++ b/compiler/tests/statements/mod.rs @@ -82,6 +82,14 @@ fn test_iteration_input() { expect_asg_error(error); } +#[test] +fn test_iteration_wrong_type() { + let program_string = include_str!("iteration_type_fail.leo"); + let error = parse_program(program_string).err().unwrap(); + + expect_asg_error(error); +} + #[test] fn test_iteration_variable() { let program_string = include_str!("iteration_variable.leo"); From fbe10b3aaff7aad8a866d43baf839aebf93753c0 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 14 Apr 2021 20:06:14 +0300 Subject: [PATCH 07/30] adds empty line to leo example --- compiler/tests/statements/iteration_type_fail.leo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/tests/statements/iteration_type_fail.leo b/compiler/tests/statements/iteration_type_fail.leo index 644253a8b9..8ce5665176 100644 --- a/compiler/tests/statements/iteration_type_fail.leo +++ b/compiler/tests/statements/iteration_type_fail.leo @@ -6,4 +6,4 @@ function main ( for y in 0u8..10u8 { let z = y > x; } -} \ No newline at end of file +} From 717fa49dbf29f854471b3bbf1f0d8e24185464c0 Mon Sep 17 00:00:00 2001 From: damirka Date: Wed, 14 Apr 2021 20:53:43 +0300 Subject: [PATCH 08/30] removes whitespace in error message --- ast/src/errors/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ast/src/errors/error.rs b/ast/src/errors/error.rs index 2e47cf6662..0cf34f5d25 100644 --- a/ast/src/errors/error.rs +++ b/ast/src/errors/error.rs @@ -79,7 +79,7 @@ impl fmt::Display for FormattedError { write!( f, - "{indent }--> {path}: {line_start}:{start}\n\ + "{indent }--> {path}:{line_start}:{start}\n\ {indent } |\n", indent = INDENT, path = &*self.path, @@ -130,7 +130,7 @@ fn test_error() { assert_eq!( err.to_string(), vec![ - " --> file.leo: 2:9", + " --> file.leo:2:9", " |", " 2 | let a = x;", " | ^", From 91634d6479d79a32a4e8cc05a6bf2d9f9ed2a3a9 Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 16:00:19 -0400 Subject: [PATCH 09/30] implicit input, removed from function input --- asg/src/expression/variable_ref.rs | 7 --- asg/src/program/function.rs | 6 -- asg/src/statement/assign.rs | 7 --- asg/tests/pass/array/registers.leo | 2 +- asg/tests/pass/boolean/output_register.leo | 2 +- .../pass/function/multiple_returns_main.leo | 2 +- .../access.leo | 2 +- .../input_files/program_state/access_all.leo | 2 +- .../program_state/access_state.leo | 2 +- .../conditional/multiple_returns.leo | 2 +- ast/src/common/input_keyword.rs | 44 ------------- ast/src/common/mod.rs | 3 - ast/src/functions/input/input_variable.rs | 10 +-- compiler/src/function/main_function.rs | 17 +++-- compiler/tests/array/registers.leo | 2 +- compiler/tests/boolean/output_register.leo | 2 +- .../tests/function/multiple_returns_main.leo | 2 +- .../access.leo | 2 +- .../input_files/program_state/access_all.leo | 2 +- .../program_state/access_state.leo | 2 +- .../conditional/multiple_returns.leo | 2 +- grammar/abnf-grammar.txt | 7 +-- parser/src/parser/file.rs | 8 --- tests/old/pass/array/registers.leo | 2 +- tests/old/pass/boolean/output_register.leo | 2 +- .../pass/function/multiple_returns_main.leo | 2 +- .../old/pass/statements/multiple_returns.leo | 2 +- tests/parser/functions/input.leo | 8 --- tests/parser/functions/input.leo.out | 49 --------------- tests/parser/functions/input_order_bad.leo | 8 --- .../parser/functions/input_order_bad.leo.out | 62 ------------------- tests/parser/functions/input_params.leo | 8 --- tests/parser/functions/input_params.leo.out | 62 ------------------- tests/parser/functions/input_typed_fail.leo | 8 --- .../parser/functions/input_typed_fail.leo.out | 5 -- 35 files changed, 30 insertions(+), 325 deletions(-) delete mode 100644 ast/src/common/input_keyword.rs delete mode 100644 tests/parser/functions/input.leo delete mode 100644 tests/parser/functions/input.leo.out delete mode 100644 tests/parser/functions/input_order_bad.leo delete mode 100644 tests/parser/functions/input_order_bad.leo.out delete mode 100644 tests/parser/functions/input_params.leo delete mode 100644 tests/parser/functions/input_params.leo.out delete mode 100644 tests/parser/functions/input_typed_fail.leo delete mode 100644 tests/parser/functions/input_typed_fail.leo.out diff --git a/asg/src/expression/variable_ref.rs b/asg/src/expression/variable_ref.rs index b12363e38d..5e7ee39266 100644 --- a/asg/src/expression/variable_ref.rs +++ b/asg/src/expression/variable_ref.rs @@ -137,13 +137,6 @@ impl<'a> FromAst<'a, leo_ast::Identifier> for &'a Expression<'a> { expected_type: Option>, ) -> Result<&'a Expression<'a>, AsgConvertError> { let variable = if value.name.as_ref() == "input" { - if let Some(function) = scope.resolve_current_function() { - if !function.has_input { - return Err(AsgConvertError::unresolved_reference(&value.name, &value.span)); - } - } else { - return Err(AsgConvertError::unresolved_reference(&value.name, &value.span)); - } if let Some(input) = scope.resolve_input() { input.container } else { diff --git a/asg/src/program/function.rs b/asg/src/program/function.rs index a594aa107d..bf89b0020f 100644 --- a/asg/src/program/function.rs +++ b/asg/src/program/function.rs @@ -47,7 +47,6 @@ pub struct Function<'a> { pub id: u32, pub name: RefCell, pub output: Type<'a>, - pub has_input: bool, pub arguments: IndexMap>>, pub circuit: Cell>>, pub span: Option, @@ -77,16 +76,12 @@ impl<'a> Function<'a> { .transpose()? .unwrap_or_else(|| Type::Tuple(vec![])); let mut qualifier = FunctionQualifier::Static; - let mut has_input = false; let new_scope = scope.make_subscope(); let mut arguments = IndexMap::new(); { for input in value.input.iter() { match input { - FunctionInput::InputKeyword(_) => { - has_input = true; - } FunctionInput::SelfKeyword(_) => { qualifier = FunctionQualifier::SelfRef; } @@ -125,7 +120,6 @@ impl<'a> Function<'a> { id: scope.context.get_id(), name: RefCell::new(value.identifier.clone()), output, - has_input, arguments, circuit: Cell::new(None), body: Cell::new(None), diff --git a/asg/src/statement/assign.rs b/asg/src/statement/assign.rs index b2a23878b6..b3842d3f30 100644 --- a/asg/src/statement/assign.rs +++ b/asg/src/statement/assign.rs @@ -70,13 +70,6 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> { let (name, span) = (&statement.assignee.identifier.name, &statement.assignee.identifier.span); let variable = if name.as_ref() == "input" { - if let Some(function) = scope.resolve_current_function() { - if !function.has_input { - return Err(AsgConvertError::unresolved_reference(name, &span)); - } - } else { - return Err(AsgConvertError::unresolved_reference(name, &span)); - } if let Some(input) = scope.resolve_input() { input.container } else { diff --git a/asg/tests/pass/array/registers.leo b/asg/tests/pass/array/registers.leo index fb8980868e..ab4107d46c 100644 --- a/asg/tests/pass/array/registers.leo +++ b/asg/tests/pass/array/registers.leo @@ -1,3 +1,3 @@ -function main(input) -> [u8; 3] { +function main() -> [u8; 3] { return input.registers.r } \ No newline at end of file diff --git a/asg/tests/pass/boolean/output_register.leo b/asg/tests/pass/boolean/output_register.leo index fb01d41dbe..8237614fa7 100644 --- a/asg/tests/pass/boolean/output_register.leo +++ b/asg/tests/pass/boolean/output_register.leo @@ -1,3 +1,3 @@ -function main(input) -> bool { +function main() -> bool { return input.registers.r } \ No newline at end of file diff --git a/asg/tests/pass/function/multiple_returns_main.leo b/asg/tests/pass/function/multiple_returns_main.leo index 0bc82e1e4b..69a2b32232 100644 --- a/asg/tests/pass/function/multiple_returns_main.leo +++ b/asg/tests/pass/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ -function main(input) -> (bool, bool) { +function main() -> (bool, bool) { return (input.registers.a, input.registers.b) } \ No newline at end of file diff --git a/asg/tests/pass/input_files/program_input_and_program_state/access.leo b/asg/tests/pass/input_files/program_input_and_program_state/access.leo index ae1728c164..819f6c6c1e 100644 --- a/asg/tests/pass/input_files/program_input_and_program_state/access.leo +++ b/asg/tests/pass/input_files/program_input_and_program_state/access.leo @@ -1,4 +1,4 @@ -function main(input, data: [u8; 32]) { +function main(data: [u8; 32]) { console.assert(input.registers.value_balance == 0u64); console.assert(input.state.leaf_index == 0u32); diff --git a/asg/tests/pass/input_files/program_state/access_all.leo b/asg/tests/pass/input_files/program_state/access_all.leo index 2a60f218aa..bf85a3f722 100644 --- a/asg/tests/pass/input_files/program_state/access_all.leo +++ b/asg/tests/pass/input_files/program_state/access_all.leo @@ -1,4 +1,4 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); const expected: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; diff --git a/asg/tests/pass/input_files/program_state/access_state.leo b/asg/tests/pass/input_files/program_state/access_state.leo index 0e014aec54..a7afe50a5f 100644 --- a/asg/tests/pass/input_files/program_state/access_state.leo +++ b/asg/tests/pass/input_files/program_state/access_state.leo @@ -1,3 +1,3 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); } \ No newline at end of file diff --git a/asg/tests/pass/statements/conditional/multiple_returns.leo b/asg/tests/pass/statements/conditional/multiple_returns.leo index b8dd869b47..0a6b599681 100644 --- a/asg/tests/pass/statements/conditional/multiple_returns.leo +++ b/asg/tests/pass/statements/conditional/multiple_returns.leo @@ -1,4 +1,4 @@ -function main(input) -> u32 { +function main() -> u32 { if input.registers.a == 0u32 { return 0u32 } else { diff --git a/ast/src/common/input_keyword.rs b/ast/src/common/input_keyword.rs deleted file mode 100644 index fecf89322e..0000000000 --- a/ast/src/common/input_keyword.rs +++ /dev/null @@ -1,44 +0,0 @@ -// 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::{Identifier, Node, Span}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -/// The `input` keyword can view program register, record, and state values. -/// Values cannot be modified. The `input` keyword cannot be made mutable. -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(transparent)] -pub struct InputKeyword { - pub identifier: Identifier, -} - -impl fmt::Display for InputKeyword { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "input") - } -} - -impl Node for InputKeyword { - fn span(&self) -> &Span { - &self.identifier.span - } - - fn set_span(&mut self, span: Span) { - self.identifier.span = span; - } -} diff --git a/ast/src/common/mod.rs b/ast/src/common/mod.rs index e7bd108cd2..a1255ed0a0 100644 --- a/ast/src/common/mod.rs +++ b/ast/src/common/mod.rs @@ -23,9 +23,6 @@ pub use const_self_keyword::*; pub mod identifier; pub use identifier::*; -pub mod input_keyword; -pub use input_keyword::*; - pub mod mut_self_keyword; pub use mut_self_keyword::*; diff --git a/ast/src/functions/input/input_variable.rs b/ast/src/functions/input/input_variable.rs index fda2c11ab8..9f5d0575af 100644 --- a/ast/src/functions/input/input_variable.rs +++ b/ast/src/functions/input/input_variable.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ConstSelfKeyword, FunctionInputVariable, InputKeyword, MutSelfKeyword, Node, SelfKeyword, Span}; +use crate::{ConstSelfKeyword, FunctionInputVariable, MutSelfKeyword, Node, SelfKeyword, Span}; use serde::{Deserialize, Serialize}; use std::fmt; @@ -22,7 +22,6 @@ use std::fmt; /// Enumerates the possible inputs to a function. #[derive(Clone, Serialize, Deserialize)] pub enum FunctionInput { - InputKeyword(InputKeyword), SelfKeyword(SelfKeyword), ConstSelfKeyword(ConstSelfKeyword), MutSelfKeyword(MutSelfKeyword), @@ -36,7 +35,6 @@ impl FunctionInput { /// pub fn is_self(&self) -> bool { match self { - FunctionInput::InputKeyword(_) => false, FunctionInput::SelfKeyword(_) => true, FunctionInput::ConstSelfKeyword(_) => true, FunctionInput::MutSelfKeyword(_) => true, @@ -50,7 +48,6 @@ impl FunctionInput { /// pub fn is_const_self(&self) -> bool { match self { - FunctionInput::InputKeyword(_) => false, FunctionInput::SelfKeyword(_) => false, FunctionInput::ConstSelfKeyword(_) => true, FunctionInput::MutSelfKeyword(_) => false, @@ -64,7 +61,6 @@ impl FunctionInput { /// pub fn is_mut_self(&self) -> bool { match self { - FunctionInput::InputKeyword(_) => false, FunctionInput::SelfKeyword(_) => false, FunctionInput::ConstSelfKeyword(_) => false, FunctionInput::MutSelfKeyword(_) => true, @@ -74,7 +70,6 @@ impl FunctionInput { fn format(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - FunctionInput::InputKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::SelfKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::ConstSelfKeyword(keyword) => write!(f, "{}", keyword), FunctionInput::MutSelfKeyword(keyword) => write!(f, "{}", keyword), @@ -99,7 +94,6 @@ impl PartialEq for FunctionInput { /// Returns true if `self == other`. Does not compare spans. fn eq(&self, other: &Self) -> bool { match (self, other) { - (FunctionInput::InputKeyword(_), FunctionInput::InputKeyword(_)) => true, (FunctionInput::SelfKeyword(_), FunctionInput::SelfKeyword(_)) => true, (FunctionInput::ConstSelfKeyword(_), FunctionInput::ConstSelfKeyword(_)) => true, (FunctionInput::MutSelfKeyword(_), FunctionInput::MutSelfKeyword(_)) => true, @@ -115,7 +109,6 @@ impl Node for FunctionInput { fn span(&self) -> &Span { use FunctionInput::*; match self { - InputKeyword(keyword) => &keyword.identifier.span, SelfKeyword(keyword) => &keyword.identifier.span, ConstSelfKeyword(keyword) => &keyword.identifier.span, MutSelfKeyword(keyword) => &keyword.identifier.span, @@ -126,7 +119,6 @@ impl Node for FunctionInput { fn set_span(&mut self, span: Span) { use FunctionInput::*; match self { - InputKeyword(keyword) => keyword.identifier.span = span, SelfKeyword(keyword) => keyword.identifier.span = span, ConstSelfKeyword(keyword) => keyword.identifier.span = span, MutSelfKeyword(keyword) => keyword.identifier.span = span, diff --git a/compiler/src/function/main_function.rs b/compiler/src/function/main_function.rs index 5d4b738351..9c90b3fb4f 100644 --- a/compiler/src/function/main_function.rs +++ b/compiler/src/function/main_function.rs @@ -35,17 +35,16 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { let registers = input.get_registers(); // Iterate over main function input variables and allocate new values - if function.has_input { - // let input_var = function.scope. - let asg_input = function - .scope - .resolve_input() - .expect("no input variable in scope when function is qualified"); + let asg_input = function.scope.resolve_input(); - let value = - self.allocate_input_keyword(cs, &function.name.borrow().span, &asg_input.container_circuit, input)?; + match asg_input { + Some(asg_input) => { + let value = + self.allocate_input_keyword(cs, &function.name.borrow().span, &asg_input.container_circuit, input)?; - self.store(asg_input.container.borrow().id, value); + self.store(asg_input.container.borrow().id, value); + } + None => (), } match function.qualifier { diff --git a/compiler/tests/array/registers.leo b/compiler/tests/array/registers.leo index fb8980868e..ab4107d46c 100644 --- a/compiler/tests/array/registers.leo +++ b/compiler/tests/array/registers.leo @@ -1,3 +1,3 @@ -function main(input) -> [u8; 3] { +function main() -> [u8; 3] { return input.registers.r } \ No newline at end of file diff --git a/compiler/tests/boolean/output_register.leo b/compiler/tests/boolean/output_register.leo index fb01d41dbe..8237614fa7 100644 --- a/compiler/tests/boolean/output_register.leo +++ b/compiler/tests/boolean/output_register.leo @@ -1,3 +1,3 @@ -function main(input) -> bool { +function main() -> bool { return input.registers.r } \ No newline at end of file diff --git a/compiler/tests/function/multiple_returns_main.leo b/compiler/tests/function/multiple_returns_main.leo index 0bc82e1e4b..69a2b32232 100644 --- a/compiler/tests/function/multiple_returns_main.leo +++ b/compiler/tests/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ -function main(input) -> (bool, bool) { +function main() -> (bool, bool) { return (input.registers.a, input.registers.b) } \ No newline at end of file diff --git a/compiler/tests/input_files/program_input_and_program_state/access.leo b/compiler/tests/input_files/program_input_and_program_state/access.leo index ae1728c164..819f6c6c1e 100644 --- a/compiler/tests/input_files/program_input_and_program_state/access.leo +++ b/compiler/tests/input_files/program_input_and_program_state/access.leo @@ -1,4 +1,4 @@ -function main(input, data: [u8; 32]) { +function main(data: [u8; 32]) { console.assert(input.registers.value_balance == 0u64); console.assert(input.state.leaf_index == 0u32); diff --git a/compiler/tests/input_files/program_state/access_all.leo b/compiler/tests/input_files/program_state/access_all.leo index 2a60f218aa..bf85a3f722 100644 --- a/compiler/tests/input_files/program_state/access_all.leo +++ b/compiler/tests/input_files/program_state/access_all.leo @@ -1,4 +1,4 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); const expected: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; diff --git a/compiler/tests/input_files/program_state/access_state.leo b/compiler/tests/input_files/program_state/access_state.leo index 0e014aec54..a7afe50a5f 100644 --- a/compiler/tests/input_files/program_state/access_state.leo +++ b/compiler/tests/input_files/program_state/access_state.leo @@ -1,3 +1,3 @@ -function main(input) { +function main() { console.assert(input.state.root == [0u8; 32]); } \ No newline at end of file diff --git a/compiler/tests/statements/conditional/multiple_returns.leo b/compiler/tests/statements/conditional/multiple_returns.leo index b8dd869b47..0a6b599681 100644 --- a/compiler/tests/statements/conditional/multiple_returns.leo +++ b/compiler/tests/statements/conditional/multiple_returns.leo @@ -1,4 +1,4 @@ -function main(input) -> u32 { +function main() -> u32 { if input.registers.a == 0u32 { return 0u32 } else { diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index 3f9a7fe882..6d7c6cce7f 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -973,10 +973,9 @@ function-declaration = *annotation %s"function" identifier "(" [ function-parameters ] ")" [ "->" type ] block -function-parameters = self-parameter [ "," input-parameter ] - / self-parameter "," function-inputs [ "," input-parameter ] - / function-inputs [ "," input-parameter ] - / input-parameter +function-parameters = self-parameter + / self-parameter "," function-inputs + / function-inputs self-parameter = [ %s"mut" / %s"const" ] %s"self" diff --git a/parser/src/parser/file.rs b/parser/src/parser/file.rs index 500809f2ed..ece7ed5825 100644 --- a/parser/src/parser/file.rs +++ b/parser/src/parser/file.rs @@ -312,14 +312,6 @@ impl ParserContext { /// Returns a [`FunctionInput`] AST node if the next tokens represent a function parameter. /// pub fn parse_function_parameters(&mut self) -> SyntaxResult { - if let Some(token) = self.eat(Token::Input) { - return Ok(FunctionInput::InputKeyword(InputKeyword { - identifier: Identifier { - name: token.token.to_string().into(), - span: token.span, - }, - })); - } let const_ = self.eat(Token::Const); let mutable = self.eat(Token::Mut); let mut name = if let Some(token) = self.eat(Token::LittleSelf) { diff --git a/tests/old/pass/array/registers.leo b/tests/old/pass/array/registers.leo index fb8980868e..ab4107d46c 100644 --- a/tests/old/pass/array/registers.leo +++ b/tests/old/pass/array/registers.leo @@ -1,3 +1,3 @@ -function main(input) -> [u8; 3] { +function main() -> [u8; 3] { return input.registers.r } \ No newline at end of file diff --git a/tests/old/pass/boolean/output_register.leo b/tests/old/pass/boolean/output_register.leo index fb01d41dbe..8237614fa7 100644 --- a/tests/old/pass/boolean/output_register.leo +++ b/tests/old/pass/boolean/output_register.leo @@ -1,3 +1,3 @@ -function main(input) -> bool { +function main() -> bool { return input.registers.r } \ No newline at end of file diff --git a/tests/old/pass/function/multiple_returns_main.leo b/tests/old/pass/function/multiple_returns_main.leo index 0bc82e1e4b..69a2b32232 100644 --- a/tests/old/pass/function/multiple_returns_main.leo +++ b/tests/old/pass/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ -function main(input) -> (bool, bool) { +function main() -> (bool, bool) { return (input.registers.a, input.registers.b) } \ No newline at end of file diff --git a/tests/old/pass/statements/multiple_returns.leo b/tests/old/pass/statements/multiple_returns.leo index b8dd869b47..0a6b599681 100644 --- a/tests/old/pass/statements/multiple_returns.leo +++ b/tests/old/pass/statements/multiple_returns.leo @@ -1,4 +1,4 @@ -function main(input) -> u32 { +function main() -> u32 { if input.registers.a == 0u32 { return 0u32 } else { diff --git a/tests/parser/functions/input.leo b/tests/parser/functions/input.leo deleted file mode 100644 index a84d43f585..0000000000 --- a/tests/parser/functions/input.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(input) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/input.leo.out b/tests/parser/functions/input.leo.out deleted file mode 100644 index 11e9fee9c9..0000000000 --- a/tests/parser/functions/input.leo.out +++ /dev/null @@ -1,49 +0,0 @@ ---- -namespace: Parse -expectation: Pass -outputs: - - name: "" - expected_input: [] - imports: [] - circuits: {} - functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"input.leo\\\",\\\"content\\\":\\\"function x(input) {\\\"}\"}": - annotations: [] - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"input.leo\\\",\\\"content\\\":\\\"function x(input) {\\\"}\"}" - input: - - InputKeyword: "{\"name\":\"input\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":17,\\\"path\\\":\\\"input.leo\\\",\\\"content\\\":\\\"function x(input) {\\\"}\"}" - output: ~ - block: - statements: - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: input.leo - content: " return ();" - span: - line_start: 4 - line_stop: 4 - col_start: 5 - col_stop: 14 - path: input.leo - content: " return ();" - span: - line_start: 3 - line_stop: 5 - col_start: 19 - col_stop: 2 - path: input.leo - content: "function x(input) {\n...\n}" - span: - line_start: 3 - line_stop: 5 - col_start: 1 - col_stop: 2 - path: input.leo - content: "function x(input) {\n...\n}" diff --git a/tests/parser/functions/input_order_bad.leo b/tests/parser/functions/input_order_bad.leo deleted file mode 100644 index 9a58c4c926..0000000000 --- a/tests/parser/functions/input_order_bad.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(x: u32, input) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/input_order_bad.leo.out b/tests/parser/functions/input_order_bad.leo.out deleted file mode 100644 index a363b1398a..0000000000 --- a/tests/parser/functions/input_order_bad.leo.out +++ /dev/null @@ -1,62 +0,0 @@ ---- -namespace: Parse -expectation: Pass -outputs: - - name: "" - expected_input: [] - imports: [] - circuits: {} - functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"input_order_bad.leo\\\",\\\"content\\\":\\\"function x(x: u32, input) {\\\"}\"}": - annotations: [] - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"input_order_bad.leo\\\",\\\"content\\\":\\\"function x(x: u32, input) {\\\"}\"}" - input: - - Variable: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"input_order_bad.leo\\\",\\\"content\\\":\\\"function x(x: u32, input) {\\\"}\"}" - const_: false - mutable: true - type_: - IntegerType: U32 - span: - line_start: 3 - line_stop: 3 - col_start: 12 - col_stop: 13 - path: input_order_bad.leo - content: "function x(x: u32, input) {" - - InputKeyword: "{\"name\":\"input\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":25,\\\"path\\\":\\\"input_order_bad.leo\\\",\\\"content\\\":\\\"function x(x: u32, input) {\\\"}\"}" - output: ~ - block: - statements: - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: input_order_bad.leo - content: " return ();" - span: - line_start: 4 - line_stop: 4 - col_start: 5 - col_stop: 14 - path: input_order_bad.leo - content: " return ();" - span: - line_start: 3 - line_stop: 5 - col_start: 27 - col_stop: 2 - path: input_order_bad.leo - content: "function x(x: u32, input) {\n...\n}" - span: - line_start: 3 - line_stop: 5 - col_start: 1 - col_stop: 2 - path: input_order_bad.leo - content: "function x(x: u32, input) {\n...\n}" diff --git a/tests/parser/functions/input_params.leo b/tests/parser/functions/input_params.leo deleted file mode 100644 index a8356d2750..0000000000 --- a/tests/parser/functions/input_params.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Pass -*/ - -function x(input, x: u32) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/input_params.leo.out b/tests/parser/functions/input_params.leo.out deleted file mode 100644 index f8b25f6762..0000000000 --- a/tests/parser/functions/input_params.leo.out +++ /dev/null @@ -1,62 +0,0 @@ ---- -namespace: Parse -expectation: Pass -outputs: - - name: "" - expected_input: [] - imports: [] - circuits: {} - functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"input_params.leo\\\",\\\"content\\\":\\\"function x(input, x: u32) {\\\"}\"}": - annotations: [] - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"input_params.leo\\\",\\\"content\\\":\\\"function x(input, x: u32) {\\\"}\"}" - input: - - InputKeyword: "{\"name\":\"input\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":17,\\\"path\\\":\\\"input_params.leo\\\",\\\"content\\\":\\\"function x(input, x: u32) {\\\"}\"}" - - Variable: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":19,\\\"col_stop\\\":20,\\\"path\\\":\\\"input_params.leo\\\",\\\"content\\\":\\\"function x(input, x: u32) {\\\"}\"}" - const_: false - mutable: true - type_: - IntegerType: U32 - span: - line_start: 3 - line_stop: 3 - col_start: 19 - col_stop: 20 - path: input_params.leo - content: "function x(input, x: u32) {" - output: ~ - block: - statements: - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: input_params.leo - content: " return ();" - span: - line_start: 4 - line_stop: 4 - col_start: 5 - col_stop: 14 - path: input_params.leo - content: " return ();" - span: - line_start: 3 - line_stop: 5 - col_start: 27 - col_stop: 2 - path: input_params.leo - content: "function x(input, x: u32) {\n...\n}" - span: - line_start: 3 - line_stop: 5 - col_start: 1 - col_stop: 2 - path: input_params.leo - content: "function x(input, x: u32) {\n...\n}" diff --git a/tests/parser/functions/input_typed_fail.leo b/tests/parser/functions/input_typed_fail.leo deleted file mode 100644 index ab346c7a7c..0000000000 --- a/tests/parser/functions/input_typed_fail.leo +++ /dev/null @@ -1,8 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -function x(input: u32) { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/input_typed_fail.leo.out b/tests/parser/functions/input_typed_fail.leo.out deleted file mode 100644 index 7a24da1657..0000000000 --- a/tests/parser/functions/input_typed_fail.leo.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Parse -expectation: Fail -outputs: - - " --> test: 3:17\n |\n 3 | function x(input: u32) {\n | ^\n |\n = expected ')' -- got ':'" From 1231c5bc36f490919da0a154711de86bdb63c04b Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 16:03:53 -0400 Subject: [PATCH 10/30] clippy fix --- compiler/src/function/main_function.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler/src/function/main_function.rs b/compiler/src/function/main_function.rs index 9c90b3fb4f..3a2eb27e13 100644 --- a/compiler/src/function/main_function.rs +++ b/compiler/src/function/main_function.rs @@ -37,14 +37,11 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { // Iterate over main function input variables and allocate new values let asg_input = function.scope.resolve_input(); - match asg_input { - Some(asg_input) => { - let value = - self.allocate_input_keyword(cs, &function.name.borrow().span, &asg_input.container_circuit, input)?; + if let Some(asg_input) = asg_input { + let value = + self.allocate_input_keyword(cs, &function.name.borrow().span, &asg_input.container_circuit, input)?; - self.store(asg_input.container.borrow().id, value); - } - None => (), + self.store(asg_input.container.borrow().id, value); } match function.qualifier { From 11c78da916b7982ed73e6ae68e8faed76bdad6b3 Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 16:15:27 -0400 Subject: [PATCH 11/30] formatted string -> renamed format string --- asg/src/checks/return_path.rs | 2 +- asg/src/reducer/monoidal_director.rs | 2 +- asg/src/reducer/monoidal_reducer.rs | 2 +- asg/src/reducer/reconstructing_director.rs | 2 +- asg/src/reducer/reconstructing_reducer.rs | 8 ++--- asg/src/reducer/visitor.rs | 2 +- asg/src/reducer/visitor_director.rs | 2 +- asg/src/statement/console.rs | 32 +++++++++---------- ast/src/reducer/canonicalization.rs | 2 +- ast/src/reducer/reconstructing_director.rs | 2 +- .../statements/console/console_function.rs | 8 ++--- .../statements/console/formatted_string.rs | 14 ++++---- compiler/src/console/format.rs | 12 +++---- grammar/abnf-grammar.txt | 28 ++++++++-------- parser/src/parser/statement.rs | 12 +++---- parser/src/tokenizer/lexer.rs | 10 +++--- parser/src/tokenizer/token.rs | 12 +++---- 17 files changed, 76 insertions(+), 76 deletions(-) diff --git a/asg/src/checks/return_path.rs b/asg/src/checks/return_path.rs index 8a21f0514e..e0f73d3c0d 100644 --- a/asg/src/checks/return_path.rs +++ b/asg/src/checks/return_path.rs @@ -92,7 +92,7 @@ impl<'a> MonoidalReducerStatement<'a, BoolAnd> for ReturnPathReducer { if_true.append(if_false.unwrap_or(BoolAnd(false))) } - fn reduce_formatted_string(&mut self, input: &FormattedString, parameters: Vec) -> BoolAnd { + fn reduce_formatted_string(&mut self, input: &FormatString, parameters: Vec) -> BoolAnd { BoolAnd(false) } diff --git a/asg/src/reducer/monoidal_director.rs b/asg/src/reducer/monoidal_director.rs index 28fbd31690..b0f97fec7b 100644 --- a/asg/src/reducer/monoidal_director.rs +++ b/asg/src/reducer/monoidal_director.rs @@ -225,7 +225,7 @@ impl<'a, T: Monoid, R: MonoidalReducerStatement<'a, T>> MonoidalDirector<'a, T, .reduce_conditional_statement(input, condition, if_true, if_false) } - pub fn reduce_formatted_string(&mut self, input: &FormattedString<'a>) -> T { + pub fn reduce_formatted_string(&mut self, input: &FormatString<'a>) -> T { let parameters = input .parameters .iter() diff --git a/asg/src/reducer/monoidal_reducer.rs b/asg/src/reducer/monoidal_reducer.rs index b06210cc4c..2a10604e1e 100644 --- a/asg/src/reducer/monoidal_reducer.rs +++ b/asg/src/reducer/monoidal_reducer.rs @@ -118,7 +118,7 @@ pub trait MonoidalReducerStatement<'a, T: Monoid>: MonoidalReducerExpression<'a, condition.append(if_true).append_option(if_false) } - fn reduce_formatted_string(&mut self, input: &FormattedString<'a>, parameters: Vec) -> T { + fn reduce_formatted_string(&mut self, input: &FormatString<'a>, parameters: Vec) -> T { T::default().append_all(parameters.into_iter()) } diff --git a/asg/src/reducer/reconstructing_director.rs b/asg/src/reducer/reconstructing_director.rs index 549c718937..239f1943c9 100644 --- a/asg/src/reducer/reconstructing_director.rs +++ b/asg/src/reducer/reconstructing_director.rs @@ -243,7 +243,7 @@ impl<'a, R: ReconstructingReducerStatement<'a>> ReconstructingDirector<'a, R> { .reduce_conditional_statement(input, condition, if_true, if_false) } - pub fn reduce_formatted_string(&mut self, input: FormattedString<'a>) -> FormattedString<'a> { + pub fn reduce_formatted_string(&mut self, input: FormatString<'a>) -> FormatString<'a> { let parameters = input .parameters .iter() diff --git a/asg/src/reducer/reconstructing_reducer.rs b/asg/src/reducer/reconstructing_reducer.rs index 3e38d4cc7a..1441c13a1d 100644 --- a/asg/src/reducer/reconstructing_reducer.rs +++ b/asg/src/reducer/reconstructing_reducer.rs @@ -274,10 +274,10 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a fn reduce_formatted_string( &mut self, - input: FormattedString<'a>, + input: FormatString<'a>, parameters: Vec<&'a Expression<'a>>, - ) -> FormattedString<'a> { - FormattedString { + ) -> FormatString<'a> { + FormatString { span: input.span, parts: input.parts, parameters: parameters.into_iter().map(Cell::new).collect(), @@ -293,7 +293,7 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a }) } - fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormattedString<'a>) -> Statement<'a> { + fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormatString<'a>) -> Statement<'a> { assert!(!matches!(input.function, ConsoleFunction::Assert(_))); Statement::Console(ConsoleStatement { parent: input.parent, diff --git a/asg/src/reducer/visitor.rs b/asg/src/reducer/visitor.rs index b0f4d3ee6a..8a87cf4700 100644 --- a/asg/src/reducer/visitor.rs +++ b/asg/src/reducer/visitor.rs @@ -120,7 +120,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> { Default::default() } - fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> VisitResult { + fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> VisitResult { Default::default() } diff --git a/asg/src/reducer/visitor_director.rs b/asg/src/reducer/visitor_director.rs index 9665f31053..78cfdd5d94 100644 --- a/asg/src/reducer/visitor_director.rs +++ b/asg/src/reducer/visitor_director.rs @@ -319,7 +319,7 @@ impl<'a, R: StatementVisitor<'a>> VisitorDirector<'a, R> { } } - pub fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> ConcreteVisitResult { + pub fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> ConcreteVisitResult { match self.visitor.visit_formatted_string(input) { VisitResult::VisitChildren => { for parameter in input.parameters.iter() { diff --git a/asg/src/statement/console.rs b/asg/src/statement/console.rs index 5820abb579..5e47cb0012 100644 --- a/asg/src/statement/console.rs +++ b/asg/src/statement/console.rs @@ -15,14 +15,14 @@ // along with the Leo library. If not, see . use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type}; -use leo_ast::{ConsoleFunction as AstConsoleFunction, FormattedStringPart}; +use leo_ast::{ConsoleFunction as AstConsoleFunction, FormatStringPart}; use std::cell::Cell; // TODO (protryon): Refactor to not require/depend on span #[derive(Clone)] -pub struct FormattedString<'a> { - pub parts: Vec, +pub struct FormatString<'a> { + pub parts: Vec, pub parameters: Vec>>, pub span: Span, } @@ -30,9 +30,9 @@ pub struct FormattedString<'a> { #[derive(Clone)] pub enum ConsoleFunction<'a> { Assert(Cell<&'a Expression<'a>>), - Debug(FormattedString<'a>), - Error(FormattedString<'a>), - Log(FormattedString<'a>), + Debug(FormatString<'a>), + Error(FormatString<'a>), + Log(FormatString<'a>), } #[derive(Clone)] @@ -48,16 +48,16 @@ impl<'a> Node for ConsoleStatement<'a> { } } -impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> { +impl<'a> FromAst<'a, leo_ast::FormatString> for FormatString<'a> { fn from_ast( scope: &'a Scope<'a>, - value: &leo_ast::FormattedString, + value: &leo_ast::FormatString, _expected_type: Option>, ) -> Result { let expected_param_len = value .parts .iter() - .filter(|x| matches!(x, FormattedStringPart::Container)) + .filter(|x| matches!(x, FormatStringPart::Container)) .count(); if value.parameters.len() != expected_param_len { // + 1 for formatting string as to not confuse user @@ -71,7 +71,7 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> { for parameter in value.parameters.iter() { parameters.push(Cell::new(<&Expression<'a>>::from_ast(scope, parameter, None)?)); } - Ok(FormattedString { + Ok(FormatString { parts: value.parts.clone(), parameters, span: value.span.clone(), @@ -79,9 +79,9 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> { } } -impl<'a> Into for &FormattedString<'a> { - fn into(self) -> leo_ast::FormattedString { - leo_ast::FormattedString { +impl<'a> Into for &FormatString<'a> { + fn into(self) -> leo_ast::FormatString { + leo_ast::FormatString { parts: self.parts.clone(), parameters: self.parameters.iter().map(|e| e.get().into()).collect(), span: self.span.clone(), @@ -103,13 +103,13 @@ impl<'a> FromAst<'a, leo_ast::ConsoleStatement> for ConsoleStatement<'a> { <&Expression<'a>>::from_ast(scope, expression, Some(Type::Boolean.into()))?, )), AstConsoleFunction::Debug(formatted_string) => { - ConsoleFunction::Debug(FormattedString::from_ast(scope, formatted_string, None)?) + ConsoleFunction::Debug(FormatString::from_ast(scope, formatted_string, None)?) } AstConsoleFunction::Error(formatted_string) => { - ConsoleFunction::Error(FormattedString::from_ast(scope, formatted_string, None)?) + ConsoleFunction::Error(FormatString::from_ast(scope, formatted_string, None)?) } AstConsoleFunction::Log(formatted_string) => { - ConsoleFunction::Log(FormattedString::from_ast(scope, formatted_string, None)?) + ConsoleFunction::Log(FormatString::from_ast(scope, formatted_string, None)?) } }, }) diff --git a/ast/src/reducer/canonicalization.rs b/ast/src/reducer/canonicalization.rs index 0fe3a124b0..7a43821181 100644 --- a/ast/src/reducer/canonicalization.rs +++ b/ast/src/reducer/canonicalization.rs @@ -324,7 +324,7 @@ impl Canonicalizer { .map(|parameter| self.canonicalize_expression(parameter)) .collect(); - let formatted = FormattedString { + let formatted = FormatString { parts: format.parts.clone(), parameters, span: format.span.clone(), diff --git a/ast/src/reducer/reconstructing_director.rs b/ast/src/reducer/reconstructing_director.rs index 016d8d18db..b84e52ec79 100644 --- a/ast/src/reducer/reconstructing_director.rs +++ b/ast/src/reducer/reconstructing_director.rs @@ -418,7 +418,7 @@ impl ReconstructingDirector { parameters.push(self.reduce_expression(parameter)?); } - let formatted = FormattedString { + let formatted = FormatString { parts: format.parts.clone(), parameters, span: format.span.clone(), diff --git a/ast/src/statements/console/console_function.rs b/ast/src/statements/console/console_function.rs index 16115878ce..17a19931cb 100644 --- a/ast/src/statements/console/console_function.rs +++ b/ast/src/statements/console/console_function.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{Expression, FormattedString, Node, Span}; +use crate::{Expression, FormatString, Node, Span}; use serde::{Deserialize, Serialize}; use std::fmt; @@ -22,9 +22,9 @@ use std::fmt; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] pub enum ConsoleFunction { Assert(Expression), - Debug(FormattedString), - Error(FormattedString), - Log(FormattedString), + Debug(FormatString), + Error(FormatString), + Log(FormatString), } impl fmt::Display for ConsoleFunction { diff --git a/ast/src/statements/console/formatted_string.rs b/ast/src/statements/console/formatted_string.rs index 542e61ef4a..5013b8cb93 100644 --- a/ast/src/statements/console/formatted_string.rs +++ b/ast/src/statements/console/formatted_string.rs @@ -21,19 +21,19 @@ use std::fmt; use tendril::StrTendril; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] -pub enum FormattedStringPart { +pub enum FormatStringPart { Const(#[serde(with = "crate::common::tendril_json")] StrTendril), Container, } #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] -pub struct FormattedString { - pub parts: Vec, +pub struct FormatString { + pub parts: Vec, pub parameters: Vec, pub span: Span, } -impl fmt::Display for FormattedString { +impl fmt::Display for FormatString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, @@ -41,8 +41,8 @@ impl fmt::Display for FormattedString { self.parts .iter() .map(|x| match x { - FormattedStringPart::Const(x) => x, - FormattedStringPart::Container => "{}", + FormatStringPart::Const(x) => x, + FormatStringPart::Container => "{}", }) .collect::>() .join("") @@ -50,7 +50,7 @@ impl fmt::Display for FormattedString { } } -impl Node for FormattedString { +impl Node for FormatString { fn span(&self) -> &Span { &self.span } diff --git a/compiler/src/console/format.rs b/compiler/src/console/format.rs index 507770543d..342cb8d7fe 100644 --- a/compiler/src/console/format.rs +++ b/compiler/src/console/format.rs @@ -17,8 +17,8 @@ //! Evaluates a formatted string in a compiled Leo program. use crate::{errors::ConsoleError, program::ConstrainedProgram, GroupType}; -use leo_asg::FormattedString; -use leo_ast::FormattedStringPart; +use leo_asg::FormatString; +use leo_ast::FormatStringPart; use snarkvm_fields::PrimeField; use snarkvm_r1cs::ConstraintSystem; @@ -26,13 +26,13 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { pub fn format>( &mut self, cs: &mut CS, - formatted: &FormattedString<'a>, + formatted: &FormatString<'a>, ) -> Result { // Check that containers and parameters match let container_count = formatted .parts .iter() - .filter(|x| matches!(x, FormattedStringPart::Container)) + .filter(|x| matches!(x, FormatStringPart::Container)) .count(); if container_count != formatted.parameters.len() { return Err(ConsoleError::length( @@ -51,8 +51,8 @@ impl<'a, F: PrimeField, G: GroupType> ConstrainedProgram<'a, F, G> { let mut parameters = executed_containers.iter(); for part in formatted.parts.iter() { match part { - FormattedStringPart::Const(c) => out.push(&**c), - FormattedStringPart::Container => out.push(&**parameters.next().unwrap()), + FormatStringPart::Const(c) => out.push(&**c), + FormatStringPart::Container => out.push(&**parameters.next().unwrap()), } } diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index 6d7c6cce7f..b6ae85971e 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -452,26 +452,26 @@ package-name = 1*( lowercase-letter / digit ) address = %s"aleo1" 58( lowercase-letter / digit ) -; A formatted string is a sequence of characters, other than double quote, +; A format string is a sequence of characters, other than double quote, ; surrounded by double quotes. -; Within a formatted string, sub-strings '{}' are distinguished as containers +; Within a format string, sub-strings '{}' are distinguished as containers ; (these are the ones that may be matched with values ; whose textual representation replaces the containers ; in the printed string). ; There is an implicit extra-grammatical requirements that -; the explicit 'formatted-string-container' instances include +; the explicit 'format-string-container' instances include ; all the occurrences of '{}' in the parsed character sequence: ; that is, there may not be two contiguous 'not-double-quote' instances ; that are '{' and '}'. -formatted-string-container = "{}" +format-string-container = "{}" -formatted-string = double-quote - *( not-double-quote / formatted-string-container ) +format-string = double-quote + *( not-double-quote / format-string-container ) double-quote ; Here is (part of this ABNF comment), -; an alternative way to specify formatted strings, +; an alternative way to specify format strings, ; which captures the extra-grammatical requirement above in the grammar, ; but is more complicated: ; @@ -479,11 +479,11 @@ formatted-string = double-quote ; ; not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF ; -; formatted-string-element = not-double-quote-or-open-brace +; format-string-element = not-double-quote-or-open-brace ; / "{" not-double-quote-or-close-brace -; / formatted-string-container +; / format-string-container ; -; formatted-string = double-quote *formatted-string-element double-quote +; format-string = double-quote *format-string-element double-quote ; ; It is not immediately clear which approach is better; there are tradeoffs. ; We may choose to adopt this one in future revisions of the grammar. @@ -595,7 +595,7 @@ token = keyword / identifier / atomic-literal / package-name - / formatted-string + / format-string / annotation-name / symbol @@ -936,8 +936,8 @@ assignment-statement = expression assignment-operator expression ";" ; The call may be an assertion or a print command. ; The former takes an expression (which must be boolean) as argument. ; The latter takes either no argument, -; or a formatted string followed by expressions, -; whose number must match the number of containers '{}' in the formatted string. +; or a format string followed by expressions, +; whose number must match the number of containers '{}' in the format string. ; Note that the console function names are identifiers, not keywords. ; There are three kinds of print commands. @@ -950,7 +950,7 @@ assert-call = %s"assert" "(" expression ")" print-function = %s"debug" / %s"error" / %s"log" -print-arguments = "(" [ formatted-string *( "," expression ) ] ")" +print-arguments = "(" [ format-string *( "," expression ) ] ")" print-call = print-function print-arguments diff --git a/parser/src/parser/statement.rs b/parser/src/parser/statement.rs index 002cc0363a..0392c58cab 100644 --- a/parser/src/parser/statement.rs +++ b/parser/src/parser/statement.rs @@ -222,13 +222,13 @@ impl ParserContext { } /// - /// Returns a [`FormattedString`] AST node if the next tokens represent a formatted string. + /// Returns a [`FormatString`] AST node if the next tokens represent a formatted string. /// - pub fn parse_formatted_string(&mut self) -> SyntaxResult { + pub fn parse_formatted_string(&mut self) -> SyntaxResult { let start_span; let parts = match self.expect_any()? { SpannedToken { - token: Token::FormattedString(parts), + token: Token::FormatString(parts), span, } => { start_span = span; @@ -242,12 +242,12 @@ impl ParserContext { parameters.push(param); } - Ok(FormattedString { + Ok(FormatString { parts: parts .into_iter() .map(|x| match x { - crate::FormattedStringPart::Const(value) => FormattedStringPart::Const(value), - crate::FormattedStringPart::Container => FormattedStringPart::Container, + crate::FormatStringPart::Const(value) => FormatStringPart::Const(value), + crate::FormatStringPart::Container => FormatStringPart::Container, }) .collect(), span: &start_span + parameters.last().map(|x| x.span()).unwrap_or(&start_span), diff --git a/parser/src/tokenizer/lexer.rs b/parser/src/tokenizer/lexer.rs index a706e60881..404e3c1b00 100644 --- a/parser/src/tokenizer/lexer.rs +++ b/parser/src/tokenizer/lexer.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::tokenizer::{FormattedStringPart, Token}; +use crate::tokenizer::{FormatStringPart, Token}; use leo_ast::Span; use serde::{Deserialize, Serialize}; use tendril::StrTendril; @@ -125,11 +125,11 @@ impl Token { continue; } if start < i { - segments.push(FormattedStringPart::Const( + segments.push(FormatStringPart::Const( input_tendril.subtendril(start as u32, (i - start) as u32), )); } - segments.push(FormattedStringPart::Container); + segments.push(FormatStringPart::Container); start = i + 2; i = start; continue; @@ -143,11 +143,11 @@ impl Token { return (0, None); } if start < i { - segments.push(FormattedStringPart::Const( + segments.push(FormatStringPart::Const( input_tendril.subtendril(start as u32, (i - start) as u32), )); } - return (i + 1, Some(Token::FormattedString(segments))); + return (i + 1, Some(Token::FormatString(segments))); } x if x.is_ascii_digit() => { return Self::eat_integer(&input_tendril); diff --git a/parser/src/tokenizer/token.rs b/parser/src/tokenizer/token.rs index f40098e162..f5359e83ec 100644 --- a/parser/src/tokenizer/token.rs +++ b/parser/src/tokenizer/token.rs @@ -20,16 +20,16 @@ use tendril::StrTendril; /// Parts of a formatted string for logging to the console. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum FormattedStringPart { +pub enum FormatStringPart { Const(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), Container, } -impl fmt::Display for FormattedStringPart { +impl fmt::Display for FormatStringPart { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - FormattedStringPart::Const(c) => write!(f, "{}", c), - FormattedStringPart::Container => write!(f, "{{}}"), + FormatStringPart::Const(c) => write!(f, "{}", c), + FormatStringPart::Container => write!(f, "{{}}"), } } } @@ -41,7 +41,7 @@ pub enum Token { // Literals CommentLine(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), CommentBlock(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), - FormattedString(Vec), + FormatString(Vec), Ident(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), Int(#[serde(with = "leo_ast::common::tendril_json")] StrTendril), True, @@ -204,7 +204,7 @@ impl fmt::Display for Token { match self { CommentLine(s) => write!(f, "{}", s), CommentBlock(s) => write!(f, "{}", s), - FormattedString(parts) => { + FormatString(parts) => { // todo escapes write!(f, "\"")?; for part in parts.iter() { From 124235c15d8b9dd2fe34b4fca90c8abbcc9b93ff Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 16:17:57 -0400 Subject: [PATCH 12/30] remove cast-expression from abnf for now --- grammar/abnf-grammar.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index b6ae85971e..834cece5a3 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -802,18 +802,13 @@ unary-expression = postfix-expression / "!" unary-expression / "-" unary-expression -; Next in the operator precedence is casting. - -cast-expression = unary-expression - / cast-expression %s"as" type - ; Next in the operator precedence is exponentiation, ; following mathematical practice. ; The current rule below makes exponentiation left-associative, ; i.e. 'a ** b ** c' must be parsed as '(a ** b) ** c'. -exponential-expression = cast-expression - / cast-expression "**" exponential-expression +exponential-expression = unary-expression + / unary-expression "**" exponential-expression ; Next in precedence come multiplication and division, both left-associative. From bd9297499ed5e4991842799cf11bda5950a3b22f Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 16:19:55 -0400 Subject: [PATCH 13/30] trailing comma in circuit construction expression --- grammar/abnf-grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index 834cece5a3..e6995cd1e7 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -756,7 +756,7 @@ array-expression = array-construction ; so they are syntactically identical but semantically different. circuit-construction = circuit-type "{" - circuit-inline-element *( "," circuit-inline-element ) + circuit-inline-element *( "," circuit-inline-element ) [ "," ] "}" circuit-inline-element = identifier ":" expression / identifier From 1803925b08a37cf7971aed50aa88f637003339f9 Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 16:59:07 -0400 Subject: [PATCH 14/30] semi-colon after return statements are required --- asg/src/prelude.rs | 2 +- .../fail/circuits/member_function_fail.leo | 2 +- .../fail/circuits/member_function_invalid.leo | 2 +- .../member_static_function_invalid.leo | 2 +- .../member_static_function_undefined.leo | 2 +- asg/tests/fail/circuits/mod.rs | 2 +- .../fail/circuits/self_member_invalid.leo | 2 +- .../fail/circuits/self_member_undefined.leo | 2 +- .../fail/function/multiple_returns_fail.leo | 6 +- .../multiple_returns_fail_conditional.leo | 4 +- .../multiple_returns_input_ambiguous.leo | 4 +- asg/tests/fail/function/scope_fail.leo | 2 +- .../fail/statements/num_returns_fail.leo | 2 +- asg/tests/pass/array/registers.leo | 2 +- asg/tests/pass/boolean/output_register.leo | 2 +- asg/tests/pass/circuits/member_function.leo | 2 +- .../pass/circuits/member_function_nested.leo | 4 +- .../pass/circuits/member_static_function.leo | 2 +- .../circuits/member_variable_and_function.leo | 2 +- asg/tests/pass/circuits/mod.rs | 2 +- asg/tests/pass/circuits/pedersen_mock.leo | 4 +- asg/tests/pass/circuits/self_circuit.leo | 2 +- asg/tests/pass/circuits/self_member.leo | 2 +- asg/tests/pass/core/blake2s_input.leo | 2 +- asg/tests/pass/form_ast.rs | 4 +- asg/tests/pass/function/iteration.leo | 2 +- .../pass/function/iteration_repeated.leo | 2 +- asg/tests/pass/function/mod.rs | 4 +- asg/tests/pass/function/multiple_returns.leo | 2 +- .../pass/function/multiple_returns_main.leo | 2 +- asg/tests/pass/function/newlines.leo | 2 +- asg/tests/pass/function/repeated.leo | 2 +- asg/tests/pass/function/return.leo | 2 +- .../function/return_array_nested_pass.leo | 4 +- .../pass/function/return_array_tuple_pass.leo | 4 +- asg/tests/pass/function/return_tuple.leo | 2 +- .../function/return_tuple_conditional.leo | 4 +- asg/tests/pass/import/src/test-import.leo | 2 +- asg/tests/pass/mutability/swap.leo | 2 +- .../conditional/multiple_returns.leo | 4 +- asg/tests/pass/tuples/function.leo | 2 +- asg/tests/pass/tuples/function_multiple.leo | 2 +- asg/tests/pass/tuples/function_typed.leo | 2 +- compiler/tests/array/registers.leo | 2 +- compiler/tests/boolean/output_register.leo | 2 +- .../big_self_in_circuit_replacement.leo | 2 +- .../big_self_outside_circuit_fail.leo | 2 +- .../canonicalization/compound_assignment.leo | 2 +- .../tests/circuits/const_self_variable.leo | 2 +- .../tests/circuits/duplicate_name_context.leo | 2 +- .../tests/circuits/inline_member_pass.leo | 2 +- compiler/tests/circuits/member_function.leo | 2 +- .../tests/circuits/member_function_fail.leo | 2 +- .../circuits/member_function_invalid.leo | 2 +- .../tests/circuits/member_function_nested.leo | 4 +- .../tests/circuits/member_static_function.leo | 2 +- .../member_static_function_invalid.leo | 2 +- .../member_static_function_undefined.leo | 2 +- .../circuits/member_variable_and_function.leo | 2 +- .../mutable_call_immutable_context.leo | 2 +- compiler/tests/circuits/pedersen_mock.leo | 4 +- compiler/tests/circuits/self_circuit.leo | 2 +- compiler/tests/circuits/self_member.leo | 2 +- .../tests/circuits/self_member_invalid.leo | 2 +- .../tests/circuits/self_member_undefined.leo | 2 +- .../unstable/blake2s/blake2s_input.leo | 2 +- compiler/tests/field/output_register.leo | 2 +- .../tests/function/conditional_return.leo | 4 +- compiler/tests/function/iteration.leo | 2 +- .../tests/function/iteration_repeated.leo | 2 +- compiler/tests/function/multiple_returns.leo | 2 +- .../tests/function/multiple_returns_fail.leo | 6 +- .../multiple_returns_fail_conditional.leo | 4 +- .../tests/function/multiple_returns_main.leo | 2 +- compiler/tests/function/newlines.leo | 2 +- compiler/tests/function/repeated.leo | 2 +- compiler/tests/function/return.leo | 2 +- .../function/return_array_nested_fail.leo | 2 +- .../function/return_array_nested_pass.leo | 4 +- .../function/return_array_tuple_fail.leo | 2 +- .../function/return_array_tuple_pass.leo | 4 +- compiler/tests/function/return_tuple.leo | 2 +- .../function/return_tuple_conditional.leo | 4 +- compiler/tests/function/scope_fail.leo | 2 +- compiler/tests/import/src/test-import.leo | 2 +- .../program_registers/registers_array.leo | 2 +- .../program_registers/registers_fail.leo | 2 +- .../program_registers/registers_pass.leo | 2 +- compiler/tests/mutability/swap.leo | 2 +- .../statements/conditional/cond_switch.leo | 6 +- .../conditional/multiple_returns.leo | 4 +- .../tests/statements/num_returns_fail.leo | 2 +- compiler/tests/syntax/undefined.leo | 2 +- compiler/tests/tuples/function.leo | 2 +- compiler/tests/tuples/function_multiple.leo | 2 +- compiler/tests/tuples/function_typed.leo | 2 +- examples/hello-world/src/main.leo | 2 +- examples/pedersen-hash/src/main.leo | 6 +- examples/silly-sudoku/src/lib.leo | 2 +- examples/silly-sudoku/src/main.leo | 2 +- grammar/abnf-grammar.txt | 2 +- parser/benches/big_circuit.leo | 2 +- parser/benches/big_if_else.leo | 384 ++++++++--------- parser/benches/big_ternary.leo | 2 +- parser/benches/long_array.leo | 2 +- parser/benches/long_expr.leo | 2 +- parser/benches/many_assigns.leo | 2 +- parser/benches/many_foos.leo | 386 +++++++++--------- parser/src/parser/statement.rs | 2 +- .../tests/serialization/deprecated_error.leo | 2 +- parser/tests/serialization/main.leo | 2 +- tests/old/fail/circuits/self_circuit.leo | 2 +- tests/old/pass/array/registers.leo | 2 +- tests/old/pass/boolean/output_register.leo | 2 +- .../pass/circuits/duplicate_name_context.leo | 2 +- .../old/pass/circuits/inline_member_pass.leo | 2 +- tests/old/pass/circuits/member_function.leo | 2 +- .../pass/circuits/member_function_fail.leo | 2 +- .../pass/circuits/member_function_invalid.leo | 2 +- .../pass/circuits/member_function_nested.leo | 4 +- .../pass/circuits/member_static_function.leo | 2 +- .../member_static_function_invalid.leo | 2 +- .../member_static_function_undefined.leo | 2 +- .../circuits/member_variable_and_function.leo | 2 +- tests/old/pass/circuits/pedersen_mock.leo | 4 +- tests/old/pass/circuits/self_member.leo | 2 +- .../old/pass/circuits/self_member_invalid.leo | 2 +- .../pass/circuits/self_member_undefined.leo | 2 +- tests/old/pass/core/blake2s_input.leo | 2 +- .../old/pass/function/conditional_return.leo | 4 +- tests/old/pass/function/iteration.leo | 2 +- .../old/pass/function/iteration_repeated.leo | 2 +- tests/old/pass/function/multiple_returns.leo | 2 +- .../pass/function/multiple_returns_fail.leo | 6 +- .../multiple_returns_fail_conditional.leo | 4 +- .../pass/function/multiple_returns_main.leo | 2 +- tests/old/pass/function/newlines.leo | 2 +- tests/old/pass/function/repeated.leo | 2 +- tests/old/pass/function/return.leo | 2 +- .../function/return_array_nested_fail.leo | 2 +- .../function/return_array_nested_pass.leo | 4 +- .../pass/function/return_array_tuple_fail.leo | 2 +- .../pass/function/return_array_tuple_pass.leo | 4 +- tests/old/pass/function/return_tuple.leo | 2 +- .../function/return_tuple_conditional.leo | 4 +- tests/old/pass/function/scope_fail.leo | 2 +- tests/old/pass/import/test-import.leo | 2 +- tests/old/pass/mutability/swap.leo | 2 +- .../old/pass/statements/multiple_returns.leo | 4 +- .../old/pass/statements/num_returns_fail.leo | 2 +- tests/old/pass/syntax/undefined.leo | 2 +- tests/old/pass/tuples/function.leo | 2 +- tests/old/pass/tuples/function_multiple.leo | 2 +- tests/old/pass/tuples/function_typed.leo | 2 +- 154 files changed, 573 insertions(+), 573 deletions(-) diff --git a/asg/src/prelude.rs b/asg/src/prelude.rs index e977fd137f..d4a2faffbc 100644 --- a/asg/src/prelude.rs +++ b/asg/src/prelude.rs @@ -29,7 +29,7 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result< r#" circuit Blake2s { function hash(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return [0; 32] + return [0; 32]; } } "#, diff --git a/asg/tests/fail/circuits/member_function_fail.leo b/asg/tests/fail/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/asg/tests/fail/circuits/member_function_fail.leo +++ b/asg/tests/fail/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_function_invalid.leo b/asg/tests/fail/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/asg/tests/fail/circuits/member_function_invalid.leo +++ b/asg/tests/fail/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_static_function_invalid.leo b/asg/tests/fail/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/asg/tests/fail/circuits/member_static_function_invalid.leo +++ b/asg/tests/fail/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_static_function_undefined.leo b/asg/tests/fail/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/asg/tests/fail/circuits/member_static_function_undefined.leo +++ b/asg/tests/fail/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/mod.rs b/asg/tests/fail/circuits/mod.rs index 38f1824755..4d343b25a0 100644 --- a/asg/tests/fail/circuits/mod.rs +++ b/asg/tests/fail/circuits/mod.rs @@ -55,7 +55,7 @@ fn test_mut_member_function_fail() { let program_string = r#" circuit Foo { function echo(mut self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/self_member_invalid.leo b/asg/tests/fail/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/asg/tests/fail/circuits/self_member_invalid.leo +++ b/asg/tests/fail/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/asg/tests/fail/circuits/self_member_undefined.leo b/asg/tests/fail/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/asg/tests/fail/circuits/self_member_undefined.leo +++ b/asg/tests/fail/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/asg/tests/fail/function/multiple_returns_fail.leo b/asg/tests/fail/function/multiple_returns_fail.leo index d4a8b36eac..daa773f2e8 100644 --- a/asg/tests/fail/function/multiple_returns_fail.leo +++ b/asg/tests/fail/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored } - return 2i8 //ignored - return 3i8 //returns + return 2i8; //ignored + return 3i8; //returns } \ No newline at end of file diff --git a/asg/tests/fail/function/multiple_returns_fail_conditional.leo b/asg/tests/fail/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/asg/tests/fail/function/multiple_returns_fail_conditional.leo +++ b/asg/tests/fail/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/asg/tests/fail/function/multiple_returns_input_ambiguous.leo b/asg/tests/fail/function/multiple_returns_input_ambiguous.leo index 234375349b..363408e61e 100644 --- a/asg/tests/fail/function/multiple_returns_input_ambiguous.leo +++ b/asg/tests/fail/function/multiple_returns_input_ambiguous.leo @@ -1,7 +1,7 @@ function main(input) -> u32 { if input.registers.a == 0 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/asg/tests/fail/function/scope_fail.leo b/asg/tests/fail/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/asg/tests/fail/function/scope_fail.leo +++ b/asg/tests/fail/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/asg/tests/fail/statements/num_returns_fail.leo b/asg/tests/fail/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/asg/tests/fail/statements/num_returns_fail.leo +++ b/asg/tests/fail/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/asg/tests/pass/array/registers.leo b/asg/tests/pass/array/registers.leo index ab4107d46c..86836ff96b 100644 --- a/asg/tests/pass/array/registers.leo +++ b/asg/tests/pass/array/registers.leo @@ -1,3 +1,3 @@ function main() -> [u8; 3] { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/asg/tests/pass/boolean/output_register.leo b/asg/tests/pass/boolean/output_register.leo index 8237614fa7..5af8daff4f 100644 --- a/asg/tests/pass/boolean/output_register.leo +++ b/asg/tests/pass/boolean/output_register.leo @@ -1,3 +1,3 @@ function main() -> bool { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/asg/tests/pass/circuits/member_function.leo b/asg/tests/pass/circuits/member_function.leo index 4e50e97195..b7879b5bf7 100644 --- a/asg/tests/pass/circuits/member_function.leo +++ b/asg/tests/pass/circuits/member_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/member_function_nested.leo b/asg/tests/pass/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/asg/tests/pass/circuits/member_function_nested.leo +++ b/asg/tests/pass/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/asg/tests/pass/circuits/member_static_function.leo b/asg/tests/pass/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/asg/tests/pass/circuits/member_static_function.leo +++ b/asg/tests/pass/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/member_variable_and_function.leo b/asg/tests/pass/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/asg/tests/pass/circuits/member_variable_and_function.leo +++ b/asg/tests/pass/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/asg/tests/pass/circuits/mod.rs b/asg/tests/pass/circuits/mod.rs index ee2315b6f7..9936d9877d 100644 --- a/asg/tests/pass/circuits/mod.rs +++ b/asg/tests/pass/circuits/mod.rs @@ -49,7 +49,7 @@ fn test_mut_member_function() { let program_string = r#" circuit Foo { function echo(mut self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/pedersen_mock.leo b/asg/tests/pass/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/asg/tests/pass/circuits/pedersen_mock.leo +++ b/asg/tests/pass/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/asg/tests/pass/circuits/self_circuit.leo b/asg/tests/pass/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/asg/tests/pass/circuits/self_circuit.leo +++ b/asg/tests/pass/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/asg/tests/pass/circuits/self_member.leo b/asg/tests/pass/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/asg/tests/pass/circuits/self_member.leo +++ b/asg/tests/pass/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/asg/tests/pass/core/blake2s_input.leo b/asg/tests/pass/core/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/asg/tests/pass/core/blake2s_input.leo +++ b/asg/tests/pass/core/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/asg/tests/pass/form_ast.rs b/asg/tests/pass/form_ast.rs index 3a012d9e14..dfb72639b9 100644 --- a/asg/tests/pass/form_ast.rs +++ b/asg/tests/pass/form_ast.rs @@ -36,7 +36,7 @@ fn test_function_rename() { a += 1; } - return a + return a; } function main() { @@ -63,7 +63,7 @@ fn test_imports() { } function foo() -> u32 { - return 1u32 + return 1u32; } "#; imports diff --git a/asg/tests/pass/function/iteration.leo b/asg/tests/pass/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/asg/tests/pass/function/iteration.leo +++ b/asg/tests/pass/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/asg/tests/pass/function/iteration_repeated.leo b/asg/tests/pass/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/asg/tests/pass/function/iteration_repeated.leo +++ b/asg/tests/pass/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/asg/tests/pass/function/mod.rs b/asg/tests/pass/function/mod.rs index 3ae7434608..fa32b1c99e 100644 --- a/asg/tests/pass/function/mod.rs +++ b/asg/tests/pass/function/mod.rs @@ -32,7 +32,7 @@ fn test_iteration() { fn test_const_args() { let program_string = r#" function one(const value: u32) -> u32 { - return value + 1 + return value + 1; } function main() { @@ -52,7 +52,7 @@ fn test_const_args() { fn test_const_args_used() { let program_string = r#" function index(arr: [u8; 3], const value: u32) -> u8 { - return arr[value] + return arr[value]; } function main() { diff --git a/asg/tests/pass/function/multiple_returns.leo b/asg/tests/pass/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/asg/tests/pass/function/multiple_returns.leo +++ b/asg/tests/pass/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/function/multiple_returns_main.leo b/asg/tests/pass/function/multiple_returns_main.leo index 69a2b32232..1dc086ee80 100644 --- a/asg/tests/pass/function/multiple_returns_main.leo +++ b/asg/tests/pass/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return (input.registers.a, input.registers.b) + return (input.registers.a, input.registers.b); } \ No newline at end of file diff --git a/asg/tests/pass/function/newlines.leo b/asg/tests/pass/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/asg/tests/pass/function/newlines.leo +++ b/asg/tests/pass/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/asg/tests/pass/function/repeated.leo b/asg/tests/pass/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/asg/tests/pass/function/repeated.leo +++ b/asg/tests/pass/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/asg/tests/pass/function/return.leo b/asg/tests/pass/function/return.leo index 10c7138977..e839700ee3 100644 --- a/asg/tests/pass/function/return.leo +++ b/asg/tests/pass/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/asg/tests/pass/function/return_array_nested_pass.leo b/asg/tests/pass/function/return_array_nested_pass.leo index bfbfc8fd29..c7586f3f08 100644 --- a/asg/tests/pass/function/return_array_nested_pass.leo +++ b/asg/tests/pass/function/return_array_nested_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/asg/tests/pass/function/return_array_tuple_pass.leo b/asg/tests/pass/function/return_array_tuple_pass.leo index 4199e31990..6f5a63e806 100644 --- a/asg/tests/pass/function/return_array_tuple_pass.leo +++ b/asg/tests/pass/function/return_array_tuple_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/asg/tests/pass/function/return_tuple.leo b/asg/tests/pass/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/asg/tests/pass/function/return_tuple.leo +++ b/asg/tests/pass/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/asg/tests/pass/function/return_tuple_conditional.leo b/asg/tests/pass/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/asg/tests/pass/function/return_tuple_conditional.leo +++ b/asg/tests/pass/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/asg/tests/pass/import/src/test-import.leo b/asg/tests/pass/import/src/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/asg/tests/pass/import/src/test-import.leo +++ b/asg/tests/pass/import/src/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/asg/tests/pass/mutability/swap.leo b/asg/tests/pass/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/asg/tests/pass/mutability/swap.leo +++ b/asg/tests/pass/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/asg/tests/pass/statements/conditional/multiple_returns.leo b/asg/tests/pass/statements/conditional/multiple_returns.leo index 0a6b599681..f2b9e499c2 100644 --- a/asg/tests/pass/statements/conditional/multiple_returns.leo +++ b/asg/tests/pass/statements/conditional/multiple_returns.leo @@ -1,7 +1,7 @@ function main() -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/asg/tests/pass/tuples/function.leo b/asg/tests/pass/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/asg/tests/pass/tuples/function.leo +++ b/asg/tests/pass/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/tuples/function_multiple.leo b/asg/tests/pass/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/asg/tests/pass/tuples/function_multiple.leo +++ b/asg/tests/pass/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/tuples/function_typed.leo b/asg/tests/pass/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/asg/tests/pass/tuples/function_typed.leo +++ b/asg/tests/pass/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/array/registers.leo b/compiler/tests/array/registers.leo index ab4107d46c..86836ff96b 100644 --- a/compiler/tests/array/registers.leo +++ b/compiler/tests/array/registers.leo @@ -1,3 +1,3 @@ function main() -> [u8; 3] { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/compiler/tests/boolean/output_register.leo b/compiler/tests/boolean/output_register.leo index 8237614fa7..5af8daff4f 100644 --- a/compiler/tests/boolean/output_register.leo +++ b/compiler/tests/boolean/output_register.leo @@ -1,3 +1,3 @@ function main() -> bool { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo index f8b2657a70..4081e46cbf 100644 --- a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo +++ b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo @@ -6,7 +6,7 @@ circuit Foo { x: 1u32 }; - return new + return new; } } diff --git a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo index d1f30e8470..6f5100adde 100644 --- a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo +++ b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo @@ -6,7 +6,7 @@ circuit Foo { x: 1u32 }; - return new + return new; } } diff --git a/compiler/tests/canonicalization/compound_assignment.leo b/compiler/tests/canonicalization/compound_assignment.leo index d8ec55ba79..224cc18cd4 100644 --- a/compiler/tests/canonicalization/compound_assignment.leo +++ b/compiler/tests/canonicalization/compound_assignment.leo @@ -4,7 +4,7 @@ circuit Foo { function z (mut self) -> u16 { self.y.0 += 1u8; - return 1u16 + return 1u16; } } function main() { diff --git a/compiler/tests/circuits/const_self_variable.leo b/compiler/tests/circuits/const_self_variable.leo index ebcc3076ae..8ba32ba0df 100644 --- a/compiler/tests/circuits/const_self_variable.leo +++ b/compiler/tests/circuits/const_self_variable.leo @@ -2,7 +2,7 @@ circuit Foo { a: u8, function use_a(const self) -> u8 { - return self.a + 1 + return self.a + 1; } } diff --git a/compiler/tests/circuits/duplicate_name_context.leo b/compiler/tests/circuits/duplicate_name_context.leo index 66640e75a2..8644d27fcb 100644 --- a/compiler/tests/circuits/duplicate_name_context.leo +++ b/compiler/tests/circuits/duplicate_name_context.leo @@ -2,7 +2,7 @@ circuit Bar { b2: u32 function add_five(z:u32) -> u32 { - return z+5u32 + return z+5u32; } } diff --git a/compiler/tests/circuits/inline_member_pass.leo b/compiler/tests/circuits/inline_member_pass.leo index 8e58e4935a..6fd7f7dff7 100644 --- a/compiler/tests/circuits/inline_member_pass.leo +++ b/compiler/tests/circuits/inline_member_pass.leo @@ -2,7 +2,7 @@ circuit Foo { x: u8 function new(x: u8) -> Self { - return Self { x } + return Self { x }; } } diff --git a/compiler/tests/circuits/member_function.leo b/compiler/tests/circuits/member_function.leo index 258b6c675e..eee44be448 100644 --- a/compiler/tests/circuits/member_function.leo +++ b/compiler/tests/circuits/member_function.leo @@ -2,7 +2,7 @@ circuit Foo { x: u32, function echo(self) -> u32 { - return self.x + return self.x; } } diff --git a/compiler/tests/circuits/member_function_fail.leo b/compiler/tests/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/compiler/tests/circuits/member_function_fail.leo +++ b/compiler/tests/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_function_invalid.leo b/compiler/tests/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/compiler/tests/circuits/member_function_invalid.leo +++ b/compiler/tests/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_function_nested.leo b/compiler/tests/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/compiler/tests/circuits/member_function_nested.leo +++ b/compiler/tests/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/compiler/tests/circuits/member_static_function.leo b/compiler/tests/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/compiler/tests/circuits/member_static_function.leo +++ b/compiler/tests/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_static_function_invalid.leo b/compiler/tests/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/compiler/tests/circuits/member_static_function_invalid.leo +++ b/compiler/tests/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_static_function_undefined.leo b/compiler/tests/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/compiler/tests/circuits/member_static_function_undefined.leo +++ b/compiler/tests/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_variable_and_function.leo b/compiler/tests/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/compiler/tests/circuits/member_variable_and_function.leo +++ b/compiler/tests/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/compiler/tests/circuits/mutable_call_immutable_context.leo b/compiler/tests/circuits/mutable_call_immutable_context.leo index d68e1866c5..91aac73011 100644 --- a/compiler/tests/circuits/mutable_call_immutable_context.leo +++ b/compiler/tests/circuits/mutable_call_immutable_context.leo @@ -3,7 +3,7 @@ circuit TestMe { function test_me(mut self) -> u8 { self.x += 1; - return self.x + return self.x; } } diff --git a/compiler/tests/circuits/pedersen_mock.leo b/compiler/tests/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/compiler/tests/circuits/pedersen_mock.leo +++ b/compiler/tests/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/compiler/tests/circuits/self_circuit.leo b/compiler/tests/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/compiler/tests/circuits/self_circuit.leo +++ b/compiler/tests/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/compiler/tests/circuits/self_member.leo b/compiler/tests/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/compiler/tests/circuits/self_member.leo +++ b/compiler/tests/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/compiler/tests/circuits/self_member_invalid.leo b/compiler/tests/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/compiler/tests/circuits/self_member_invalid.leo +++ b/compiler/tests/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/compiler/tests/circuits/self_member_undefined.leo b/compiler/tests/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/compiler/tests/circuits/self_member_undefined.leo +++ b/compiler/tests/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo b/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo +++ b/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/compiler/tests/field/output_register.leo b/compiler/tests/field/output_register.leo index 258a6f2c74..e27a3947bd 100644 --- a/compiler/tests/field/output_register.leo +++ b/compiler/tests/field/output_register.leo @@ -1,3 +1,3 @@ function main(registers) -> field { - return registers.r + return registers.r; } \ No newline at end of file diff --git a/compiler/tests/function/conditional_return.leo b/compiler/tests/function/conditional_return.leo index 7ecd0e625c..e27dd7aea5 100644 --- a/compiler/tests/function/conditional_return.leo +++ b/compiler/tests/function/conditional_return.leo @@ -1,7 +1,7 @@ function main(x: u8) -> u8 { if x == 2u8 { - return 3u8 + return 3u8; } else { - return 4u8 + return 4u8; } } \ No newline at end of file diff --git a/compiler/tests/function/iteration.leo b/compiler/tests/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/compiler/tests/function/iteration.leo +++ b/compiler/tests/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/compiler/tests/function/iteration_repeated.leo b/compiler/tests/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/compiler/tests/function/iteration_repeated.leo +++ b/compiler/tests/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/compiler/tests/function/multiple_returns.leo b/compiler/tests/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/compiler/tests/function/multiple_returns.leo +++ b/compiler/tests/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/function/multiple_returns_fail.leo b/compiler/tests/function/multiple_returns_fail.leo index d4a8b36eac..a8e6e896fd 100644 --- a/compiler/tests/function/multiple_returns_fail.leo +++ b/compiler/tests/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored; } - return 2i8 //ignored - return 3i8 //returns + return 2i8; //ignored; + return 3i8; //returns; } \ No newline at end of file diff --git a/compiler/tests/function/multiple_returns_fail_conditional.leo b/compiler/tests/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/compiler/tests/function/multiple_returns_fail_conditional.leo +++ b/compiler/tests/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/compiler/tests/function/multiple_returns_main.leo b/compiler/tests/function/multiple_returns_main.leo index 69a2b32232..1dc086ee80 100644 --- a/compiler/tests/function/multiple_returns_main.leo +++ b/compiler/tests/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return (input.registers.a, input.registers.b) + return (input.registers.a, input.registers.b); } \ No newline at end of file diff --git a/compiler/tests/function/newlines.leo b/compiler/tests/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/compiler/tests/function/newlines.leo +++ b/compiler/tests/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/compiler/tests/function/repeated.leo b/compiler/tests/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/compiler/tests/function/repeated.leo +++ b/compiler/tests/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/compiler/tests/function/return.leo b/compiler/tests/function/return.leo index 10c7138977..e839700ee3 100644 --- a/compiler/tests/function/return.leo +++ b/compiler/tests/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/compiler/tests/function/return_array_nested_fail.leo b/compiler/tests/function/return_array_nested_fail.leo index 8eca684b8a..0db89a09e3 100644 --- a/compiler/tests/function/return_array_nested_fail.leo +++ b/compiler/tests/function/return_array_nested_fail.leo @@ -1,5 +1,5 @@ function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (2, 3)] // The correct 3x2 array tuple is `[0u8; (3, 2)]` + return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]` } function main() { diff --git a/compiler/tests/function/return_array_nested_pass.leo b/compiler/tests/function/return_array_nested_pass.leo index bfbfc8fd29..c7586f3f08 100644 --- a/compiler/tests/function/return_array_nested_pass.leo +++ b/compiler/tests/function/return_array_nested_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/compiler/tests/function/return_array_tuple_fail.leo b/compiler/tests/function/return_array_tuple_fail.leo index c960456ac1..d2afcd2790 100644 --- a/compiler/tests/function/return_array_tuple_fail.leo +++ b/compiler/tests/function/return_array_tuple_fail.leo @@ -1,5 +1,5 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 3]; 2] // The correct 3x2 nested array is `[0u8; 2]; 3]` + return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]` } function main() { diff --git a/compiler/tests/function/return_array_tuple_pass.leo b/compiler/tests/function/return_array_tuple_pass.leo index 4199e31990..6f5a63e806 100644 --- a/compiler/tests/function/return_array_tuple_pass.leo +++ b/compiler/tests/function/return_array_tuple_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/compiler/tests/function/return_tuple.leo b/compiler/tests/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/compiler/tests/function/return_tuple.leo +++ b/compiler/tests/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/compiler/tests/function/return_tuple_conditional.leo b/compiler/tests/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/compiler/tests/function/return_tuple_conditional.leo +++ b/compiler/tests/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/compiler/tests/function/scope_fail.leo b/compiler/tests/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/compiler/tests/function/scope_fail.leo +++ b/compiler/tests/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/compiler/tests/import/src/test-import.leo b/compiler/tests/import/src/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/compiler/tests/import/src/test-import.leo +++ b/compiler/tests/import/src/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_array.leo b/compiler/tests/input_files/program_registers/registers_array.leo index 708fa0ea61..324515c13f 100644 --- a/compiler/tests/input_files/program_registers/registers_array.leo +++ b/compiler/tests/input_files/program_registers/registers_array.leo @@ -1,3 +1,3 @@ function main () -> [[u8; 4]; 2] { - return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]] + return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]]; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_fail.leo b/compiler/tests/input_files/program_registers/registers_fail.leo index 221958dbd9..78af2bb5d8 100644 --- a/compiler/tests/input_files/program_registers/registers_fail.leo +++ b/compiler/tests/input_files/program_registers/registers_fail.leo @@ -1,3 +1,3 @@ function main() -> bool { - return false + return false; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_pass.leo b/compiler/tests/input_files/program_registers/registers_pass.leo index ce0dbcb130..ff5ef4a0cd 100644 --- a/compiler/tests/input_files/program_registers/registers_pass.leo +++ b/compiler/tests/input_files/program_registers/registers_pass.leo @@ -1,3 +1,3 @@ function main() -> u8 { - return 1u8 + return 1u8; } \ No newline at end of file diff --git a/compiler/tests/mutability/swap.leo b/compiler/tests/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/compiler/tests/mutability/swap.leo +++ b/compiler/tests/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/compiler/tests/statements/conditional/cond_switch.leo b/compiler/tests/statements/conditional/cond_switch.leo index 7b7845cde3..6f2228635b 100644 --- a/compiler/tests/statements/conditional/cond_switch.leo +++ b/compiler/tests/statements/conditional/cond_switch.leo @@ -1,9 +1,9 @@ function main (x: bool) -> bool { if false { - return x + return x; } else if x { - return false + return false; } else { - return false + return false; } } \ No newline at end of file diff --git a/compiler/tests/statements/conditional/multiple_returns.leo b/compiler/tests/statements/conditional/multiple_returns.leo index 0a6b599681..f2b9e499c2 100644 --- a/compiler/tests/statements/conditional/multiple_returns.leo +++ b/compiler/tests/statements/conditional/multiple_returns.leo @@ -1,7 +1,7 @@ function main() -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/compiler/tests/statements/num_returns_fail.leo b/compiler/tests/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/compiler/tests/statements/num_returns_fail.leo +++ b/compiler/tests/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/compiler/tests/syntax/undefined.leo b/compiler/tests/syntax/undefined.leo index 856b07589a..0ab97f6cb0 100644 --- a/compiler/tests/syntax/undefined.leo +++ b/compiler/tests/syntax/undefined.leo @@ -1,3 +1,3 @@ function main() -> bool { - return a + return a; } \ No newline at end of file diff --git a/compiler/tests/tuples/function.leo b/compiler/tests/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/compiler/tests/tuples/function.leo +++ b/compiler/tests/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/tuples/function_multiple.leo b/compiler/tests/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/compiler/tests/tuples/function_multiple.leo +++ b/compiler/tests/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/tuples/function_typed.leo b/compiler/tests/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/compiler/tests/tuples/function_typed.leo +++ b/compiler/tests/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/examples/hello-world/src/main.leo b/examples/hello-world/src/main.leo index f78b77e855..5ce8db73a2 100644 --- a/examples/hello-world/src/main.leo +++ b/examples/hello-world/src/main.leo @@ -1,5 +1,5 @@ // The 'hello-world' main function. function main(a: u32, b: u32) -> u32 { const c: u32 = a + b; - return c + return c; } diff --git a/examples/pedersen-hash/src/main.leo b/examples/pedersen-hash/src/main.leo index 84670cd6c2..030dc0bcb8 100644 --- a/examples/pedersen-hash/src/main.leo +++ b/examples/pedersen-hash/src/main.leo @@ -3,7 +3,7 @@ circuit PedersenHash { // Instantiates a Pedersen hash circuit function new(parameters: [group; 256]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 256]) -> group { @@ -13,13 +13,13 @@ circuit PedersenHash { digest += self.parameters[i]; } } - return digest + return digest; } } // The 'pedersen-hash' main function. function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { const pedersen = PedersenHash::new(parameters); - return pedersen.hash(hash_input) + return pedersen.hash(hash_input); } diff --git a/examples/silly-sudoku/src/lib.leo b/examples/silly-sudoku/src/lib.leo index 0e5c93568e..c1e4922461 100644 --- a/examples/silly-sudoku/src/lib.leo +++ b/examples/silly-sudoku/src/lib.leo @@ -65,6 +65,6 @@ circuit SillySudoku { } // Returns true if all numbers 1-9 have been seen exactly once. - return result + return result; } } diff --git a/examples/silly-sudoku/src/main.leo b/examples/silly-sudoku/src/main.leo index 087acda62d..856bd8892a 100644 --- a/examples/silly-sudoku/src/main.leo +++ b/examples/silly-sudoku/src/main.leo @@ -16,7 +16,7 @@ function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool { console.log("The answer is {}.", result); - return result + return result; } // Tests that the `silly-sudoku` circuit outputs true on a correct answer. diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index e6995cd1e7..a132c98db7 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -885,7 +885,7 @@ expression-statement = expression ";" ; A return statement always takes an expression, ; and does not end with a semicolon. -return-statement = %s"return" expression +return-statement = %s"return" expression ";" ; There are two kinds of variable definition statements, ; which only differ in the starting keyword. diff --git a/parser/benches/big_circuit.leo b/parser/benches/big_circuit.leo index 01d10c2daa..5d2242581c 100644 --- a/parser/benches/big_circuit.leo +++ b/parser/benches/big_circuit.leo @@ -2,7 +2,7 @@ function main() { const foo = Foo { x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, x5: 5, x6: 6, x7: 7, x8: 8, x9: 9, x10: 10, x11: 11, x12: 12, x13: 13, x14: 14, x15: 15, x16: 16, x17: 17, x18: 18, x19: 19, x20: 20, x21: 21, x22: 22, x23: 23, x24: 24, x25: 25, x26: 26, x27: 27, x28: 28, x29: 29, x30: 30, x31: 31, x32: 32, x33: 33, x34: 34, x35: 35, x36: 36, x37: 37, x38: 38, x39: 39, x40: 40, x41: 41, x42: 42, x43: 43, x44: 44, x45: 45, x46: 46, x47: 47, x48: 48, x49: 49, x50: 50, x51: 51, x52: 52, x53: 53, x54: 54, x55: 55, x56: 56, x57: 57, x58: 58, x59: 59, x60: 60, x61: 61, x62: 62, x63: 63, x64: 64, x65: 65, x66: 66, x67: 67, x68: 68, x69: 69, x70: 70, x71: 71, x72: 72, x73: 73, x74: 74, x75: 75, x76: 76, x77: 77, x78: 78, x79: 79, x80: 80, x81: 81, x82: 82, x83: 83, x84: 84, x85: 85, x86: 86, x87: 87, x88: 88, x89: 89, x90: 90, x91: 91, x92: 92, x93: 93, x94: 94, x95: 95, x96: 96, x97: 97, x98: 98, x99: 99, x100: 100, x101: 101, x102: 102, x103: 103, x104: 104, x105: 105, x106: 106, x107: 107, x108: 108, x109: 109, x110: 110, x111: 111, x112: 112, x113: 113, x114: 114, x115: 115, x116: 116, x117: 117, x118: 118, x119: 119, x120: 120, x121: 121, x122: 122, x123: 123, x124: 124, x125: 125, x126: 126, x127: 127, x128: 128, x129: 129, x130: 130, x131: 131, x132: 132, x133: 133, x134: 134, x135: 135, x136: 136, x137: 137, x138: 138, x139: 139, x140: 140, x141: 141, x142: 142, x143: 143, x144: 144, x145: 145, x146: 146, x147: 147, x148: 148, x149: 149, x150: 150, x151: 151, x152: 152, x153: 153, x154: 154, x155: 155, x156: 156, x157: 157, x158: 158, x159: 159, x160: 160, x161: 161, x162: 162, x163: 163, x164: 164, x165: 165, x166: 166, x167: 167, x168: 168, x169: 169, x170: 170, x171: 171, x172: 172, x173: 173, x174: 174, x175: 175, x176: 176, x177: 177, x178: 178, x179: 179, x180: 180, x181: 181, x182: 182, x183: 183, x184: 184, x185: 185, x186: 186, x187: 187, x188: 188, x189: 189, x190: 190, x191: 191, x192: 192, x193: 193, x194: 194, x195: 195, x196: 196, x197: 197, x198: 198, x199: 199, x200: 200, x201: 201, x202: 202, x203: 203, x204: 204, x205: 205, x206: 206, x207: 207, x208: 208, x209: 209, x210: 210, x211: 211, x212: 212, x213: 213, x214: 214, x215: 215, x216: 216, x217: 217, x218: 218, x219: 219, x220: 220, x221: 221, x222: 222, x223: 223, x224: 224, x225: 225, x226: 226, x227: 227, x228: 228, x229: 229, x230: 230, x231: 231, x232: 232, x233: 233, x234: 234, x235: 235, x236: 236, x237: 237, x238: 238, x239: 239, x240: 240, x241: 241, x242: 242, x243: 243, x244: 244, x245: 245, x246: 246, x247: 247, x248: 248, x249: 249, x250: 250, x251: 251, x252: 252, x253: 253, x254: 254, x255: 255 }; const bar = Foo { x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, x5: 5, x6: 6, x7: 7, x8: 8, x9: 9, x10: 10, x11: 11, x12: 12, x13: 13, x14: 14, x15: 15, x16: 16, x17: 17, x18: 18, x19: 19, x20: 20, x21: 21, x22: 22, x23: 23, x24: 24, x25: 25, x26: 26, x27: 27, x28: 28, x29: 29, x30: 30, x31: 31, x32: 32, x33: 33, x34: 34, x35: 35, x36: 36, x37: 37, x38: 38, x39: 39, x40: 40, x41: 41, x42: 42, x43: 43, x44: 44, x45: 45, x46: 46, x47: 47, x48: 48, x49: 49, x50: 50, x51: 51, x52: 52, x53: 53, x54: 54, x55: 55, x56: 56, x57: 57, x58: 58, x59: 59, x60: 60, x61: 61, x62: 62, x63: 63, x64: 64, x65: 65, x66: 66, x67: 67, x68: 68, x69: 69, x70: 70, x71: 71, x72: 72, x73: 73, x74: 74, x75: 75, x76: 76, x77: 77, x78: 78, x79: 79, x80: 80, x81: 81, x82: 82, x83: 83, x84: 84, x85: 85, x86: 86, x87: 87, x88: 88, x89: 89, x90: 90, x91: 91, x92: 92, x93: 93, x94: 94, x95: 95, x96: 96, x97: 97, x98: 98, x99: 99, x100: 100, x101: 101, x102: 102, x103: 103, x104: 104, x105: 105, x106: 106, x107: 107, x108: 108, x109: 109, x110: 110, x111: 111, x112: 112, x113: 113, x114: 114, x115: 115, x116: 116, x117: 117, x118: 118, x119: 119, x120: 120, x121: 121, x122: 122, x123: 123, x124: 124, x125: 125, x126: 126, x127: 127, x128: 128, x129: 129, x130: 130, x131: 131, x132: 132, x133: 133, x134: 134, x135: 135, x136: 136, x137: 137, x138: 138, x139: 139, x140: 140, x141: 141, x142: 142, x143: 143, x144: 144, x145: 145, x146: 146, x147: 147, x148: 148, x149: 149, x150: 150, x151: 151, x152: 152, x153: 153, x154: 154, x155: 155, x156: 156, x157: 157, x158: 158, x159: 159, x160: 160, x161: 161, x162: 162, x163: 163, x164: 164, x165: 165, x166: 166, x167: 167, x168: 168, x169: 169, x170: 170, x171: 171, x172: 172, x173: 173, x174: 174, x175: 175, x176: 176, x177: 177, x178: 178, x179: 179, x180: 180, x181: 181, x182: 182, x183: 183, x184: 184, x185: 185, x186: 186, x187: 187, x188: 188, x189: 189, x190: 190, x191: 191, x192: 192, x193: 193, x194: 194, x195: 195, x196: 196, x197: 197, x198: 198, x199: 199, x200: 200, x201: 201, x202: 202, x203: 203, x204: 204, x205: 205, x206: 206, x207: 207, x208: 208, x209: 209, x210: 210, x211: 211, x212: 212, x213: 213, x214: 214, x215: 215, x216: 216, x217: 217, x218: 218, x219: 219, x220: 220, x221: 221, x222: 222, x223: 223, x224: 224, x225: 225, x226: 226, x227: 227, x228: 228, x229: 229, x230: 230, x231: 231, x232: 232, x233: 233, x234: 234, x235: 235, x236: 236, x237: 237, x238: 238, x239: 239, x240: 240, x241: 241, x242: 242, x243: 243, x244: 244, x245: 245, x246: 246, x247: 247, x248: 248, x249: 249, x250: 250, x251: 251, x252: 252, x253: 253, x254: 254, x255: 255 }; - return foo.x0 + bar.x255 + return foo.x0 + bar.x255; } circuit Foo { diff --git a/parser/benches/big_if_else.leo b/parser/benches/big_if_else.leo index db0d5f45e8..b00fa9dbb7 100644 --- a/parser/benches/big_if_else.leo +++ b/parser/benches/big_if_else.leo @@ -2,388 +2,388 @@ function main() { const x: u8 = 191; if x == 0 { - return x + return x; } else if x == 1 { - return x - 1 + return x - 1; } else if x == 2 { - return x - 2 + return x - 2; } else if x == 3 { - return x - 3 + return x - 3; } else if x == 4 { - return x - 4 + return x - 4; } else if x == 5 { - return x - 5 + return x - 5; } else if x == 6 { - return x - 6 + return x - 6; } else if x == 7 { - return x - 7 + return x - 7; } else if x == 8 { - return x - 8 + return x - 8; } else if x == 9 { - return x - 9 + return x - 9; } else if x == 10 { - return x - 10 + return x - 10; } else if x == 11 { - return x - 11 + return x - 11; } else if x == 12 { - return x - 12 + return x - 12; } else if x == 13 { - return x - 13 + return x - 13; } else if x == 14 { - return x - 14 + return x - 14; } else if x == 15 { - return x - 15 + return x - 15; } else if x == 16 { - return x - 16 + return x - 16; } else if x == 17 { - return x - 17 + return x - 17; } else if x == 18 { - return x - 18 + return x - 18; } else if x == 19 { - return x - 19 + return x - 19; } else if x == 20 { - return x - 20 + return x - 20; } else if x == 21 { - return x - 21 + return x - 21; } else if x == 22 { - return x - 22 + return x - 22; } else if x == 23 { - return x - 23 + return x - 23; } else if x == 24 { - return x - 24 + return x - 24; } else if x == 25 { - return x - 25 + return x - 25; } else if x == 26 { - return x - 26 + return x - 26; } else if x == 27 { - return x - 27 + return x - 27; } else if x == 28 { - return x - 28 + return x - 28; } else if x == 29 { - return x - 29 + return x - 29; } else if x == 30 { - return x - 30 + return x - 30; } else if x == 31 { - return x - 31 + return x - 31; } else if x == 32 { - return x - 32 + return x - 32; } else if x == 33 { - return x - 33 + return x - 33; } else if x == 34 { - return x - 34 + return x - 34; } else if x == 35 { - return x - 35 + return x - 35; } else if x == 36 { - return x - 36 + return x - 36; } else if x == 37 { - return x - 37 + return x - 37; } else if x == 38 { - return x - 38 + return x - 38; } else if x == 39 { - return x - 39 + return x - 39; } else if x == 40 { - return x - 40 + return x - 40; } else if x == 41 { - return x - 41 + return x - 41; } else if x == 42 { - return x - 42 + return x - 42; } else if x == 43 { - return x - 43 + return x - 43; } else if x == 44 { - return x - 44 + return x - 44; } else if x == 45 { - return x - 45 + return x - 45; } else if x == 46 { - return x - 46 + return x - 46; } else if x == 47 { - return x - 47 + return x - 47; } else if x == 48 { - return x - 48 + return x - 48; } else if x == 49 { - return x - 49 + return x - 49; } else if x == 50 { - return x - 50 + return x - 50; } else if x == 51 { - return x - 51 + return x - 51; } else if x == 52 { - return x - 52 + return x - 52; } else if x == 53 { - return x - 53 + return x - 53; } else if x == 54 { - return x - 54 + return x - 54; } else if x == 55 { - return x - 55 + return x - 55; } else if x == 56 { - return x - 56 + return x - 56; } else if x == 57 { - return x - 57 + return x - 57; } else if x == 58 { - return x - 58 + return x - 58; } else if x == 59 { - return x - 59 + return x - 59; } else if x == 60 { - return x - 60 + return x - 60; } else if x == 61 { - return x - 61 + return x - 61; } else if x == 62 { - return x - 62 + return x - 62; } else if x == 63 { - return x - 63 + return x - 63; } else if x == 64 { - return x - 64 + return x - 64; } else if x == 65 { - return x - 65 + return x - 65; } else if x == 66 { - return x - 66 + return x - 66; } else if x == 67 { - return x - 67 + return x - 67; } else if x == 68 { - return x - 68 + return x - 68; } else if x == 69 { - return x - 69 + return x - 69; } else if x == 70 { - return x - 70 + return x - 70; } else if x == 71 { - return x - 71 + return x - 71; } else if x == 72 { - return x - 72 + return x - 72; } else if x == 73 { - return x - 73 + return x - 73; } else if x == 74 { - return x - 74 + return x - 74; } else if x == 75 { - return x - 75 + return x - 75; } else if x == 76 { - return x - 76 + return x - 76; } else if x == 77 { - return x - 77 + return x - 77; } else if x == 78 { - return x - 78 + return x - 78; } else if x == 79 { - return x - 79 + return x - 79; } else if x == 80 { - return x - 80 + return x - 80; } else if x == 81 { - return x - 81 + return x - 81; } else if x == 82 { - return x - 82 + return x - 82; } else if x == 83 { - return x - 83 + return x - 83; } else if x == 84 { - return x - 84 + return x - 84; } else if x == 85 { - return x - 85 + return x - 85; } else if x == 86 { - return x - 86 + return x - 86; } else if x == 87 { - return x - 87 + return x - 87; } else if x == 88 { - return x - 88 + return x - 88; } else if x == 89 { - return x - 89 + return x - 89; } else if x == 90 { - return x - 90 + return x - 90; } else if x == 91 { - return x - 91 + return x - 91; } else if x == 92 { - return x - 92 + return x - 92; } else if x == 93 { - return x - 93 + return x - 93; } else if x == 94 { - return x - 94 + return x - 94; } else if x == 95 { - return x - 95 + return x - 95; } else if x == 96 { - return x - 96 + return x - 96; } else if x == 97 { - return x - 97 + return x - 97; } else if x == 98 { - return x - 98 + return x - 98; } else if x == 99 { - return x - 99 + return x - 99; } else if x == 100 { - return x - 100 + return x - 100; } else if x == 101 { - return x - 101 + return x - 101; } else if x == 102 { - return x - 102 + return x - 102; } else if x == 103 { - return x - 103 + return x - 103; } else if x == 104 { - return x - 104 + return x - 104; } else if x == 105 { - return x - 105 + return x - 105; } else if x == 106 { - return x - 106 + return x - 106; } else if x == 107 { - return x - 107 + return x - 107; } else if x == 108 { - return x - 108 + return x - 108; } else if x == 109 { - return x - 109 + return x - 109; } else if x == 110 { - return x - 110 + return x - 110; } else if x == 111 { - return x - 111 + return x - 111; } else if x == 112 { - return x - 112 + return x - 112; } else if x == 113 { - return x - 113 + return x - 113; } else if x == 114 { - return x - 114 + return x - 114; } else if x == 115 { - return x - 115 + return x - 115; } else if x == 116 { - return x - 116 + return x - 116; } else if x == 117 { - return x - 117 + return x - 117; } else if x == 118 { - return x - 118 + return x - 118; } else if x == 119 { - return x - 119 + return x - 119; } else if x == 120 { - return x - 120 + return x - 120; } else if x == 121 { - return x - 121 + return x - 121; } else if x == 122 { - return x - 122 + return x - 122; } else if x == 123 { - return x - 123 + return x - 123; } else if x == 124 { - return x - 124 + return x - 124; } else if x == 125 { - return x - 125 + return x - 125; } else if x == 126 { - return x - 126 + return x - 126; } else if x == 127 { - return x - 127 + return x - 127; } else if x == 128 { - return x - 128 + return x - 128; } else if x == 129 { - return x - 129 + return x - 129; } else if x == 130 { - return x - 130 + return x - 130; } else if x == 131 { - return x - 131 + return x - 131; } else if x == 132 { - return x - 132 + return x - 132; } else if x == 133 { - return x - 133 + return x - 133; } else if x == 134 { - return x - 134 + return x - 134; } else if x == 135 { - return x - 135 + return x - 135; } else if x == 136 { - return x - 136 + return x - 136; } else if x == 137 { - return x - 137 + return x - 137; } else if x == 138 { - return x - 138 + return x - 138; } else if x == 139 { - return x - 139 + return x - 139; } else if x == 140 { - return x - 140 + return x - 140; } else if x == 141 { - return x - 141 + return x - 141; } else if x == 142 { - return x - 142 + return x - 142; } else if x == 143 { - return x - 143 + return x - 143; } else if x == 144 { - return x - 144 + return x - 144; } else if x == 145 { - return x - 145 + return x - 145; } else if x == 146 { - return x - 146 + return x - 146; } else if x == 147 { - return x - 147 + return x - 147; } else if x == 148 { - return x - 148 + return x - 148; } else if x == 149 { - return x - 149 + return x - 149; } else if x == 150 { - return x - 150 + return x - 150; } else if x == 151 { - return x - 151 + return x - 151; } else if x == 152 { - return x - 152 + return x - 152; } else if x == 153 { - return x - 153 + return x - 153; } else if x == 154 { - return x - 154 + return x - 154; } else if x == 155 { - return x - 155 + return x - 155; } else if x == 156 { - return x - 156 + return x - 156; } else if x == 157 { - return x - 157 + return x - 157; } else if x == 158 { - return x - 158 + return x - 158; } else if x == 159 { - return x - 159 + return x - 159; } else if x == 160 { - return x - 160 + return x - 160; } else if x == 161 { - return x - 161 + return x - 161; } else if x == 162 { - return x - 162 + return x - 162; } else if x == 163 { - return x - 163 + return x - 163; } else if x == 164 { - return x - 164 + return x - 164; } else if x == 165 { - return x - 165 + return x - 165; } else if x == 166 { - return x - 166 + return x - 166; } else if x == 167 { - return x - 167 + return x - 167; } else if x == 168 { - return x - 168 + return x - 168; } else if x == 169 { - return x - 169 + return x - 169; } else if x == 170 { - return x - 170 + return x - 170; } else if x == 171 { - return x - 171 + return x - 171; } else if x == 172 { - return x - 172 + return x - 172; } else if x == 173 { - return x - 173 + return x - 173; } else if x == 174 { - return x - 174 + return x - 174; } else if x == 175 { - return x - 175 + return x - 175; } else if x == 176 { - return x - 176 + return x - 176; } else if x == 177 { - return x - 177 + return x - 177; } else if x == 178 { - return x - 178 + return x - 178; } else if x == 179 { - return x - 179 + return x - 179; } else if x == 180 { - return x - 180 + return x - 180; } else if x == 181 { - return x - 181 + return x - 181; } else if x == 182 { - return x - 182 + return x - 182; } else if x == 183 { - return x - 183 + return x - 183; } else if x == 184 { - return x - 184 + return x - 184; } else if x == 185 { - return x - 185 + return x - 185; } else if x == 186 { - return x - 186 + return x - 186; } else if x == 187 { - return x - 187 + return x - 187; } else if x == 188 { - return x - 188 + return x - 188; } else if x == 189 { - return x - 189 + return x - 189; } else if x == 190 { - return x - 190 + return x - 190; } else if x == 191 { - return x - 191 + return x - 191; } } \ No newline at end of file diff --git a/parser/benches/big_ternary.leo b/parser/benches/big_ternary.leo index 46e9cd6aed..ccc0b55a51 100644 --- a/parser/benches/big_ternary.leo +++ b/parser/benches/big_ternary.leo @@ -1,5 +1,5 @@ function main() { const x: u8 = 255; - return x == 0 ? x : (x == 1 ? x : (x == 2 ? x : (x == 3 ? x : (x == 4 ? x : (x == 5 ? x : (x == 6 ? x : (x == 7 ? x : (x == 8 ? x : (x == 9 ? x : (x == 10 ? x : (x == 11 ? x : (x == 12 ? x : (x == 13 ? x : (x == 14 ? x : (x == 15 ? x : (x == 16 ? x : (x == 17 ? x : (x == 18 ? x : (x == 19 ? x : (x == 20 ? x : (x == 21 ? x : (x == 22 ? x : (x == 23 ? x : (x == 24 ? x : (x == 25 ? x : (x == 26 ? x : (x == 27 ? x : (x == 28 ? x : (x == 29 ? x : (x == 30 ? x : (x == 31 ? x : (x == 32 ? x : (x == 33 ? x : (x == 34 ? x : (x == 35 ? x : (x == 36 ? x : (x == 37 ? x : (x == 38 ? x : (x == 39 ? x : (x == 40 ? x : (x == 41 ? x : (x == 42 ? x : (x == 43 ? x : (x == 44 ? x : (x == 45 ? x : (x == 46 ? x : (x == 47 ? x : (x == 48 ? x : (x == 49 ? x : (x == 50 ? x : (x == 51 ? x : (x == 52 ? x : (x == 53 ? x : (x == 54 ? x : (x == 55 ? x : (x == 56 ? x : (x == 57 ? x : (x == 58 ? x : (x == 59 ? x : (x == 60 ? x : (x == 61 ? x : (x == 62 ? x : (x == 63 ? x : (x == 64 ? x : (x == 65 ? x : (x == 66 ? x : (x == 67 ? x : (x == 68 ? x : (x == 69 ? x : (x == 70 ? x : (x == 71 ? x : (x == 72 ? x : (x == 73 ? x : (x == 74 ? x : (x == 75 ? x : (x == 76 ? x : (x == 77 ? x : (x == 78 ? x : (x == 79 ? x : (x == 80 ? x : (x == 81 ? x : (x == 82 ? x : (x == 83 ? x : (x == 84 ? x : (x == 85 ? x : (x == 86 ? x : (x == 87 ? x : (x == 88 ? x : (x == 89 ? x : (x == 90 ? x : (x == 91 ? x : (x == 92 ? x : (x == 93 ? x : (x == 94 ? x : (x == 95 ? x : (x == 96 ? x : (x == 97 ? x : (x == 98 ? x : (x == 99 ? x : (x == 100 ? x : (x == 101 ? x : (x == 102 ? x : (x == 103 ? x : (x == 104 ? x : (x == 105 ? x : (x == 106 ? x : (x == 107 ? x : (x == 108 ? x : (x == 109 ? x : (x == 110 ? x : (x == 111 ? x : (x == 112 ? x : (x == 113 ? x : (x == 114 ? x : (x == 115 ? x : (x == 116 ? x : (x == 117 ? x : (x == 118 ? x : (x == 119 ? x : (x == 120 ? x : (x == 121 ? x : (x == 122 ? x : (x == 123 ? x : (x == 124 ? x : (x == 125 ? x : (x == 126 ? x : (x == 127 ? x : (x == 128 ? x : (x == 129 ? x : (x == 130 ? x : (x == 131 ? x : (x == 132 ? x : (x == 133 ? x : (x == 134 ? x : (x == 135 ? x : (x == 136 ? x : (x == 137 ? x : (x == 138 ? x : (x == 139 ? x : (x == 140 ? x : (x == 141 ? x : (x == 142 ? x : (x == 143 ? x : (x == 144 ? x : (x == 145 ? x : (x == 146 ? x : (x == 147 ? x : (x == 148 ? x : (x == 149 ? x : (x == 150 ? x : (x == 151 ? x : (x == 152 ? x : (x == 153 ? x : (x == 154 ? x : (x == 155 ? x : (x == 156 ? x : (x == 157 ? x : (x == 158 ? x : (x == 159 ? x : (x == 160 ? x : (x == 161 ? x : (x == 162 ? x : (x == 163 ? x : (x == 164 ? x : (x == 165 ? x : (x == 166 ? x : (x == 167 ? x : (x == 168 ? x : (x == 169 ? x : (x == 170 ? x : (x == 171 ? x : (x == 172 ? x : (x == 173 ? x : (x == 174 ? x : (x == 175 ? x : (x == 176 ? x : (x == 177 ? x : (x == 178 ? x : (x == 179 ? x : (x == 180 ? x : (x == 181 ? x : (x == 182 ? x : (x == 183 ? x : (x == 184 ? x : (x == 185 ? x : (x == 186 ? x : (x == 187 ? x : (x == 188 ? x : (x == 189 ? x : (x == 190 ? x : (x == 191 ? x : (x == 192 ? x : (x == 193 ? x : (x == 194 ? x : (x == 195 ? x : (x == 196 ? x : (x == 197 ? x : (x == 198 ? x : (x == 199 ? x : (x == 200 ? x : (x == 201 ? x : (x == 202 ? x : (x == 203 ? x : (x == 204 ? x : (x == 205 ? x : (x == 206 ? x : (x == 207 ? x : (x == 208 ? x : (x == 209 ? x : (x == 210 ? x : (x == 211 ? x : (x == 212 ? x : (x == 213 ? x : (x == 214 ? x : (x == 215 ? x : (x == 216 ? x : (x == 217 ? x : (x == 218 ? x : (x == 219 ? x : (x == 220 ? x : (x == 221 ? x : (x == 222 ? x : (x == 223 ? x : (x == 224 ? x : (x == 225 ? x : (x == 226 ? x : (x == 227 ? x : (x == 228 ? x : (x == 229 ? x : (x == 230 ? x : (x == 231 ? x : (x == 232 ? x : (x == 233 ? x : (x == 234 ? x : (x == 235 ? x : (x == 236 ? x : (x == 237 ? x : (x == 238 ? x : (x == 239 ? x : (x == 240 ? x : (x == 241 ? x : (x == 242 ? x : (x == 243 ? x : (x == 244 ? x : (x == 245 ? x : (x == 246 ? x : (x == 247 ? x : (x == 248 ? x : (x == 249 ? x : (x == 250 ? x : (x == 251 ? x : (x == 252 ? x : (x == 253 ? x : (x == 254 ? x : (x == 255 ? x : 0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + return x == 0 ? x : (x == 1 ? x : (x == 2 ? x : (x == 3 ? x : (x == 4 ? x : (x == 5 ? x : (x == 6 ? x : (x == 7 ? x : (x == 8 ? x : (x == 9 ? x : (x == 10 ? x : (x == 11 ? x : (x == 12 ? x : (x == 13 ? x : (x == 14 ? x : (x == 15 ? x : (x == 16 ? x : (x == 17 ? x : (x == 18 ? x : (x == 19 ? x : (x == 20 ? x : (x == 21 ? x : (x == 22 ? x : (x == 23 ? x : (x == 24 ? x : (x == 25 ? x : (x == 26 ? x : (x == 27 ? x : (x == 28 ? x : (x == 29 ? x : (x == 30 ? x : (x == 31 ? x : (x == 32 ? x : (x == 33 ? x : (x == 34 ? x : (x == 35 ? x : (x == 36 ? x : (x == 37 ? x : (x == 38 ? x : (x == 39 ? x : (x == 40 ? x : (x == 41 ? x : (x == 42 ? x : (x == 43 ? x : (x == 44 ? x : (x == 45 ? x : (x == 46 ? x : (x == 47 ? x : (x == 48 ? x : (x == 49 ? x : (x == 50 ? x : (x == 51 ? x : (x == 52 ? x : (x == 53 ? x : (x == 54 ? x : (x == 55 ? x : (x == 56 ? x : (x == 57 ? x : (x == 58 ? x : (x == 59 ? x : (x == 60 ? x : (x == 61 ? x : (x == 62 ? x : (x == 63 ? x : (x == 64 ? x : (x == 65 ? x : (x == 66 ? x : (x == 67 ? x : (x == 68 ? x : (x == 69 ? x : (x == 70 ? x : (x == 71 ? x : (x == 72 ? x : (x == 73 ? x : (x == 74 ? x : (x == 75 ? x : (x == 76 ? x : (x == 77 ? x : (x == 78 ? x : (x == 79 ? x : (x == 80 ? x : (x == 81 ? x : (x == 82 ? x : (x == 83 ? x : (x == 84 ? x : (x == 85 ? x : (x == 86 ? x : (x == 87 ? x : (x == 88 ? x : (x == 89 ? x : (x == 90 ? x : (x == 91 ? x : (x == 92 ? x : (x == 93 ? x : (x == 94 ? x : (x == 95 ? x : (x == 96 ? x : (x == 97 ? x : (x == 98 ? x : (x == 99 ? x : (x == 100 ? x : (x == 101 ? x : (x == 102 ? x : (x == 103 ? x : (x == 104 ? x : (x == 105 ? x : (x == 106 ? x : (x == 107 ? x : (x == 108 ? x : (x == 109 ? x : (x == 110 ? x : (x == 111 ? x : (x == 112 ? x : (x == 113 ? x : (x == 114 ? x : (x == 115 ? x : (x == 116 ? x : (x == 117 ? x : (x == 118 ? x : (x == 119 ? x : (x == 120 ? x : (x == 121 ? x : (x == 122 ? x : (x == 123 ? x : (x == 124 ? x : (x == 125 ? x : (x == 126 ? x : (x == 127 ? x : (x == 128 ? x : (x == 129 ? x : (x == 130 ? x : (x == 131 ? x : (x == 132 ? x : (x == 133 ? x : (x == 134 ? x : (x == 135 ? x : (x == 136 ? x : (x == 137 ? x : (x == 138 ? x : (x == 139 ? x : (x == 140 ? x : (x == 141 ? x : (x == 142 ? x : (x == 143 ? x : (x == 144 ? x : (x == 145 ? x : (x == 146 ? x : (x == 147 ? x : (x == 148 ? x : (x == 149 ? x : (x == 150 ? x : (x == 151 ? x : (x == 152 ? x : (x == 153 ? x : (x == 154 ? x : (x == 155 ? x : (x == 156 ? x : (x == 157 ? x : (x == 158 ? x : (x == 159 ? x : (x == 160 ? x : (x == 161 ? x : (x == 162 ? x : (x == 163 ? x : (x == 164 ? x : (x == 165 ? x : (x == 166 ? x : (x == 167 ? x : (x == 168 ? x : (x == 169 ? x : (x == 170 ? x : (x == 171 ? x : (x == 172 ? x : (x == 173 ? x : (x == 174 ? x : (x == 175 ? x : (x == 176 ? x : (x == 177 ? x : (x == 178 ? x : (x == 179 ? x : (x == 180 ? x : (x == 181 ? x : (x == 182 ? x : (x == 183 ? x : (x == 184 ? x : (x == 185 ? x : (x == 186 ? x : (x == 187 ? x : (x == 188 ? x : (x == 189 ? x : (x == 190 ? x : (x == 191 ? x : (x == 192 ? x : (x == 193 ? x : (x == 194 ? x : (x == 195 ? x : (x == 196 ? x : (x == 197 ? x : (x == 198 ? x : (x == 199 ? x : (x == 200 ? x : (x == 201 ? x : (x == 202 ? x : (x == 203 ? x : (x == 204 ? x : (x == 205 ? x : (x == 206 ? x : (x == 207 ? x : (x == 208 ? x : (x == 209 ? x : (x == 210 ? x : (x == 211 ? x : (x == 212 ? x : (x == 213 ? x : (x == 214 ? x : (x == 215 ? x : (x == 216 ? x : (x == 217 ? x : (x == 218 ? x : (x == 219 ? x : (x == 220 ? x : (x == 221 ? x : (x == 222 ? x : (x == 223 ? x : (x == 224 ? x : (x == 225 ? x : (x == 226 ? x : (x == 227 ? x : (x == 228 ? x : (x == 229 ? x : (x == 230 ? x : (x == 231 ? x : (x == 232 ? x : (x == 233 ? x : (x == 234 ? x : (x == 235 ? x : (x == 236 ? x : (x == 237 ? x : (x == 238 ? x : (x == 239 ? x : (x == 240 ? x : (x == 241 ? x : (x == 242 ? x : (x == 243 ? x : (x == 244 ? x : (x == 245 ? x : (x == 246 ? x : (x == 247 ? x : (x == 248 ? x : (x == 249 ? x : (x == 250 ? x : (x == 251 ? x : (x == 252 ? x : (x == 253 ? x : (x == 254 ? x : (x == 255 ? x : 0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); } \ No newline at end of file diff --git a/parser/benches/long_array.leo b/parser/benches/long_array.leo index 48094244b6..bd8e914940 100644 --- a/parser/benches/long_array.leo +++ b/parser/benches/long_array.leo @@ -53,5 +53,5 @@ function main() { [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31] ]; - return arr1[31][31] + arr2[15][31] + return arr1[31][31] + arr2[15][31]; } diff --git a/parser/benches/long_expr.leo b/parser/benches/long_expr.leo index 31cf1e0641..f6bc95d633 100644 --- a/parser/benches/long_expr.leo +++ b/parser/benches/long_expr.leo @@ -5,5 +5,5 @@ function main() { const d = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; const e = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - return a + b + c + d + e + return a + b + c + d + e; } diff --git a/parser/benches/many_assigns.leo b/parser/benches/many_assigns.leo index 202bbf0da4..60d7a38620 100644 --- a/parser/benches/many_assigns.leo +++ b/parser/benches/many_assigns.leo @@ -384,5 +384,5 @@ function main() { const x382: u8 = x381; const x383: u8 = x382; - return x383 + return x383; } diff --git a/parser/benches/many_foos.leo b/parser/benches/many_foos.leo index 099f04857d..64967e3950 100644 --- a/parser/benches/many_foos.leo +++ b/parser/benches/many_foos.leo @@ -1,196 +1,196 @@ function main() { - return x191(0u32) + return x191(0u32); } -function x0(val: u8) -> u8 { return val } -function x1(val: u8) -> u8 { return x0(val) } -function x2(val: u8) -> u8 { return x1(val) } -function x3(val: u8) -> u8 { return x2(val) } -function x4(val: u8) -> u8 { return x3(val) } -function x5(val: u8) -> u8 { return x4(val) } -function x6(val: u8) -> u8 { return x5(val) } -function x7(val: u8) -> u8 { return x6(val) } -function x8(val: u8) -> u8 { return x7(val) } -function x9(val: u8) -> u8 { return x8(val) } -function x10(val: u8) -> u8 { return x9(val) } -function x11(val: u8) -> u8 { return x10(val) } -function x12(val: u8) -> u8 { return x11(val) } -function x13(val: u8) -> u8 { return x12(val) } -function x14(val: u8) -> u8 { return x13(val) } -function x15(val: u8) -> u8 { return x14(val) } -function x16(val: u8) -> u8 { return x15(val) } -function x17(val: u8) -> u8 { return x16(val) } -function x18(val: u8) -> u8 { return x17(val) } -function x19(val: u8) -> u8 { return x18(val) } -function x20(val: u8) -> u8 { return x19(val) } -function x21(val: u8) -> u8 { return x20(val) } -function x22(val: u8) -> u8 { return x21(val) } -function x23(val: u8) -> u8 { return x22(val) } -function x24(val: u8) -> u8 { return x23(val) } -function x25(val: u8) -> u8 { return x24(val) } -function x26(val: u8) -> u8 { return x25(val) } -function x27(val: u8) -> u8 { return x26(val) } -function x28(val: u8) -> u8 { return x27(val) } -function x29(val: u8) -> u8 { return x28(val) } -function x30(val: u8) -> u8 { return x29(val) } -function x31(val: u8) -> u8 { return x30(val) } -function x32(val: u8) -> u8 { return x31(val) } -function x33(val: u8) -> u8 { return x32(val) } -function x34(val: u8) -> u8 { return x33(val) } -function x35(val: u8) -> u8 { return x34(val) } -function x36(val: u8) -> u8 { return x35(val) } -function x37(val: u8) -> u8 { return x36(val) } -function x38(val: u8) -> u8 { return x37(val) } -function x39(val: u8) -> u8 { return x38(val) } -function x40(val: u8) -> u8 { return x39(val) } -function x41(val: u8) -> u8 { return x40(val) } -function x42(val: u8) -> u8 { return x41(val) } -function x43(val: u8) -> u8 { return x42(val) } -function x44(val: u8) -> u8 { return x43(val) } -function x45(val: u8) -> u8 { return x44(val) } -function x46(val: u8) -> u8 { return x45(val) } -function x47(val: u8) -> u8 { return x46(val) } -function x48(val: u8) -> u8 { return x47(val) } -function x49(val: u8) -> u8 { return x48(val) } -function x50(val: u8) -> u8 { return x49(val) } -function x51(val: u8) -> u8 { return x50(val) } -function x52(val: u8) -> u8 { return x51(val) } -function x53(val: u8) -> u8 { return x52(val) } -function x54(val: u8) -> u8 { return x53(val) } -function x55(val: u8) -> u8 { return x54(val) } -function x56(val: u8) -> u8 { return x55(val) } -function x57(val: u8) -> u8 { return x56(val) } -function x58(val: u8) -> u8 { return x57(val) } -function x59(val: u8) -> u8 { return x58(val) } -function x60(val: u8) -> u8 { return x59(val) } -function x61(val: u8) -> u8 { return x60(val) } -function x62(val: u8) -> u8 { return x61(val) } -function x63(val: u8) -> u8 { return x62(val) } -function x64(val: u8) -> u8 { return x63(val) } -function x65(val: u8) -> u8 { return x64(val) } -function x66(val: u8) -> u8 { return x65(val) } -function x67(val: u8) -> u8 { return x66(val) } -function x68(val: u8) -> u8 { return x67(val) } -function x69(val: u8) -> u8 { return x68(val) } -function x70(val: u8) -> u8 { return x69(val) } -function x71(val: u8) -> u8 { return x70(val) } -function x72(val: u8) -> u8 { return x71(val) } -function x73(val: u8) -> u8 { return x72(val) } -function x74(val: u8) -> u8 { return x73(val) } -function x75(val: u8) -> u8 { return x74(val) } -function x76(val: u8) -> u8 { return x75(val) } -function x77(val: u8) -> u8 { return x76(val) } -function x78(val: u8) -> u8 { return x77(val) } -function x79(val: u8) -> u8 { return x78(val) } -function x80(val: u8) -> u8 { return x79(val) } -function x81(val: u8) -> u8 { return x80(val) } -function x82(val: u8) -> u8 { return x81(val) } -function x83(val: u8) -> u8 { return x82(val) } -function x84(val: u8) -> u8 { return x83(val) } -function x85(val: u8) -> u8 { return x84(val) } -function x86(val: u8) -> u8 { return x85(val) } -function x87(val: u8) -> u8 { return x86(val) } -function x88(val: u8) -> u8 { return x87(val) } -function x89(val: u8) -> u8 { return x88(val) } -function x90(val: u8) -> u8 { return x89(val) } -function x91(val: u8) -> u8 { return x90(val) } -function x92(val: u8) -> u8 { return x91(val) } -function x93(val: u8) -> u8 { return x92(val) } -function x94(val: u8) -> u8 { return x93(val) } -function x95(val: u8) -> u8 { return x94(val) } -function x96(val: u8) -> u8 { return x95(val) } -function x97(val: u8) -> u8 { return x96(val) } -function x98(val: u8) -> u8 { return x97(val) } -function x99(val: u8) -> u8 { return x98(val) } -function x100(val: u8) -> u8 { return x99(val) } -function x101(val: u8) -> u8 { return x100(val) } -function x102(val: u8) -> u8 { return x101(val) } -function x103(val: u8) -> u8 { return x102(val) } -function x104(val: u8) -> u8 { return x103(val) } -function x105(val: u8) -> u8 { return x104(val) } -function x106(val: u8) -> u8 { return x105(val) } -function x107(val: u8) -> u8 { return x106(val) } -function x108(val: u8) -> u8 { return x107(val) } -function x109(val: u8) -> u8 { return x108(val) } -function x110(val: u8) -> u8 { return x109(val) } -function x111(val: u8) -> u8 { return x110(val) } -function x112(val: u8) -> u8 { return x111(val) } -function x113(val: u8) -> u8 { return x112(val) } -function x114(val: u8) -> u8 { return x113(val) } -function x115(val: u8) -> u8 { return x114(val) } -function x116(val: u8) -> u8 { return x115(val) } -function x117(val: u8) -> u8 { return x116(val) } -function x118(val: u8) -> u8 { return x117(val) } -function x119(val: u8) -> u8 { return x118(val) } -function x120(val: u8) -> u8 { return x119(val) } -function x121(val: u8) -> u8 { return x120(val) } -function x122(val: u8) -> u8 { return x121(val) } -function x123(val: u8) -> u8 { return x122(val) } -function x124(val: u8) -> u8 { return x123(val) } -function x125(val: u8) -> u8 { return x124(val) } -function x126(val: u8) -> u8 { return x125(val) } -function x127(val: u8) -> u8 { return x126(val) } -function x128(val: u8) -> u8 { return x127(val) } -function x129(val: u8) -> u8 { return x128(val) } -function x130(val: u8) -> u8 { return x129(val) } -function x131(val: u8) -> u8 { return x130(val) } -function x132(val: u8) -> u8 { return x131(val) } -function x133(val: u8) -> u8 { return x132(val) } -function x134(val: u8) -> u8 { return x133(val) } -function x135(val: u8) -> u8 { return x134(val) } -function x136(val: u8) -> u8 { return x135(val) } -function x137(val: u8) -> u8 { return x136(val) } -function x138(val: u8) -> u8 { return x137(val) } -function x139(val: u8) -> u8 { return x138(val) } -function x140(val: u8) -> u8 { return x139(val) } -function x141(val: u8) -> u8 { return x140(val) } -function x142(val: u8) -> u8 { return x141(val) } -function x143(val: u8) -> u8 { return x142(val) } -function x144(val: u8) -> u8 { return x143(val) } -function x145(val: u8) -> u8 { return x144(val) } -function x146(val: u8) -> u8 { return x145(val) } -function x147(val: u8) -> u8 { return x146(val) } -function x148(val: u8) -> u8 { return x147(val) } -function x149(val: u8) -> u8 { return x148(val) } -function x150(val: u8) -> u8 { return x149(val) } -function x151(val: u8) -> u8 { return x150(val) } -function x152(val: u8) -> u8 { return x151(val) } -function x153(val: u8) -> u8 { return x152(val) } -function x154(val: u8) -> u8 { return x153(val) } -function x155(val: u8) -> u8 { return x154(val) } -function x156(val: u8) -> u8 { return x155(val) } -function x157(val: u8) -> u8 { return x156(val) } -function x158(val: u8) -> u8 { return x157(val) } -function x159(val: u8) -> u8 { return x158(val) } -function x160(val: u8) -> u8 { return x159(val) } -function x161(val: u8) -> u8 { return x160(val) } -function x162(val: u8) -> u8 { return x161(val) } -function x163(val: u8) -> u8 { return x162(val) } -function x164(val: u8) -> u8 { return x163(val) } -function x165(val: u8) -> u8 { return x164(val) } -function x166(val: u8) -> u8 { return x165(val) } -function x167(val: u8) -> u8 { return x166(val) } -function x168(val: u8) -> u8 { return x167(val) } -function x169(val: u8) -> u8 { return x168(val) } -function x170(val: u8) -> u8 { return x169(val) } -function x171(val: u8) -> u8 { return x170(val) } -function x172(val: u8) -> u8 { return x171(val) } -function x173(val: u8) -> u8 { return x172(val) } -function x174(val: u8) -> u8 { return x173(val) } -function x175(val: u8) -> u8 { return x174(val) } -function x176(val: u8) -> u8 { return x175(val) } -function x177(val: u8) -> u8 { return x176(val) } -function x178(val: u8) -> u8 { return x177(val) } -function x179(val: u8) -> u8 { return x178(val) } -function x180(val: u8) -> u8 { return x179(val) } -function x181(val: u8) -> u8 { return x180(val) } -function x182(val: u8) -> u8 { return x181(val) } -function x183(val: u8) -> u8 { return x182(val) } -function x184(val: u8) -> u8 { return x183(val) } -function x185(val: u8) -> u8 { return x184(val) } -function x186(val: u8) -> u8 { return x185(val) } -function x187(val: u8) -> u8 { return x186(val) } -function x188(val: u8) -> u8 { return x187(val) } -function x189(val: u8) -> u8 { return x188(val) } -function x190(val: u8) -> u8 { return x189(val) } -function x191(val: u8) -> u8 { return x190(val) } +function x0(val: u8) -> u8 { return val }; +function x1(val: u8) -> u8 { return x0(val) }; +function x2(val: u8) -> u8 { return x1(val) }; +function x3(val: u8) -> u8 { return x2(val) }; +function x4(val: u8) -> u8 { return x3(val) }; +function x5(val: u8) -> u8 { return x4(val) }; +function x6(val: u8) -> u8 { return x5(val) }; +function x7(val: u8) -> u8 { return x6(val) }; +function x8(val: u8) -> u8 { return x7(val) }; +function x9(val: u8) -> u8 { return x8(val) }; +function x10(val: u8) -> u8 { return x9(val) }; +function x11(val: u8) -> u8 { return x10(val) }; +function x12(val: u8) -> u8 { return x11(val) }; +function x13(val: u8) -> u8 { return x12(val) }; +function x14(val: u8) -> u8 { return x13(val) }; +function x15(val: u8) -> u8 { return x14(val) }; +function x16(val: u8) -> u8 { return x15(val) }; +function x17(val: u8) -> u8 { return x16(val) }; +function x18(val: u8) -> u8 { return x17(val) }; +function x19(val: u8) -> u8 { return x18(val) }; +function x20(val: u8) -> u8 { return x19(val) }; +function x21(val: u8) -> u8 { return x20(val) }; +function x22(val: u8) -> u8 { return x21(val) }; +function x23(val: u8) -> u8 { return x22(val) }; +function x24(val: u8) -> u8 { return x23(val) }; +function x25(val: u8) -> u8 { return x24(val) }; +function x26(val: u8) -> u8 { return x25(val) }; +function x27(val: u8) -> u8 { return x26(val) }; +function x28(val: u8) -> u8 { return x27(val) }; +function x29(val: u8) -> u8 { return x28(val) }; +function x30(val: u8) -> u8 { return x29(val) }; +function x31(val: u8) -> u8 { return x30(val) }; +function x32(val: u8) -> u8 { return x31(val) }; +function x33(val: u8) -> u8 { return x32(val) }; +function x34(val: u8) -> u8 { return x33(val) }; +function x35(val: u8) -> u8 { return x34(val) }; +function x36(val: u8) -> u8 { return x35(val) }; +function x37(val: u8) -> u8 { return x36(val) }; +function x38(val: u8) -> u8 { return x37(val) }; +function x39(val: u8) -> u8 { return x38(val) }; +function x40(val: u8) -> u8 { return x39(val) }; +function x41(val: u8) -> u8 { return x40(val) }; +function x42(val: u8) -> u8 { return x41(val) }; +function x43(val: u8) -> u8 { return x42(val) }; +function x44(val: u8) -> u8 { return x43(val) }; +function x45(val: u8) -> u8 { return x44(val) }; +function x46(val: u8) -> u8 { return x45(val) }; +function x47(val: u8) -> u8 { return x46(val) }; +function x48(val: u8) -> u8 { return x47(val) }; +function x49(val: u8) -> u8 { return x48(val) }; +function x50(val: u8) -> u8 { return x49(val) }; +function x51(val: u8) -> u8 { return x50(val) }; +function x52(val: u8) -> u8 { return x51(val) }; +function x53(val: u8) -> u8 { return x52(val) }; +function x54(val: u8) -> u8 { return x53(val) }; +function x55(val: u8) -> u8 { return x54(val) }; +function x56(val: u8) -> u8 { return x55(val) }; +function x57(val: u8) -> u8 { return x56(val) }; +function x58(val: u8) -> u8 { return x57(val) }; +function x59(val: u8) -> u8 { return x58(val) }; +function x60(val: u8) -> u8 { return x59(val) }; +function x61(val: u8) -> u8 { return x60(val) }; +function x62(val: u8) -> u8 { return x61(val) }; +function x63(val: u8) -> u8 { return x62(val) }; +function x64(val: u8) -> u8 { return x63(val) }; +function x65(val: u8) -> u8 { return x64(val) }; +function x66(val: u8) -> u8 { return x65(val) }; +function x67(val: u8) -> u8 { return x66(val) }; +function x68(val: u8) -> u8 { return x67(val) }; +function x69(val: u8) -> u8 { return x68(val) }; +function x70(val: u8) -> u8 { return x69(val) }; +function x71(val: u8) -> u8 { return x70(val) }; +function x72(val: u8) -> u8 { return x71(val) }; +function x73(val: u8) -> u8 { return x72(val) }; +function x74(val: u8) -> u8 { return x73(val) }; +function x75(val: u8) -> u8 { return x74(val) }; +function x76(val: u8) -> u8 { return x75(val) }; +function x77(val: u8) -> u8 { return x76(val) }; +function x78(val: u8) -> u8 { return x77(val) }; +function x79(val: u8) -> u8 { return x78(val) }; +function x80(val: u8) -> u8 { return x79(val) }; +function x81(val: u8) -> u8 { return x80(val) }; +function x82(val: u8) -> u8 { return x81(val) }; +function x83(val: u8) -> u8 { return x82(val) }; +function x84(val: u8) -> u8 { return x83(val) }; +function x85(val: u8) -> u8 { return x84(val) }; +function x86(val: u8) -> u8 { return x85(val) }; +function x87(val: u8) -> u8 { return x86(val) }; +function x88(val: u8) -> u8 { return x87(val) }; +function x89(val: u8) -> u8 { return x88(val) }; +function x90(val: u8) -> u8 { return x89(val) }; +function x91(val: u8) -> u8 { return x90(val) }; +function x92(val: u8) -> u8 { return x91(val) }; +function x93(val: u8) -> u8 { return x92(val) }; +function x94(val: u8) -> u8 { return x93(val) }; +function x95(val: u8) -> u8 { return x94(val) }; +function x96(val: u8) -> u8 { return x95(val) }; +function x97(val: u8) -> u8 { return x96(val) }; +function x98(val: u8) -> u8 { return x97(val) }; +function x99(val: u8) -> u8 { return x98(val) }; +function x100(val: u8) -> u8 { return x99(val) }; +function x101(val: u8) -> u8 { return x100(val) }; +function x102(val: u8) -> u8 { return x101(val) }; +function x103(val: u8) -> u8 { return x102(val) }; +function x104(val: u8) -> u8 { return x103(val) }; +function x105(val: u8) -> u8 { return x104(val) }; +function x106(val: u8) -> u8 { return x105(val) }; +function x107(val: u8) -> u8 { return x106(val) }; +function x108(val: u8) -> u8 { return x107(val) }; +function x109(val: u8) -> u8 { return x108(val) }; +function x110(val: u8) -> u8 { return x109(val) }; +function x111(val: u8) -> u8 { return x110(val) }; +function x112(val: u8) -> u8 { return x111(val) }; +function x113(val: u8) -> u8 { return x112(val) }; +function x114(val: u8) -> u8 { return x113(val) }; +function x115(val: u8) -> u8 { return x114(val) }; +function x116(val: u8) -> u8 { return x115(val) }; +function x117(val: u8) -> u8 { return x116(val) }; +function x118(val: u8) -> u8 { return x117(val) }; +function x119(val: u8) -> u8 { return x118(val) }; +function x120(val: u8) -> u8 { return x119(val) }; +function x121(val: u8) -> u8 { return x120(val) }; +function x122(val: u8) -> u8 { return x121(val) }; +function x123(val: u8) -> u8 { return x122(val) }; +function x124(val: u8) -> u8 { return x123(val) }; +function x125(val: u8) -> u8 { return x124(val) }; +function x126(val: u8) -> u8 { return x125(val) }; +function x127(val: u8) -> u8 { return x126(val) }; +function x128(val: u8) -> u8 { return x127(val) }; +function x129(val: u8) -> u8 { return x128(val) }; +function x130(val: u8) -> u8 { return x129(val) }; +function x131(val: u8) -> u8 { return x130(val) }; +function x132(val: u8) -> u8 { return x131(val) }; +function x133(val: u8) -> u8 { return x132(val) }; +function x134(val: u8) -> u8 { return x133(val) }; +function x135(val: u8) -> u8 { return x134(val) }; +function x136(val: u8) -> u8 { return x135(val) }; +function x137(val: u8) -> u8 { return x136(val) }; +function x138(val: u8) -> u8 { return x137(val) }; +function x139(val: u8) -> u8 { return x138(val) }; +function x140(val: u8) -> u8 { return x139(val) }; +function x141(val: u8) -> u8 { return x140(val) }; +function x142(val: u8) -> u8 { return x141(val) }; +function x143(val: u8) -> u8 { return x142(val) }; +function x144(val: u8) -> u8 { return x143(val) }; +function x145(val: u8) -> u8 { return x144(val) }; +function x146(val: u8) -> u8 { return x145(val) }; +function x147(val: u8) -> u8 { return x146(val) }; +function x148(val: u8) -> u8 { return x147(val) }; +function x149(val: u8) -> u8 { return x148(val) }; +function x150(val: u8) -> u8 { return x149(val) }; +function x151(val: u8) -> u8 { return x150(val) }; +function x152(val: u8) -> u8 { return x151(val) }; +function x153(val: u8) -> u8 { return x152(val) }; +function x154(val: u8) -> u8 { return x153(val) }; +function x155(val: u8) -> u8 { return x154(val) }; +function x156(val: u8) -> u8 { return x155(val) }; +function x157(val: u8) -> u8 { return x156(val) }; +function x158(val: u8) -> u8 { return x157(val) }; +function x159(val: u8) -> u8 { return x158(val) }; +function x160(val: u8) -> u8 { return x159(val) }; +function x161(val: u8) -> u8 { return x160(val) }; +function x162(val: u8) -> u8 { return x161(val) }; +function x163(val: u8) -> u8 { return x162(val) }; +function x164(val: u8) -> u8 { return x163(val) }; +function x165(val: u8) -> u8 { return x164(val) }; +function x166(val: u8) -> u8 { return x165(val) }; +function x167(val: u8) -> u8 { return x166(val) }; +function x168(val: u8) -> u8 { return x167(val) }; +function x169(val: u8) -> u8 { return x168(val) }; +function x170(val: u8) -> u8 { return x169(val) }; +function x171(val: u8) -> u8 { return x170(val) }; +function x172(val: u8) -> u8 { return x171(val) }; +function x173(val: u8) -> u8 { return x172(val) }; +function x174(val: u8) -> u8 { return x173(val) }; +function x175(val: u8) -> u8 { return x174(val) }; +function x176(val: u8) -> u8 { return x175(val) }; +function x177(val: u8) -> u8 { return x176(val) }; +function x178(val: u8) -> u8 { return x177(val) }; +function x179(val: u8) -> u8 { return x178(val) }; +function x180(val: u8) -> u8 { return x179(val) }; +function x181(val: u8) -> u8 { return x180(val) }; +function x182(val: u8) -> u8 { return x181(val) }; +function x183(val: u8) -> u8 { return x182(val) }; +function x184(val: u8) -> u8 { return x183(val) }; +function x185(val: u8) -> u8 { return x184(val) }; +function x186(val: u8) -> u8 { return x185(val) }; +function x187(val: u8) -> u8 { return x186(val) }; +function x188(val: u8) -> u8 { return x187(val) }; +function x189(val: u8) -> u8 { return x188(val) }; +function x190(val: u8) -> u8 { return x189(val) }; +function x191(val: u8) -> u8 { return x190(val) }; diff --git a/parser/src/parser/statement.rs b/parser/src/parser/statement.rs index 0392c58cab..fafc5771df 100644 --- a/parser/src/parser/statement.rs +++ b/parser/src/parser/statement.rs @@ -167,7 +167,7 @@ impl ParserContext { pub fn parse_return_statement(&mut self) -> SyntaxResult { let start = self.expect(Token::Return)?; let expr = self.parse_expression()?; - self.eat(Token::Semicolon); + self.expect(Token::Semicolon)?; Ok(ReturnStatement { span: &start + expr.span(), diff --git a/parser/tests/serialization/deprecated_error.leo b/parser/tests/serialization/deprecated_error.leo index ce128173b5..d1ce342312 100644 --- a/parser/tests/serialization/deprecated_error.leo +++ b/parser/tests/serialization/deprecated_error.leo @@ -1,5 +1,5 @@ function main() { - return 1 + 1 + return 1 + 1; } test function old { diff --git a/parser/tests/serialization/main.leo b/parser/tests/serialization/main.leo index ef22115243..b12eb1ae6b 100644 --- a/parser/tests/serialization/main.leo +++ b/parser/tests/serialization/main.leo @@ -1,3 +1,3 @@ function main() { - return 1 + 1 + return 1 + 1; } diff --git a/tests/old/fail/circuits/self_circuit.leo b/tests/old/fail/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/tests/old/fail/circuits/self_circuit.leo +++ b/tests/old/fail/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/tests/old/pass/array/registers.leo b/tests/old/pass/array/registers.leo index ab4107d46c..86836ff96b 100644 --- a/tests/old/pass/array/registers.leo +++ b/tests/old/pass/array/registers.leo @@ -1,3 +1,3 @@ function main() -> [u8; 3] { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/tests/old/pass/boolean/output_register.leo b/tests/old/pass/boolean/output_register.leo index 8237614fa7..5af8daff4f 100644 --- a/tests/old/pass/boolean/output_register.leo +++ b/tests/old/pass/boolean/output_register.leo @@ -1,3 +1,3 @@ function main() -> bool { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/tests/old/pass/circuits/duplicate_name_context.leo b/tests/old/pass/circuits/duplicate_name_context.leo index 66640e75a2..8644d27fcb 100644 --- a/tests/old/pass/circuits/duplicate_name_context.leo +++ b/tests/old/pass/circuits/duplicate_name_context.leo @@ -2,7 +2,7 @@ circuit Bar { b2: u32 function add_five(z:u32) -> u32 { - return z+5u32 + return z+5u32; } } diff --git a/tests/old/pass/circuits/inline_member_pass.leo b/tests/old/pass/circuits/inline_member_pass.leo index 8e58e4935a..6fd7f7dff7 100644 --- a/tests/old/pass/circuits/inline_member_pass.leo +++ b/tests/old/pass/circuits/inline_member_pass.leo @@ -2,7 +2,7 @@ circuit Foo { x: u8 function new(x: u8) -> Self { - return Self { x } + return Self { x }; } } diff --git a/tests/old/pass/circuits/member_function.leo b/tests/old/pass/circuits/member_function.leo index 258b6c675e..eee44be448 100644 --- a/tests/old/pass/circuits/member_function.leo +++ b/tests/old/pass/circuits/member_function.leo @@ -2,7 +2,7 @@ circuit Foo { x: u32, function echo(self) -> u32 { - return self.x + return self.x; } } diff --git a/tests/old/pass/circuits/member_function_fail.leo b/tests/old/pass/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/tests/old/pass/circuits/member_function_fail.leo +++ b/tests/old/pass/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_function_invalid.leo b/tests/old/pass/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/tests/old/pass/circuits/member_function_invalid.leo +++ b/tests/old/pass/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_function_nested.leo b/tests/old/pass/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/tests/old/pass/circuits/member_function_nested.leo +++ b/tests/old/pass/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/tests/old/pass/circuits/member_static_function.leo b/tests/old/pass/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/tests/old/pass/circuits/member_static_function.leo +++ b/tests/old/pass/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_static_function_invalid.leo b/tests/old/pass/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/tests/old/pass/circuits/member_static_function_invalid.leo +++ b/tests/old/pass/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_static_function_undefined.leo b/tests/old/pass/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/tests/old/pass/circuits/member_static_function_undefined.leo +++ b/tests/old/pass/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_variable_and_function.leo b/tests/old/pass/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/tests/old/pass/circuits/member_variable_and_function.leo +++ b/tests/old/pass/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/tests/old/pass/circuits/pedersen_mock.leo b/tests/old/pass/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/tests/old/pass/circuits/pedersen_mock.leo +++ b/tests/old/pass/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/tests/old/pass/circuits/self_member.leo b/tests/old/pass/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/tests/old/pass/circuits/self_member.leo +++ b/tests/old/pass/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/tests/old/pass/circuits/self_member_invalid.leo b/tests/old/pass/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/tests/old/pass/circuits/self_member_invalid.leo +++ b/tests/old/pass/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/tests/old/pass/circuits/self_member_undefined.leo b/tests/old/pass/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/tests/old/pass/circuits/self_member_undefined.leo +++ b/tests/old/pass/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/tests/old/pass/core/blake2s_input.leo b/tests/old/pass/core/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/tests/old/pass/core/blake2s_input.leo +++ b/tests/old/pass/core/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/tests/old/pass/function/conditional_return.leo b/tests/old/pass/function/conditional_return.leo index 7ecd0e625c..e27dd7aea5 100644 --- a/tests/old/pass/function/conditional_return.leo +++ b/tests/old/pass/function/conditional_return.leo @@ -1,7 +1,7 @@ function main(x: u8) -> u8 { if x == 2u8 { - return 3u8 + return 3u8; } else { - return 4u8 + return 4u8; } } \ No newline at end of file diff --git a/tests/old/pass/function/iteration.leo b/tests/old/pass/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/tests/old/pass/function/iteration.leo +++ b/tests/old/pass/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/tests/old/pass/function/iteration_repeated.leo b/tests/old/pass/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/tests/old/pass/function/iteration_repeated.leo +++ b/tests/old/pass/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/tests/old/pass/function/multiple_returns.leo b/tests/old/pass/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/tests/old/pass/function/multiple_returns.leo +++ b/tests/old/pass/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/tests/old/pass/function/multiple_returns_fail.leo b/tests/old/pass/function/multiple_returns_fail.leo index d4a8b36eac..daa773f2e8 100644 --- a/tests/old/pass/function/multiple_returns_fail.leo +++ b/tests/old/pass/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored } - return 2i8 //ignored - return 3i8 //returns + return 2i8; //ignored + return 3i8; //returns } \ No newline at end of file diff --git a/tests/old/pass/function/multiple_returns_fail_conditional.leo b/tests/old/pass/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/tests/old/pass/function/multiple_returns_fail_conditional.leo +++ b/tests/old/pass/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/tests/old/pass/function/multiple_returns_main.leo b/tests/old/pass/function/multiple_returns_main.leo index 69a2b32232..1dc086ee80 100644 --- a/tests/old/pass/function/multiple_returns_main.leo +++ b/tests/old/pass/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return (input.registers.a, input.registers.b) + return (input.registers.a, input.registers.b); } \ No newline at end of file diff --git a/tests/old/pass/function/newlines.leo b/tests/old/pass/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/tests/old/pass/function/newlines.leo +++ b/tests/old/pass/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/tests/old/pass/function/repeated.leo b/tests/old/pass/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/tests/old/pass/function/repeated.leo +++ b/tests/old/pass/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/tests/old/pass/function/return.leo b/tests/old/pass/function/return.leo index 10c7138977..e839700ee3 100644 --- a/tests/old/pass/function/return.leo +++ b/tests/old/pass/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/tests/old/pass/function/return_array_nested_fail.leo b/tests/old/pass/function/return_array_nested_fail.leo index 8eca684b8a..0db89a09e3 100644 --- a/tests/old/pass/function/return_array_nested_fail.leo +++ b/tests/old/pass/function/return_array_nested_fail.leo @@ -1,5 +1,5 @@ function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (2, 3)] // The correct 3x2 array tuple is `[0u8; (3, 2)]` + return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]` } function main() { diff --git a/tests/old/pass/function/return_array_nested_pass.leo b/tests/old/pass/function/return_array_nested_pass.leo index bfbfc8fd29..c7586f3f08 100644 --- a/tests/old/pass/function/return_array_nested_pass.leo +++ b/tests/old/pass/function/return_array_nested_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/tests/old/pass/function/return_array_tuple_fail.leo b/tests/old/pass/function/return_array_tuple_fail.leo index c960456ac1..d2afcd2790 100644 --- a/tests/old/pass/function/return_array_tuple_fail.leo +++ b/tests/old/pass/function/return_array_tuple_fail.leo @@ -1,5 +1,5 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 3]; 2] // The correct 3x2 nested array is `[0u8; 2]; 3]` + return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]` } function main() { diff --git a/tests/old/pass/function/return_array_tuple_pass.leo b/tests/old/pass/function/return_array_tuple_pass.leo index 4199e31990..6f5a63e806 100644 --- a/tests/old/pass/function/return_array_tuple_pass.leo +++ b/tests/old/pass/function/return_array_tuple_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/tests/old/pass/function/return_tuple.leo b/tests/old/pass/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/tests/old/pass/function/return_tuple.leo +++ b/tests/old/pass/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/tests/old/pass/function/return_tuple_conditional.leo b/tests/old/pass/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/tests/old/pass/function/return_tuple_conditional.leo +++ b/tests/old/pass/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/tests/old/pass/function/scope_fail.leo b/tests/old/pass/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/tests/old/pass/function/scope_fail.leo +++ b/tests/old/pass/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/tests/old/pass/import/test-import.leo b/tests/old/pass/import/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/tests/old/pass/import/test-import.leo +++ b/tests/old/pass/import/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/tests/old/pass/mutability/swap.leo b/tests/old/pass/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/tests/old/pass/mutability/swap.leo +++ b/tests/old/pass/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/tests/old/pass/statements/multiple_returns.leo b/tests/old/pass/statements/multiple_returns.leo index 0a6b599681..f2b9e499c2 100644 --- a/tests/old/pass/statements/multiple_returns.leo +++ b/tests/old/pass/statements/multiple_returns.leo @@ -1,7 +1,7 @@ function main() -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/tests/old/pass/statements/num_returns_fail.leo b/tests/old/pass/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/tests/old/pass/statements/num_returns_fail.leo +++ b/tests/old/pass/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/tests/old/pass/syntax/undefined.leo b/tests/old/pass/syntax/undefined.leo index 856b07589a..0ab97f6cb0 100644 --- a/tests/old/pass/syntax/undefined.leo +++ b/tests/old/pass/syntax/undefined.leo @@ -1,3 +1,3 @@ function main() -> bool { - return a + return a; } \ No newline at end of file diff --git a/tests/old/pass/tuples/function.leo b/tests/old/pass/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/tests/old/pass/tuples/function.leo +++ b/tests/old/pass/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/tests/old/pass/tuples/function_multiple.leo b/tests/old/pass/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/tests/old/pass/tuples/function_multiple.leo +++ b/tests/old/pass/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/tests/old/pass/tuples/function_typed.leo b/tests/old/pass/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/tests/old/pass/tuples/function_typed.leo +++ b/tests/old/pass/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { From cf36a6bfe7db515cccdf4c27b65652244c1d74c2 Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 17:11:02 -0400 Subject: [PATCH 15/30] non-ambigious format strings, escaped double quotes allowed --- grammar/abnf-grammar.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index a132c98db7..64c1f67bf3 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -466,9 +466,15 @@ address = %s"aleo1" 58( lowercase-letter / digit ) format-string-container = "{}" -format-string = double-quote - *( not-double-quote / format-string-container ) - double-quote +not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF / %x5c%x22 + +not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF / %x5c%x22 + +format-string-element = not-double-quote-or-open-brace + / "{" not-double-quote-or-close-brace + / format-string-container + +format-string = double-quote *format-string-element double-quote ; Here is (part of this ABNF comment), ; an alternative way to specify format strings, From 6e595bd845c8261bf93d721468bee8414c5da79b Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 17:43:02 -0400 Subject: [PATCH 16/30] remove escaped double quote for now, address(...) removed --- .../pass/address/console_assert_pass.leo | 4 +- asg/tests/pass/address/input.leo | 2 +- asg/tests/pass/address/ternary.leo | 4 +- asg/tests/pass/address/valid.leo | 2 +- .../tests/address/console_assert_fail.leo | 4 +- .../tests/address/console_assert_pass.leo | 4 +- compiler/tests/address/input.leo | 2 +- compiler/tests/address/invalid_length.leo | 2 +- compiler/tests/address/ternary.leo | 4 +- compiler/tests/address/valid.leo | 2 +- grammar/abnf-grammar.txt | 17 +++------ parser/src/parser/expression.rs | 16 -------- tests/old/fail/address/invalid_length.leo | 2 +- .../old/pass/address/console_assert_fail.leo | 4 +- .../old/pass/address/console_assert_pass.leo | 4 +- tests/old/pass/address/input.leo | 2 +- tests/old/pass/address/ternary.leo | 4 +- tests/old/pass/address/valid.leo | 2 +- .../expression/literal/address_parse.leo | 5 --- .../expression/literal/address_parse.leo.out | 38 +------------------ 20 files changed, 31 insertions(+), 93 deletions(-) diff --git a/asg/tests/pass/address/console_assert_pass.leo b/asg/tests/pass/address/console_assert_pass.leo index f17d7d8c05..214d01c4a8 100644 --- a/asg/tests/pass/address/console_assert_pass.leo +++ b/asg/tests/pass/address/console_assert_pass.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/asg/tests/pass/address/input.leo b/asg/tests/pass/address/input.leo index 29519f0334..506abb0fff 100644 --- a/asg/tests/pass/address/input.leo +++ b/asg/tests/pass/address/input.leo @@ -1,5 +1,5 @@ function main(owner: address) { - const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(owner == sender); } \ No newline at end of file diff --git a/asg/tests/pass/address/ternary.leo b/asg/tests/pass/address/ternary.leo index dc87153d2d..f29e13ab5d 100644 --- a/asg/tests/pass/address/ternary.leo +++ b/asg/tests/pass/address/ternary.leo @@ -1,6 +1,6 @@ function main(s: bool, c: address) { - const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r); + const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r; const r = s? a: b; diff --git a/asg/tests/pass/address/valid.leo b/asg/tests/pass/address/valid.leo index 18f1682526..6d693efe78 100644 --- a/asg/tests/pass/address/valid.leo +++ b/asg/tests/pass/address/valid.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; } \ No newline at end of file diff --git a/compiler/tests/address/console_assert_fail.leo b/compiler/tests/address/console_assert_fail.leo index 17849256ca..e8b9099843 100644 --- a/compiler/tests/address/console_assert_fail.leo +++ b/compiler/tests/address/console_assert_fail.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/compiler/tests/address/console_assert_pass.leo b/compiler/tests/address/console_assert_pass.leo index f17d7d8c05..214d01c4a8 100644 --- a/compiler/tests/address/console_assert_pass.leo +++ b/compiler/tests/address/console_assert_pass.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/compiler/tests/address/input.leo b/compiler/tests/address/input.leo index 29519f0334..506abb0fff 100644 --- a/compiler/tests/address/input.leo +++ b/compiler/tests/address/input.leo @@ -1,5 +1,5 @@ function main(owner: address) { - const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(owner == sender); } \ No newline at end of file diff --git a/compiler/tests/address/invalid_length.leo b/compiler/tests/address/invalid_length.leo index ae1defecaf..42692ded3f 100644 --- a/compiler/tests/address/invalid_length.leo +++ b/compiler/tests/address/invalid_length.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88; } \ No newline at end of file diff --git a/compiler/tests/address/ternary.leo b/compiler/tests/address/ternary.leo index dc87153d2d..f29e13ab5d 100644 --- a/compiler/tests/address/ternary.leo +++ b/compiler/tests/address/ternary.leo @@ -1,6 +1,6 @@ function main(s: bool, c: address) { - const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r); + const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r; const r = s? a: b; diff --git a/compiler/tests/address/valid.leo b/compiler/tests/address/valid.leo index 18f1682526..6d693efe78 100644 --- a/compiler/tests/address/valid.leo +++ b/compiler/tests/address/valid.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; } \ No newline at end of file diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index 64c1f67bf3..8879db4002 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -446,12 +446,6 @@ identifier = letter *( letter / digit / "_" ) ; but not a keyword package-name = 1*( lowercase-letter / digit ) *( "-" 1*( lowercase-letter / digit ) ) -; An address starts with 'aleo1' -; and continues with exactly 58 lowercase letters and digits. -; Thus an address always consists of 63 characters. - -address = %s"aleo1" 58( lowercase-letter / digit ) - ; A format string is a sequence of characters, other than double quote, ; surrounded by double quotes. ; Within a format string, sub-strings '{}' are distinguished as containers @@ -466,9 +460,9 @@ address = %s"aleo1" 58( lowercase-letter / digit ) format-string-container = "{}" -not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF / %x5c%x22 +not-double-quote-or-open-brace = %x0-22 / %x24-7A / %x7C-10FFFF -not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF / %x5c%x22 +not-double-quote-or-close-brace = %x0-22 / %x24-7C / %x7E-10FFFF format-string-element = not-double-quote-or-open-brace / "{" not-double-quote-or-close-brace @@ -536,10 +530,11 @@ product-group-literal = integer %s"group" boolean-literal = %s"true" / %s"false" -; An address literal is an address wrapped into an indication of address, -; to differentiate it from an identifier. +; An address literal starts with 'aleo1' +; and continues with exactly 58 lowercase letters and digits. +; Thus an address always consists of 63 characters. -address-literal = %s"address" "(" address ")" +address-literal = %s"aleo1" 58( lowercase-letter / digit ) ; The ones above are all the atomic literals ; (in the sense that they are tokens, without whitespace allowed in them), diff --git a/parser/src/parser/expression.rs b/parser/src/parser/expression.rs index cca9429684..028f506a04 100644 --- a/parser/src/parser/expression.rs +++ b/parser/src/parser/expression.rs @@ -689,22 +689,6 @@ impl ParserContext { Token::True => Expression::Value(ValueExpression::Boolean("true".into(), span)), Token::False => Expression::Value(ValueExpression::Boolean("false".into(), span)), Token::AddressLit(value) => Expression::Value(ValueExpression::Address(value, span)), - Token::Address => { - self.expect(Token::LeftParen)?; - let value = self.expect_any()?; - let value = if let SpannedToken { - token: Token::AddressLit(value), - .. - } = value - { - value - } else { - return Err(SyntaxError::unexpected_str(&value.token, "address", &value.span)); - }; - - let end = self.expect(Token::RightParen)?; - Expression::Value(ValueExpression::Address(value, span + end)) - } Token::LeftParen => self.parse_tuple_expression(&span)?, Token::LeftSquare => self.parse_array_expression(&span)?, Token::Ident(name) => { diff --git a/tests/old/fail/address/invalid_length.leo b/tests/old/fail/address/invalid_length.leo index ae1defecaf..42692ded3f 100644 --- a/tests/old/fail/address/invalid_length.leo +++ b/tests/old/fail/address/invalid_length.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88; } \ No newline at end of file diff --git a/tests/old/pass/address/console_assert_fail.leo b/tests/old/pass/address/console_assert_fail.leo index 17849256ca..e8b9099843 100644 --- a/tests/old/pass/address/console_assert_fail.leo +++ b/tests/old/pass/address/console_assert_fail.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/tests/old/pass/address/console_assert_pass.leo b/tests/old/pass/address/console_assert_pass.leo index f17d7d8c05..214d01c4a8 100644 --- a/tests/old/pass/address/console_assert_pass.leo +++ b/tests/old/pass/address/console_assert_pass.leo @@ -1,6 +1,6 @@ function main() { - const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(address_1 == address_2); } \ No newline at end of file diff --git a/tests/old/pass/address/input.leo b/tests/old/pass/address/input.leo index 29519f0334..506abb0fff 100644 --- a/tests/old/pass/address/input.leo +++ b/tests/old/pass/address/input.leo @@ -1,5 +1,5 @@ function main(owner: address) { - const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; console.assert(owner == sender); } \ No newline at end of file diff --git a/tests/old/pass/address/ternary.leo b/tests/old/pass/address/ternary.leo index dc87153d2d..f29e13ab5d 100644 --- a/tests/old/pass/address/ternary.leo +++ b/tests/old/pass/address/ternary.leo @@ -1,6 +1,6 @@ function main(s: bool, c: address) { - const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); - const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r); + const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; + const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r; const r = s? a: b; diff --git a/tests/old/pass/address/valid.leo b/tests/old/pass/address/valid.leo index 18f1682526..6d693efe78 100644 --- a/tests/old/pass/address/valid.leo +++ b/tests/old/pass/address/valid.leo @@ -1,3 +1,3 @@ function main() { - const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8); + const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; } \ No newline at end of file diff --git a/tests/parser/expression/literal/address_parse.leo b/tests/parser/expression/literal/address_parse.leo index dce6abbd47..4ffe7ccc60 100644 --- a/tests/parser/expression/literal/address_parse.leo +++ b/tests/parser/expression/literal/address_parse.leo @@ -7,8 +7,3 @@ aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9 aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st - -address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8) -address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9) -address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9) -address(aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st) diff --git a/tests/parser/expression/literal/address_parse.leo.out b/tests/parser/expression/literal/address_parse.leo.out index 65097db1e0..4d13340fd2 100644 --- a/tests/parser/expression/literal/address_parse.leo.out +++ b/tests/parser/expression/literal/address_parse.leo.out @@ -37,40 +37,4 @@ outputs: col_start: 1 col_stop: 64 path: address_parse.leo - content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st - - Value: - Address: - - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 - - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 73 - path: address_parse.leo - content: address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8) - - Value: - Address: - - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9 - - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 73 - path: address_parse.leo - content: address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9) - - Value: - Address: - - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9 - - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 73 - path: address_parse.leo - content: address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d9) - - Value: - Address: - - aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st - - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 73 - path: address_parse.leo - content: address(aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st) + content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st \ No newline at end of file From de8106f8e6af2ea139213ffbb8c8de37c74a2295 Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 18:02:46 -0400 Subject: [PATCH 17/30] fix hard-coded leo new file --- package/src/source/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/src/source/main.rs b/package/src/source/main.rs index 7ac8c4990d..842c85c7eb 100644 --- a/package/src/source/main.rs +++ b/package/src/source/main.rs @@ -68,7 +68,7 @@ impl MainFile { r#"// The '{}' main function. function main(a: u32, b: u32) -> u32 {{ let c: u32 = a + b; - return c + return c; }} "#, self.package_name From 51920b5df76816b7a8d298e1553ce4e208b38a4c Mon Sep 17 00:00:00 2001 From: Protryon Date: Wed, 14 Apr 2021 10:51:17 -0700 Subject: [PATCH 18/30] require semicolons on return --- .../fail/circuits/member_function_fail.leo | 2 +- .../fail/circuits/member_function_invalid.leo | 2 +- .../member_static_function_invalid.leo | 2 +- .../member_static_function_undefined.leo | 2 +- asg/tests/fail/circuits/mod.rs | 2 +- .../fail/circuits/self_member_invalid.leo | 2 +- .../fail/circuits/self_member_undefined.leo | 2 +- .../multiple_returns_fail_conditional.leo | 4 +- .../multiple_returns_input_ambiguous.leo | 4 +- asg/tests/fail/function/scope_fail.leo | 2 +- .../fail/statements/num_returns_fail.leo | 2 +- asg/tests/pass/array/registers.leo | 2 +- asg/tests/pass/boolean/output_register.leo | 2 +- asg/tests/pass/circuits/member_function.leo | 2 +- .../pass/circuits/member_function_nested.leo | 4 +- .../pass/circuits/member_static_function.leo | 2 +- .../circuits/member_variable_and_function.leo | 2 +- asg/tests/pass/circuits/mod.rs | 2 +- asg/tests/pass/circuits/pedersen_mock.leo | 4 +- asg/tests/pass/circuits/self_circuit.leo | 2 +- asg/tests/pass/circuits/self_member.leo | 2 +- asg/tests/pass/core/blake2s_input.leo | 2 +- asg/tests/pass/function/iteration.leo | 2 +- .../pass/function/iteration_repeated.leo | 2 +- asg/tests/pass/function/multiple_returns.leo | 2 +- .../pass/function/multiple_returns_main.leo | 2 +- asg/tests/pass/function/newlines.leo | 2 +- asg/tests/pass/function/repeated.leo | 2 +- asg/tests/pass/function/return.leo | 2 +- asg/tests/pass/function/return_tuple.leo | 2 +- .../function/return_tuple_conditional.leo | 4 +- asg/tests/pass/import/src/test-import.leo | 2 +- asg/tests/pass/mutability/swap.leo | 2 +- .../conditional/multiple_returns.leo | 4 +- asg/tests/pass/tuples/function.leo | 2 +- asg/tests/pass/tuples/function_multiple.leo | 2 +- asg/tests/pass/tuples/function_typed.leo | 2 +- compiler/tests/array/registers.leo | 2 +- compiler/tests/boolean/output_register.leo | 2 +- .../big_self_in_circuit_replacement.leo | 2 +- .../big_self_outside_circuit_fail.leo | 2 +- .../canonicalization/compound_assignment.leo | 2 +- .../tests/circuits/const_self_variable.leo | 2 +- .../tests/circuits/duplicate_name_context.leo | 2 +- .../tests/circuits/inline_member_pass.leo | 2 +- compiler/tests/circuits/member_function.leo | 2 +- .../tests/circuits/member_function_fail.leo | 2 +- .../circuits/member_function_invalid.leo | 2 +- .../tests/circuits/member_function_nested.leo | 4 +- .../tests/circuits/member_static_function.leo | 2 +- .../member_static_function_invalid.leo | 2 +- .../member_static_function_undefined.leo | 2 +- .../circuits/member_variable_and_function.leo | 2 +- .../mutable_call_immutable_context.leo | 2 +- compiler/tests/circuits/pedersen_mock.leo | 4 +- compiler/tests/circuits/self_circuit.leo | 2 +- compiler/tests/circuits/self_member.leo | 2 +- .../tests/circuits/self_member_invalid.leo | 2 +- .../tests/circuits/self_member_undefined.leo | 2 +- .../unstable/blake2s/blake2s_input.leo | 2 +- compiler/tests/field/output_register.leo | 2 +- .../tests/function/conditional_return.leo | 4 +- compiler/tests/function/iteration.leo | 2 +- .../tests/function/iteration_repeated.leo | 2 +- compiler/tests/function/multiple_returns.leo | 2 +- .../multiple_returns_fail_conditional.leo | 4 +- .../tests/function/multiple_returns_main.leo | 2 +- compiler/tests/function/newlines.leo | 2 +- compiler/tests/function/repeated.leo | 2 +- compiler/tests/function/return.leo | 2 +- compiler/tests/function/return_tuple.leo | 2 +- .../function/return_tuple_conditional.leo | 4 +- compiler/tests/function/scope_fail.leo | 2 +- compiler/tests/import/src/test-import.leo | 2 +- .../program_registers/registers_array.leo | 2 +- .../program_registers/registers_fail.leo | 2 +- .../program_registers/registers_pass.leo | 2 +- compiler/tests/mutability/swap.leo | 2 +- .../statements/conditional/cond_switch.leo | 6 +- .../conditional/multiple_returns.leo | 4 +- .../tests/statements/num_returns_fail.leo | 2 +- compiler/tests/syntax/undefined.leo | 2 +- compiler/tests/tuples/function.leo | 2 +- compiler/tests/tuples/function_multiple.leo | 2 +- compiler/tests/tuples/function_typed.leo | 2 +- examples/hello-world/src/main.leo | 2 +- examples/pedersen-hash/src/main.leo | 6 +- examples/silly-sudoku/src/lib.leo | 2 +- examples/silly-sudoku/src/main.leo | 2 +- parser/benches/big_circuit.leo | 2 +- parser/benches/big_if_else.leo | 384 ++++++++--------- parser/benches/big_ternary.leo | 2 +- parser/benches/long_array.leo | 2 +- parser/benches/long_expr.leo | 2 +- parser/benches/many_assigns.leo | 2 +- parser/benches/many_foos.leo | 386 +++++++++--------- parser/src/parser/statement.rs | 2 +- .../tests/serialization/deprecated_error.leo | 2 +- parser/tests/serialization/main.leo | 2 +- tests/old/fail/circuits/self_circuit.leo | 2 +- tests/old/pass/array/registers.leo | 2 +- tests/old/pass/boolean/output_register.leo | 2 +- .../pass/circuits/duplicate_name_context.leo | 2 +- .../old/pass/circuits/inline_member_pass.leo | 2 +- tests/old/pass/circuits/member_function.leo | 2 +- .../pass/circuits/member_function_fail.leo | 2 +- .../pass/circuits/member_function_invalid.leo | 2 +- .../pass/circuits/member_function_nested.leo | 4 +- .../pass/circuits/member_static_function.leo | 2 +- .../member_static_function_invalid.leo | 2 +- .../member_static_function_undefined.leo | 2 +- .../circuits/member_variable_and_function.leo | 2 +- tests/old/pass/circuits/pedersen_mock.leo | 4 +- tests/old/pass/circuits/self_member.leo | 2 +- .../old/pass/circuits/self_member_invalid.leo | 2 +- .../pass/circuits/self_member_undefined.leo | 2 +- tests/old/pass/core/blake2s_input.leo | 2 +- .../old/pass/function/conditional_return.leo | 4 +- tests/old/pass/function/iteration.leo | 2 +- .../old/pass/function/iteration_repeated.leo | 2 +- tests/old/pass/function/multiple_returns.leo | 2 +- .../pass/function/multiple_returns_fail.leo | 6 +- .../multiple_returns_fail_conditional.leo | 4 +- .../pass/function/multiple_returns_main.leo | 2 +- tests/old/pass/function/newlines.leo | 2 +- tests/old/pass/function/repeated.leo | 2 +- tests/old/pass/function/return.leo | 2 +- .../function/return_array_nested_fail.leo | 2 +- .../function/return_array_nested_pass.leo | 4 +- .../pass/function/return_array_tuple_fail.leo | 2 +- .../pass/function/return_array_tuple_pass.leo | 4 +- tests/old/pass/function/return_tuple.leo | 2 +- .../function/return_tuple_conditional.leo | 4 +- tests/old/pass/function/scope_fail.leo | 2 +- tests/old/pass/import/test-import.leo | 2 +- tests/old/pass/mutability/swap.leo | 2 +- .../old/pass/statements/multiple_returns.leo | 4 +- .../old/pass/statements/num_returns_fail.leo | 2 +- tests/old/pass/syntax/undefined.leo | 2 +- tests/old/pass/tuples/function.leo | 2 +- tests/old/pass/tuples/function_multiple.leo | 2 +- tests/old/pass/tuples/function_typed.leo | 2 +- tests/parser/statement/return.leo | 3 + tests/parser/statement/return.leo.out | 18 + tests/parser/statement/return_fail.leo | 11 + tests/parser/statement/return_fail.leo.out | 7 + 146 files changed, 590 insertions(+), 551 deletions(-) create mode 100644 tests/parser/statement/return_fail.leo create mode 100644 tests/parser/statement/return_fail.leo.out diff --git a/asg/tests/fail/circuits/member_function_fail.leo b/asg/tests/fail/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/asg/tests/fail/circuits/member_function_fail.leo +++ b/asg/tests/fail/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_function_invalid.leo b/asg/tests/fail/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/asg/tests/fail/circuits/member_function_invalid.leo +++ b/asg/tests/fail/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_static_function_invalid.leo b/asg/tests/fail/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/asg/tests/fail/circuits/member_static_function_invalid.leo +++ b/asg/tests/fail/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/member_static_function_undefined.leo b/asg/tests/fail/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/asg/tests/fail/circuits/member_static_function_undefined.leo +++ b/asg/tests/fail/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/mod.rs b/asg/tests/fail/circuits/mod.rs index 38f1824755..4d343b25a0 100644 --- a/asg/tests/fail/circuits/mod.rs +++ b/asg/tests/fail/circuits/mod.rs @@ -55,7 +55,7 @@ fn test_mut_member_function_fail() { let program_string = r#" circuit Foo { function echo(mut self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/fail/circuits/self_member_invalid.leo b/asg/tests/fail/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/asg/tests/fail/circuits/self_member_invalid.leo +++ b/asg/tests/fail/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/asg/tests/fail/circuits/self_member_undefined.leo b/asg/tests/fail/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/asg/tests/fail/circuits/self_member_undefined.leo +++ b/asg/tests/fail/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/asg/tests/fail/function/multiple_returns_fail_conditional.leo b/asg/tests/fail/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/asg/tests/fail/function/multiple_returns_fail_conditional.leo +++ b/asg/tests/fail/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/asg/tests/fail/function/multiple_returns_input_ambiguous.leo b/asg/tests/fail/function/multiple_returns_input_ambiguous.leo index 234375349b..363408e61e 100644 --- a/asg/tests/fail/function/multiple_returns_input_ambiguous.leo +++ b/asg/tests/fail/function/multiple_returns_input_ambiguous.leo @@ -1,7 +1,7 @@ function main(input) -> u32 { if input.registers.a == 0 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/asg/tests/fail/function/scope_fail.leo b/asg/tests/fail/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/asg/tests/fail/function/scope_fail.leo +++ b/asg/tests/fail/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/asg/tests/fail/statements/num_returns_fail.leo b/asg/tests/fail/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/asg/tests/fail/statements/num_returns_fail.leo +++ b/asg/tests/fail/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/asg/tests/pass/array/registers.leo b/asg/tests/pass/array/registers.leo index fb8980868e..a6d29145e5 100644 --- a/asg/tests/pass/array/registers.leo +++ b/asg/tests/pass/array/registers.leo @@ -1,3 +1,3 @@ function main(input) -> [u8; 3] { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/asg/tests/pass/boolean/output_register.leo b/asg/tests/pass/boolean/output_register.leo index fb01d41dbe..618868a2fb 100644 --- a/asg/tests/pass/boolean/output_register.leo +++ b/asg/tests/pass/boolean/output_register.leo @@ -1,3 +1,3 @@ function main(input) -> bool { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/asg/tests/pass/circuits/member_function.leo b/asg/tests/pass/circuits/member_function.leo index 4e50e97195..b7879b5bf7 100644 --- a/asg/tests/pass/circuits/member_function.leo +++ b/asg/tests/pass/circuits/member_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/member_function_nested.leo b/asg/tests/pass/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/asg/tests/pass/circuits/member_function_nested.leo +++ b/asg/tests/pass/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/asg/tests/pass/circuits/member_static_function.leo b/asg/tests/pass/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/asg/tests/pass/circuits/member_static_function.leo +++ b/asg/tests/pass/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/member_variable_and_function.leo b/asg/tests/pass/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/asg/tests/pass/circuits/member_variable_and_function.leo +++ b/asg/tests/pass/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/asg/tests/pass/circuits/mod.rs b/asg/tests/pass/circuits/mod.rs index ee2315b6f7..9936d9877d 100644 --- a/asg/tests/pass/circuits/mod.rs +++ b/asg/tests/pass/circuits/mod.rs @@ -49,7 +49,7 @@ fn test_mut_member_function() { let program_string = r#" circuit Foo { function echo(mut self, x: u32) -> u32 { - return x + return x; } } diff --git a/asg/tests/pass/circuits/pedersen_mock.leo b/asg/tests/pass/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/asg/tests/pass/circuits/pedersen_mock.leo +++ b/asg/tests/pass/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/asg/tests/pass/circuits/self_circuit.leo b/asg/tests/pass/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/asg/tests/pass/circuits/self_circuit.leo +++ b/asg/tests/pass/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/asg/tests/pass/circuits/self_member.leo b/asg/tests/pass/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/asg/tests/pass/circuits/self_member.leo +++ b/asg/tests/pass/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/asg/tests/pass/core/blake2s_input.leo b/asg/tests/pass/core/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/asg/tests/pass/core/blake2s_input.leo +++ b/asg/tests/pass/core/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/asg/tests/pass/function/iteration.leo b/asg/tests/pass/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/asg/tests/pass/function/iteration.leo +++ b/asg/tests/pass/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/asg/tests/pass/function/iteration_repeated.leo b/asg/tests/pass/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/asg/tests/pass/function/iteration_repeated.leo +++ b/asg/tests/pass/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/asg/tests/pass/function/multiple_returns.leo b/asg/tests/pass/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/asg/tests/pass/function/multiple_returns.leo +++ b/asg/tests/pass/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/function/multiple_returns_main.leo b/asg/tests/pass/function/multiple_returns_main.leo index 0bc82e1e4b..c00cd56bed 100644 --- a/asg/tests/pass/function/multiple_returns_main.leo +++ b/asg/tests/pass/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ function main(input) -> (bool, bool) { - return (input.registers.a, input.registers.b) + return (input.registers.a, input.registers.b); } \ No newline at end of file diff --git a/asg/tests/pass/function/newlines.leo b/asg/tests/pass/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/asg/tests/pass/function/newlines.leo +++ b/asg/tests/pass/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/asg/tests/pass/function/repeated.leo b/asg/tests/pass/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/asg/tests/pass/function/repeated.leo +++ b/asg/tests/pass/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/asg/tests/pass/function/return.leo b/asg/tests/pass/function/return.leo index 10c7138977..e839700ee3 100644 --- a/asg/tests/pass/function/return.leo +++ b/asg/tests/pass/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/asg/tests/pass/function/return_tuple.leo b/asg/tests/pass/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/asg/tests/pass/function/return_tuple.leo +++ b/asg/tests/pass/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/asg/tests/pass/function/return_tuple_conditional.leo b/asg/tests/pass/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/asg/tests/pass/function/return_tuple_conditional.leo +++ b/asg/tests/pass/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/asg/tests/pass/import/src/test-import.leo b/asg/tests/pass/import/src/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/asg/tests/pass/import/src/test-import.leo +++ b/asg/tests/pass/import/src/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/asg/tests/pass/mutability/swap.leo b/asg/tests/pass/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/asg/tests/pass/mutability/swap.leo +++ b/asg/tests/pass/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/asg/tests/pass/statements/conditional/multiple_returns.leo b/asg/tests/pass/statements/conditional/multiple_returns.leo index b8dd869b47..7362fc0732 100644 --- a/asg/tests/pass/statements/conditional/multiple_returns.leo +++ b/asg/tests/pass/statements/conditional/multiple_returns.leo @@ -1,7 +1,7 @@ function main(input) -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/asg/tests/pass/tuples/function.leo b/asg/tests/pass/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/asg/tests/pass/tuples/function.leo +++ b/asg/tests/pass/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/tuples/function_multiple.leo b/asg/tests/pass/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/asg/tests/pass/tuples/function_multiple.leo +++ b/asg/tests/pass/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/asg/tests/pass/tuples/function_typed.leo b/asg/tests/pass/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/asg/tests/pass/tuples/function_typed.leo +++ b/asg/tests/pass/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/array/registers.leo b/compiler/tests/array/registers.leo index fb8980868e..a6d29145e5 100644 --- a/compiler/tests/array/registers.leo +++ b/compiler/tests/array/registers.leo @@ -1,3 +1,3 @@ function main(input) -> [u8; 3] { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/compiler/tests/boolean/output_register.leo b/compiler/tests/boolean/output_register.leo index fb01d41dbe..618868a2fb 100644 --- a/compiler/tests/boolean/output_register.leo +++ b/compiler/tests/boolean/output_register.leo @@ -1,3 +1,3 @@ function main(input) -> bool { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo index f8b2657a70..4081e46cbf 100644 --- a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo +++ b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo @@ -6,7 +6,7 @@ circuit Foo { x: 1u32 }; - return new + return new; } } diff --git a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo index d1f30e8470..6f5100adde 100644 --- a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo +++ b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo @@ -6,7 +6,7 @@ circuit Foo { x: 1u32 }; - return new + return new; } } diff --git a/compiler/tests/canonicalization/compound_assignment.leo b/compiler/tests/canonicalization/compound_assignment.leo index d8ec55ba79..224cc18cd4 100644 --- a/compiler/tests/canonicalization/compound_assignment.leo +++ b/compiler/tests/canonicalization/compound_assignment.leo @@ -4,7 +4,7 @@ circuit Foo { function z (mut self) -> u16 { self.y.0 += 1u8; - return 1u16 + return 1u16; } } function main() { diff --git a/compiler/tests/circuits/const_self_variable.leo b/compiler/tests/circuits/const_self_variable.leo index ebcc3076ae..8ba32ba0df 100644 --- a/compiler/tests/circuits/const_self_variable.leo +++ b/compiler/tests/circuits/const_self_variable.leo @@ -2,7 +2,7 @@ circuit Foo { a: u8, function use_a(const self) -> u8 { - return self.a + 1 + return self.a + 1; } } diff --git a/compiler/tests/circuits/duplicate_name_context.leo b/compiler/tests/circuits/duplicate_name_context.leo index 66640e75a2..8644d27fcb 100644 --- a/compiler/tests/circuits/duplicate_name_context.leo +++ b/compiler/tests/circuits/duplicate_name_context.leo @@ -2,7 +2,7 @@ circuit Bar { b2: u32 function add_five(z:u32) -> u32 { - return z+5u32 + return z+5u32; } } diff --git a/compiler/tests/circuits/inline_member_pass.leo b/compiler/tests/circuits/inline_member_pass.leo index 8e58e4935a..6fd7f7dff7 100644 --- a/compiler/tests/circuits/inline_member_pass.leo +++ b/compiler/tests/circuits/inline_member_pass.leo @@ -2,7 +2,7 @@ circuit Foo { x: u8 function new(x: u8) -> Self { - return Self { x } + return Self { x }; } } diff --git a/compiler/tests/circuits/member_function.leo b/compiler/tests/circuits/member_function.leo index 258b6c675e..eee44be448 100644 --- a/compiler/tests/circuits/member_function.leo +++ b/compiler/tests/circuits/member_function.leo @@ -2,7 +2,7 @@ circuit Foo { x: u32, function echo(self) -> u32 { - return self.x + return self.x; } } diff --git a/compiler/tests/circuits/member_function_fail.leo b/compiler/tests/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/compiler/tests/circuits/member_function_fail.leo +++ b/compiler/tests/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_function_invalid.leo b/compiler/tests/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/compiler/tests/circuits/member_function_invalid.leo +++ b/compiler/tests/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_function_nested.leo b/compiler/tests/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/compiler/tests/circuits/member_function_nested.leo +++ b/compiler/tests/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/compiler/tests/circuits/member_static_function.leo b/compiler/tests/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/compiler/tests/circuits/member_static_function.leo +++ b/compiler/tests/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_static_function_invalid.leo b/compiler/tests/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/compiler/tests/circuits/member_static_function_invalid.leo +++ b/compiler/tests/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_static_function_undefined.leo b/compiler/tests/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/compiler/tests/circuits/member_static_function_undefined.leo +++ b/compiler/tests/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/compiler/tests/circuits/member_variable_and_function.leo b/compiler/tests/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/compiler/tests/circuits/member_variable_and_function.leo +++ b/compiler/tests/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/compiler/tests/circuits/mutable_call_immutable_context.leo b/compiler/tests/circuits/mutable_call_immutable_context.leo index d68e1866c5..91aac73011 100644 --- a/compiler/tests/circuits/mutable_call_immutable_context.leo +++ b/compiler/tests/circuits/mutable_call_immutable_context.leo @@ -3,7 +3,7 @@ circuit TestMe { function test_me(mut self) -> u8 { self.x += 1; - return self.x + return self.x; } } diff --git a/compiler/tests/circuits/pedersen_mock.leo b/compiler/tests/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/compiler/tests/circuits/pedersen_mock.leo +++ b/compiler/tests/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/compiler/tests/circuits/self_circuit.leo b/compiler/tests/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/compiler/tests/circuits/self_circuit.leo +++ b/compiler/tests/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/compiler/tests/circuits/self_member.leo b/compiler/tests/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/compiler/tests/circuits/self_member.leo +++ b/compiler/tests/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/compiler/tests/circuits/self_member_invalid.leo b/compiler/tests/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/compiler/tests/circuits/self_member_invalid.leo +++ b/compiler/tests/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/compiler/tests/circuits/self_member_undefined.leo b/compiler/tests/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/compiler/tests/circuits/self_member_undefined.leo +++ b/compiler/tests/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo b/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo +++ b/compiler/tests/core/packages/unstable/blake2s/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/compiler/tests/field/output_register.leo b/compiler/tests/field/output_register.leo index 258a6f2c74..e27a3947bd 100644 --- a/compiler/tests/field/output_register.leo +++ b/compiler/tests/field/output_register.leo @@ -1,3 +1,3 @@ function main(registers) -> field { - return registers.r + return registers.r; } \ No newline at end of file diff --git a/compiler/tests/function/conditional_return.leo b/compiler/tests/function/conditional_return.leo index 7ecd0e625c..e27dd7aea5 100644 --- a/compiler/tests/function/conditional_return.leo +++ b/compiler/tests/function/conditional_return.leo @@ -1,7 +1,7 @@ function main(x: u8) -> u8 { if x == 2u8 { - return 3u8 + return 3u8; } else { - return 4u8 + return 4u8; } } \ No newline at end of file diff --git a/compiler/tests/function/iteration.leo b/compiler/tests/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/compiler/tests/function/iteration.leo +++ b/compiler/tests/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/compiler/tests/function/iteration_repeated.leo b/compiler/tests/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/compiler/tests/function/iteration_repeated.leo +++ b/compiler/tests/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/compiler/tests/function/multiple_returns.leo b/compiler/tests/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/compiler/tests/function/multiple_returns.leo +++ b/compiler/tests/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/function/multiple_returns_fail_conditional.leo b/compiler/tests/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/compiler/tests/function/multiple_returns_fail_conditional.leo +++ b/compiler/tests/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/compiler/tests/function/multiple_returns_main.leo b/compiler/tests/function/multiple_returns_main.leo index 0bc82e1e4b..c00cd56bed 100644 --- a/compiler/tests/function/multiple_returns_main.leo +++ b/compiler/tests/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ function main(input) -> (bool, bool) { - return (input.registers.a, input.registers.b) + return (input.registers.a, input.registers.b); } \ No newline at end of file diff --git a/compiler/tests/function/newlines.leo b/compiler/tests/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/compiler/tests/function/newlines.leo +++ b/compiler/tests/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/compiler/tests/function/repeated.leo b/compiler/tests/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/compiler/tests/function/repeated.leo +++ b/compiler/tests/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/compiler/tests/function/return.leo b/compiler/tests/function/return.leo index 10c7138977..e839700ee3 100644 --- a/compiler/tests/function/return.leo +++ b/compiler/tests/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/compiler/tests/function/return_tuple.leo b/compiler/tests/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/compiler/tests/function/return_tuple.leo +++ b/compiler/tests/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/compiler/tests/function/return_tuple_conditional.leo b/compiler/tests/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/compiler/tests/function/return_tuple_conditional.leo +++ b/compiler/tests/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/compiler/tests/function/scope_fail.leo b/compiler/tests/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/compiler/tests/function/scope_fail.leo +++ b/compiler/tests/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/compiler/tests/import/src/test-import.leo b/compiler/tests/import/src/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/compiler/tests/import/src/test-import.leo +++ b/compiler/tests/import/src/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_array.leo b/compiler/tests/input_files/program_registers/registers_array.leo index 708fa0ea61..324515c13f 100644 --- a/compiler/tests/input_files/program_registers/registers_array.leo +++ b/compiler/tests/input_files/program_registers/registers_array.leo @@ -1,3 +1,3 @@ function main () -> [[u8; 4]; 2] { - return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]] + return [[1u8, 2u8, 3u8, 4u8], [5u8, 6u8, 7u8, 8u8]]; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_fail.leo b/compiler/tests/input_files/program_registers/registers_fail.leo index 221958dbd9..78af2bb5d8 100644 --- a/compiler/tests/input_files/program_registers/registers_fail.leo +++ b/compiler/tests/input_files/program_registers/registers_fail.leo @@ -1,3 +1,3 @@ function main() -> bool { - return false + return false; } \ No newline at end of file diff --git a/compiler/tests/input_files/program_registers/registers_pass.leo b/compiler/tests/input_files/program_registers/registers_pass.leo index ce0dbcb130..ff5ef4a0cd 100644 --- a/compiler/tests/input_files/program_registers/registers_pass.leo +++ b/compiler/tests/input_files/program_registers/registers_pass.leo @@ -1,3 +1,3 @@ function main() -> u8 { - return 1u8 + return 1u8; } \ No newline at end of file diff --git a/compiler/tests/mutability/swap.leo b/compiler/tests/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/compiler/tests/mutability/swap.leo +++ b/compiler/tests/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/compiler/tests/statements/conditional/cond_switch.leo b/compiler/tests/statements/conditional/cond_switch.leo index 7b7845cde3..6f2228635b 100644 --- a/compiler/tests/statements/conditional/cond_switch.leo +++ b/compiler/tests/statements/conditional/cond_switch.leo @@ -1,9 +1,9 @@ function main (x: bool) -> bool { if false { - return x + return x; } else if x { - return false + return false; } else { - return false + return false; } } \ No newline at end of file diff --git a/compiler/tests/statements/conditional/multiple_returns.leo b/compiler/tests/statements/conditional/multiple_returns.leo index b8dd869b47..7362fc0732 100644 --- a/compiler/tests/statements/conditional/multiple_returns.leo +++ b/compiler/tests/statements/conditional/multiple_returns.leo @@ -1,7 +1,7 @@ function main(input) -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/compiler/tests/statements/num_returns_fail.leo b/compiler/tests/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/compiler/tests/statements/num_returns_fail.leo +++ b/compiler/tests/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/compiler/tests/syntax/undefined.leo b/compiler/tests/syntax/undefined.leo index 856b07589a..0ab97f6cb0 100644 --- a/compiler/tests/syntax/undefined.leo +++ b/compiler/tests/syntax/undefined.leo @@ -1,3 +1,3 @@ function main() -> bool { - return a + return a; } \ No newline at end of file diff --git a/compiler/tests/tuples/function.leo b/compiler/tests/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/compiler/tests/tuples/function.leo +++ b/compiler/tests/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/tuples/function_multiple.leo b/compiler/tests/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/compiler/tests/tuples/function_multiple.leo +++ b/compiler/tests/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/compiler/tests/tuples/function_typed.leo b/compiler/tests/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/compiler/tests/tuples/function_typed.leo +++ b/compiler/tests/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/examples/hello-world/src/main.leo b/examples/hello-world/src/main.leo index f78b77e855..5ce8db73a2 100644 --- a/examples/hello-world/src/main.leo +++ b/examples/hello-world/src/main.leo @@ -1,5 +1,5 @@ // The 'hello-world' main function. function main(a: u32, b: u32) -> u32 { const c: u32 = a + b; - return c + return c; } diff --git a/examples/pedersen-hash/src/main.leo b/examples/pedersen-hash/src/main.leo index 84670cd6c2..030dc0bcb8 100644 --- a/examples/pedersen-hash/src/main.leo +++ b/examples/pedersen-hash/src/main.leo @@ -3,7 +3,7 @@ circuit PedersenHash { // Instantiates a Pedersen hash circuit function new(parameters: [group; 256]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 256]) -> group { @@ -13,13 +13,13 @@ circuit PedersenHash { digest += self.parameters[i]; } } - return digest + return digest; } } // The 'pedersen-hash' main function. function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { const pedersen = PedersenHash::new(parameters); - return pedersen.hash(hash_input) + return pedersen.hash(hash_input); } diff --git a/examples/silly-sudoku/src/lib.leo b/examples/silly-sudoku/src/lib.leo index 0e5c93568e..c1e4922461 100644 --- a/examples/silly-sudoku/src/lib.leo +++ b/examples/silly-sudoku/src/lib.leo @@ -65,6 +65,6 @@ circuit SillySudoku { } // Returns true if all numbers 1-9 have been seen exactly once. - return result + return result; } } diff --git a/examples/silly-sudoku/src/main.leo b/examples/silly-sudoku/src/main.leo index 087acda62d..856bd8892a 100644 --- a/examples/silly-sudoku/src/main.leo +++ b/examples/silly-sudoku/src/main.leo @@ -16,7 +16,7 @@ function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool { console.log("The answer is {}.", result); - return result + return result; } // Tests that the `silly-sudoku` circuit outputs true on a correct answer. diff --git a/parser/benches/big_circuit.leo b/parser/benches/big_circuit.leo index 01d10c2daa..5d2242581c 100644 --- a/parser/benches/big_circuit.leo +++ b/parser/benches/big_circuit.leo @@ -2,7 +2,7 @@ function main() { const foo = Foo { x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, x5: 5, x6: 6, x7: 7, x8: 8, x9: 9, x10: 10, x11: 11, x12: 12, x13: 13, x14: 14, x15: 15, x16: 16, x17: 17, x18: 18, x19: 19, x20: 20, x21: 21, x22: 22, x23: 23, x24: 24, x25: 25, x26: 26, x27: 27, x28: 28, x29: 29, x30: 30, x31: 31, x32: 32, x33: 33, x34: 34, x35: 35, x36: 36, x37: 37, x38: 38, x39: 39, x40: 40, x41: 41, x42: 42, x43: 43, x44: 44, x45: 45, x46: 46, x47: 47, x48: 48, x49: 49, x50: 50, x51: 51, x52: 52, x53: 53, x54: 54, x55: 55, x56: 56, x57: 57, x58: 58, x59: 59, x60: 60, x61: 61, x62: 62, x63: 63, x64: 64, x65: 65, x66: 66, x67: 67, x68: 68, x69: 69, x70: 70, x71: 71, x72: 72, x73: 73, x74: 74, x75: 75, x76: 76, x77: 77, x78: 78, x79: 79, x80: 80, x81: 81, x82: 82, x83: 83, x84: 84, x85: 85, x86: 86, x87: 87, x88: 88, x89: 89, x90: 90, x91: 91, x92: 92, x93: 93, x94: 94, x95: 95, x96: 96, x97: 97, x98: 98, x99: 99, x100: 100, x101: 101, x102: 102, x103: 103, x104: 104, x105: 105, x106: 106, x107: 107, x108: 108, x109: 109, x110: 110, x111: 111, x112: 112, x113: 113, x114: 114, x115: 115, x116: 116, x117: 117, x118: 118, x119: 119, x120: 120, x121: 121, x122: 122, x123: 123, x124: 124, x125: 125, x126: 126, x127: 127, x128: 128, x129: 129, x130: 130, x131: 131, x132: 132, x133: 133, x134: 134, x135: 135, x136: 136, x137: 137, x138: 138, x139: 139, x140: 140, x141: 141, x142: 142, x143: 143, x144: 144, x145: 145, x146: 146, x147: 147, x148: 148, x149: 149, x150: 150, x151: 151, x152: 152, x153: 153, x154: 154, x155: 155, x156: 156, x157: 157, x158: 158, x159: 159, x160: 160, x161: 161, x162: 162, x163: 163, x164: 164, x165: 165, x166: 166, x167: 167, x168: 168, x169: 169, x170: 170, x171: 171, x172: 172, x173: 173, x174: 174, x175: 175, x176: 176, x177: 177, x178: 178, x179: 179, x180: 180, x181: 181, x182: 182, x183: 183, x184: 184, x185: 185, x186: 186, x187: 187, x188: 188, x189: 189, x190: 190, x191: 191, x192: 192, x193: 193, x194: 194, x195: 195, x196: 196, x197: 197, x198: 198, x199: 199, x200: 200, x201: 201, x202: 202, x203: 203, x204: 204, x205: 205, x206: 206, x207: 207, x208: 208, x209: 209, x210: 210, x211: 211, x212: 212, x213: 213, x214: 214, x215: 215, x216: 216, x217: 217, x218: 218, x219: 219, x220: 220, x221: 221, x222: 222, x223: 223, x224: 224, x225: 225, x226: 226, x227: 227, x228: 228, x229: 229, x230: 230, x231: 231, x232: 232, x233: 233, x234: 234, x235: 235, x236: 236, x237: 237, x238: 238, x239: 239, x240: 240, x241: 241, x242: 242, x243: 243, x244: 244, x245: 245, x246: 246, x247: 247, x248: 248, x249: 249, x250: 250, x251: 251, x252: 252, x253: 253, x254: 254, x255: 255 }; const bar = Foo { x0: 0, x1: 1, x2: 2, x3: 3, x4: 4, x5: 5, x6: 6, x7: 7, x8: 8, x9: 9, x10: 10, x11: 11, x12: 12, x13: 13, x14: 14, x15: 15, x16: 16, x17: 17, x18: 18, x19: 19, x20: 20, x21: 21, x22: 22, x23: 23, x24: 24, x25: 25, x26: 26, x27: 27, x28: 28, x29: 29, x30: 30, x31: 31, x32: 32, x33: 33, x34: 34, x35: 35, x36: 36, x37: 37, x38: 38, x39: 39, x40: 40, x41: 41, x42: 42, x43: 43, x44: 44, x45: 45, x46: 46, x47: 47, x48: 48, x49: 49, x50: 50, x51: 51, x52: 52, x53: 53, x54: 54, x55: 55, x56: 56, x57: 57, x58: 58, x59: 59, x60: 60, x61: 61, x62: 62, x63: 63, x64: 64, x65: 65, x66: 66, x67: 67, x68: 68, x69: 69, x70: 70, x71: 71, x72: 72, x73: 73, x74: 74, x75: 75, x76: 76, x77: 77, x78: 78, x79: 79, x80: 80, x81: 81, x82: 82, x83: 83, x84: 84, x85: 85, x86: 86, x87: 87, x88: 88, x89: 89, x90: 90, x91: 91, x92: 92, x93: 93, x94: 94, x95: 95, x96: 96, x97: 97, x98: 98, x99: 99, x100: 100, x101: 101, x102: 102, x103: 103, x104: 104, x105: 105, x106: 106, x107: 107, x108: 108, x109: 109, x110: 110, x111: 111, x112: 112, x113: 113, x114: 114, x115: 115, x116: 116, x117: 117, x118: 118, x119: 119, x120: 120, x121: 121, x122: 122, x123: 123, x124: 124, x125: 125, x126: 126, x127: 127, x128: 128, x129: 129, x130: 130, x131: 131, x132: 132, x133: 133, x134: 134, x135: 135, x136: 136, x137: 137, x138: 138, x139: 139, x140: 140, x141: 141, x142: 142, x143: 143, x144: 144, x145: 145, x146: 146, x147: 147, x148: 148, x149: 149, x150: 150, x151: 151, x152: 152, x153: 153, x154: 154, x155: 155, x156: 156, x157: 157, x158: 158, x159: 159, x160: 160, x161: 161, x162: 162, x163: 163, x164: 164, x165: 165, x166: 166, x167: 167, x168: 168, x169: 169, x170: 170, x171: 171, x172: 172, x173: 173, x174: 174, x175: 175, x176: 176, x177: 177, x178: 178, x179: 179, x180: 180, x181: 181, x182: 182, x183: 183, x184: 184, x185: 185, x186: 186, x187: 187, x188: 188, x189: 189, x190: 190, x191: 191, x192: 192, x193: 193, x194: 194, x195: 195, x196: 196, x197: 197, x198: 198, x199: 199, x200: 200, x201: 201, x202: 202, x203: 203, x204: 204, x205: 205, x206: 206, x207: 207, x208: 208, x209: 209, x210: 210, x211: 211, x212: 212, x213: 213, x214: 214, x215: 215, x216: 216, x217: 217, x218: 218, x219: 219, x220: 220, x221: 221, x222: 222, x223: 223, x224: 224, x225: 225, x226: 226, x227: 227, x228: 228, x229: 229, x230: 230, x231: 231, x232: 232, x233: 233, x234: 234, x235: 235, x236: 236, x237: 237, x238: 238, x239: 239, x240: 240, x241: 241, x242: 242, x243: 243, x244: 244, x245: 245, x246: 246, x247: 247, x248: 248, x249: 249, x250: 250, x251: 251, x252: 252, x253: 253, x254: 254, x255: 255 }; - return foo.x0 + bar.x255 + return foo.x0 + bar.x255; } circuit Foo { diff --git a/parser/benches/big_if_else.leo b/parser/benches/big_if_else.leo index db0d5f45e8..b00fa9dbb7 100644 --- a/parser/benches/big_if_else.leo +++ b/parser/benches/big_if_else.leo @@ -2,388 +2,388 @@ function main() { const x: u8 = 191; if x == 0 { - return x + return x; } else if x == 1 { - return x - 1 + return x - 1; } else if x == 2 { - return x - 2 + return x - 2; } else if x == 3 { - return x - 3 + return x - 3; } else if x == 4 { - return x - 4 + return x - 4; } else if x == 5 { - return x - 5 + return x - 5; } else if x == 6 { - return x - 6 + return x - 6; } else if x == 7 { - return x - 7 + return x - 7; } else if x == 8 { - return x - 8 + return x - 8; } else if x == 9 { - return x - 9 + return x - 9; } else if x == 10 { - return x - 10 + return x - 10; } else if x == 11 { - return x - 11 + return x - 11; } else if x == 12 { - return x - 12 + return x - 12; } else if x == 13 { - return x - 13 + return x - 13; } else if x == 14 { - return x - 14 + return x - 14; } else if x == 15 { - return x - 15 + return x - 15; } else if x == 16 { - return x - 16 + return x - 16; } else if x == 17 { - return x - 17 + return x - 17; } else if x == 18 { - return x - 18 + return x - 18; } else if x == 19 { - return x - 19 + return x - 19; } else if x == 20 { - return x - 20 + return x - 20; } else if x == 21 { - return x - 21 + return x - 21; } else if x == 22 { - return x - 22 + return x - 22; } else if x == 23 { - return x - 23 + return x - 23; } else if x == 24 { - return x - 24 + return x - 24; } else if x == 25 { - return x - 25 + return x - 25; } else if x == 26 { - return x - 26 + return x - 26; } else if x == 27 { - return x - 27 + return x - 27; } else if x == 28 { - return x - 28 + return x - 28; } else if x == 29 { - return x - 29 + return x - 29; } else if x == 30 { - return x - 30 + return x - 30; } else if x == 31 { - return x - 31 + return x - 31; } else if x == 32 { - return x - 32 + return x - 32; } else if x == 33 { - return x - 33 + return x - 33; } else if x == 34 { - return x - 34 + return x - 34; } else if x == 35 { - return x - 35 + return x - 35; } else if x == 36 { - return x - 36 + return x - 36; } else if x == 37 { - return x - 37 + return x - 37; } else if x == 38 { - return x - 38 + return x - 38; } else if x == 39 { - return x - 39 + return x - 39; } else if x == 40 { - return x - 40 + return x - 40; } else if x == 41 { - return x - 41 + return x - 41; } else if x == 42 { - return x - 42 + return x - 42; } else if x == 43 { - return x - 43 + return x - 43; } else if x == 44 { - return x - 44 + return x - 44; } else if x == 45 { - return x - 45 + return x - 45; } else if x == 46 { - return x - 46 + return x - 46; } else if x == 47 { - return x - 47 + return x - 47; } else if x == 48 { - return x - 48 + return x - 48; } else if x == 49 { - return x - 49 + return x - 49; } else if x == 50 { - return x - 50 + return x - 50; } else if x == 51 { - return x - 51 + return x - 51; } else if x == 52 { - return x - 52 + return x - 52; } else if x == 53 { - return x - 53 + return x - 53; } else if x == 54 { - return x - 54 + return x - 54; } else if x == 55 { - return x - 55 + return x - 55; } else if x == 56 { - return x - 56 + return x - 56; } else if x == 57 { - return x - 57 + return x - 57; } else if x == 58 { - return x - 58 + return x - 58; } else if x == 59 { - return x - 59 + return x - 59; } else if x == 60 { - return x - 60 + return x - 60; } else if x == 61 { - return x - 61 + return x - 61; } else if x == 62 { - return x - 62 + return x - 62; } else if x == 63 { - return x - 63 + return x - 63; } else if x == 64 { - return x - 64 + return x - 64; } else if x == 65 { - return x - 65 + return x - 65; } else if x == 66 { - return x - 66 + return x - 66; } else if x == 67 { - return x - 67 + return x - 67; } else if x == 68 { - return x - 68 + return x - 68; } else if x == 69 { - return x - 69 + return x - 69; } else if x == 70 { - return x - 70 + return x - 70; } else if x == 71 { - return x - 71 + return x - 71; } else if x == 72 { - return x - 72 + return x - 72; } else if x == 73 { - return x - 73 + return x - 73; } else if x == 74 { - return x - 74 + return x - 74; } else if x == 75 { - return x - 75 + return x - 75; } else if x == 76 { - return x - 76 + return x - 76; } else if x == 77 { - return x - 77 + return x - 77; } else if x == 78 { - return x - 78 + return x - 78; } else if x == 79 { - return x - 79 + return x - 79; } else if x == 80 { - return x - 80 + return x - 80; } else if x == 81 { - return x - 81 + return x - 81; } else if x == 82 { - return x - 82 + return x - 82; } else if x == 83 { - return x - 83 + return x - 83; } else if x == 84 { - return x - 84 + return x - 84; } else if x == 85 { - return x - 85 + return x - 85; } else if x == 86 { - return x - 86 + return x - 86; } else if x == 87 { - return x - 87 + return x - 87; } else if x == 88 { - return x - 88 + return x - 88; } else if x == 89 { - return x - 89 + return x - 89; } else if x == 90 { - return x - 90 + return x - 90; } else if x == 91 { - return x - 91 + return x - 91; } else if x == 92 { - return x - 92 + return x - 92; } else if x == 93 { - return x - 93 + return x - 93; } else if x == 94 { - return x - 94 + return x - 94; } else if x == 95 { - return x - 95 + return x - 95; } else if x == 96 { - return x - 96 + return x - 96; } else if x == 97 { - return x - 97 + return x - 97; } else if x == 98 { - return x - 98 + return x - 98; } else if x == 99 { - return x - 99 + return x - 99; } else if x == 100 { - return x - 100 + return x - 100; } else if x == 101 { - return x - 101 + return x - 101; } else if x == 102 { - return x - 102 + return x - 102; } else if x == 103 { - return x - 103 + return x - 103; } else if x == 104 { - return x - 104 + return x - 104; } else if x == 105 { - return x - 105 + return x - 105; } else if x == 106 { - return x - 106 + return x - 106; } else if x == 107 { - return x - 107 + return x - 107; } else if x == 108 { - return x - 108 + return x - 108; } else if x == 109 { - return x - 109 + return x - 109; } else if x == 110 { - return x - 110 + return x - 110; } else if x == 111 { - return x - 111 + return x - 111; } else if x == 112 { - return x - 112 + return x - 112; } else if x == 113 { - return x - 113 + return x - 113; } else if x == 114 { - return x - 114 + return x - 114; } else if x == 115 { - return x - 115 + return x - 115; } else if x == 116 { - return x - 116 + return x - 116; } else if x == 117 { - return x - 117 + return x - 117; } else if x == 118 { - return x - 118 + return x - 118; } else if x == 119 { - return x - 119 + return x - 119; } else if x == 120 { - return x - 120 + return x - 120; } else if x == 121 { - return x - 121 + return x - 121; } else if x == 122 { - return x - 122 + return x - 122; } else if x == 123 { - return x - 123 + return x - 123; } else if x == 124 { - return x - 124 + return x - 124; } else if x == 125 { - return x - 125 + return x - 125; } else if x == 126 { - return x - 126 + return x - 126; } else if x == 127 { - return x - 127 + return x - 127; } else if x == 128 { - return x - 128 + return x - 128; } else if x == 129 { - return x - 129 + return x - 129; } else if x == 130 { - return x - 130 + return x - 130; } else if x == 131 { - return x - 131 + return x - 131; } else if x == 132 { - return x - 132 + return x - 132; } else if x == 133 { - return x - 133 + return x - 133; } else if x == 134 { - return x - 134 + return x - 134; } else if x == 135 { - return x - 135 + return x - 135; } else if x == 136 { - return x - 136 + return x - 136; } else if x == 137 { - return x - 137 + return x - 137; } else if x == 138 { - return x - 138 + return x - 138; } else if x == 139 { - return x - 139 + return x - 139; } else if x == 140 { - return x - 140 + return x - 140; } else if x == 141 { - return x - 141 + return x - 141; } else if x == 142 { - return x - 142 + return x - 142; } else if x == 143 { - return x - 143 + return x - 143; } else if x == 144 { - return x - 144 + return x - 144; } else if x == 145 { - return x - 145 + return x - 145; } else if x == 146 { - return x - 146 + return x - 146; } else if x == 147 { - return x - 147 + return x - 147; } else if x == 148 { - return x - 148 + return x - 148; } else if x == 149 { - return x - 149 + return x - 149; } else if x == 150 { - return x - 150 + return x - 150; } else if x == 151 { - return x - 151 + return x - 151; } else if x == 152 { - return x - 152 + return x - 152; } else if x == 153 { - return x - 153 + return x - 153; } else if x == 154 { - return x - 154 + return x - 154; } else if x == 155 { - return x - 155 + return x - 155; } else if x == 156 { - return x - 156 + return x - 156; } else if x == 157 { - return x - 157 + return x - 157; } else if x == 158 { - return x - 158 + return x - 158; } else if x == 159 { - return x - 159 + return x - 159; } else if x == 160 { - return x - 160 + return x - 160; } else if x == 161 { - return x - 161 + return x - 161; } else if x == 162 { - return x - 162 + return x - 162; } else if x == 163 { - return x - 163 + return x - 163; } else if x == 164 { - return x - 164 + return x - 164; } else if x == 165 { - return x - 165 + return x - 165; } else if x == 166 { - return x - 166 + return x - 166; } else if x == 167 { - return x - 167 + return x - 167; } else if x == 168 { - return x - 168 + return x - 168; } else if x == 169 { - return x - 169 + return x - 169; } else if x == 170 { - return x - 170 + return x - 170; } else if x == 171 { - return x - 171 + return x - 171; } else if x == 172 { - return x - 172 + return x - 172; } else if x == 173 { - return x - 173 + return x - 173; } else if x == 174 { - return x - 174 + return x - 174; } else if x == 175 { - return x - 175 + return x - 175; } else if x == 176 { - return x - 176 + return x - 176; } else if x == 177 { - return x - 177 + return x - 177; } else if x == 178 { - return x - 178 + return x - 178; } else if x == 179 { - return x - 179 + return x - 179; } else if x == 180 { - return x - 180 + return x - 180; } else if x == 181 { - return x - 181 + return x - 181; } else if x == 182 { - return x - 182 + return x - 182; } else if x == 183 { - return x - 183 + return x - 183; } else if x == 184 { - return x - 184 + return x - 184; } else if x == 185 { - return x - 185 + return x - 185; } else if x == 186 { - return x - 186 + return x - 186; } else if x == 187 { - return x - 187 + return x - 187; } else if x == 188 { - return x - 188 + return x - 188; } else if x == 189 { - return x - 189 + return x - 189; } else if x == 190 { - return x - 190 + return x - 190; } else if x == 191 { - return x - 191 + return x - 191; } } \ No newline at end of file diff --git a/parser/benches/big_ternary.leo b/parser/benches/big_ternary.leo index 46e9cd6aed..ccc0b55a51 100644 --- a/parser/benches/big_ternary.leo +++ b/parser/benches/big_ternary.leo @@ -1,5 +1,5 @@ function main() { const x: u8 = 255; - return x == 0 ? x : (x == 1 ? x : (x == 2 ? x : (x == 3 ? x : (x == 4 ? x : (x == 5 ? x : (x == 6 ? x : (x == 7 ? x : (x == 8 ? x : (x == 9 ? x : (x == 10 ? x : (x == 11 ? x : (x == 12 ? x : (x == 13 ? x : (x == 14 ? x : (x == 15 ? x : (x == 16 ? x : (x == 17 ? x : (x == 18 ? x : (x == 19 ? x : (x == 20 ? x : (x == 21 ? x : (x == 22 ? x : (x == 23 ? x : (x == 24 ? x : (x == 25 ? x : (x == 26 ? x : (x == 27 ? x : (x == 28 ? x : (x == 29 ? x : (x == 30 ? x : (x == 31 ? x : (x == 32 ? x : (x == 33 ? x : (x == 34 ? x : (x == 35 ? x : (x == 36 ? x : (x == 37 ? x : (x == 38 ? x : (x == 39 ? x : (x == 40 ? x : (x == 41 ? x : (x == 42 ? x : (x == 43 ? x : (x == 44 ? x : (x == 45 ? x : (x == 46 ? x : (x == 47 ? x : (x == 48 ? x : (x == 49 ? x : (x == 50 ? x : (x == 51 ? x : (x == 52 ? x : (x == 53 ? x : (x == 54 ? x : (x == 55 ? x : (x == 56 ? x : (x == 57 ? x : (x == 58 ? x : (x == 59 ? x : (x == 60 ? x : (x == 61 ? x : (x == 62 ? x : (x == 63 ? x : (x == 64 ? x : (x == 65 ? x : (x == 66 ? x : (x == 67 ? x : (x == 68 ? x : (x == 69 ? x : (x == 70 ? x : (x == 71 ? x : (x == 72 ? x : (x == 73 ? x : (x == 74 ? x : (x == 75 ? x : (x == 76 ? x : (x == 77 ? x : (x == 78 ? x : (x == 79 ? x : (x == 80 ? x : (x == 81 ? x : (x == 82 ? x : (x == 83 ? x : (x == 84 ? x : (x == 85 ? x : (x == 86 ? x : (x == 87 ? x : (x == 88 ? x : (x == 89 ? x : (x == 90 ? x : (x == 91 ? x : (x == 92 ? x : (x == 93 ? x : (x == 94 ? x : (x == 95 ? x : (x == 96 ? x : (x == 97 ? x : (x == 98 ? x : (x == 99 ? x : (x == 100 ? x : (x == 101 ? x : (x == 102 ? x : (x == 103 ? x : (x == 104 ? x : (x == 105 ? x : (x == 106 ? x : (x == 107 ? x : (x == 108 ? x : (x == 109 ? x : (x == 110 ? x : (x == 111 ? x : (x == 112 ? x : (x == 113 ? x : (x == 114 ? x : (x == 115 ? x : (x == 116 ? x : (x == 117 ? x : (x == 118 ? x : (x == 119 ? x : (x == 120 ? x : (x == 121 ? x : (x == 122 ? x : (x == 123 ? x : (x == 124 ? x : (x == 125 ? x : (x == 126 ? x : (x == 127 ? x : (x == 128 ? x : (x == 129 ? x : (x == 130 ? x : (x == 131 ? x : (x == 132 ? x : (x == 133 ? x : (x == 134 ? x : (x == 135 ? x : (x == 136 ? x : (x == 137 ? x : (x == 138 ? x : (x == 139 ? x : (x == 140 ? x : (x == 141 ? x : (x == 142 ? x : (x == 143 ? x : (x == 144 ? x : (x == 145 ? x : (x == 146 ? x : (x == 147 ? x : (x == 148 ? x : (x == 149 ? x : (x == 150 ? x : (x == 151 ? x : (x == 152 ? x : (x == 153 ? x : (x == 154 ? x : (x == 155 ? x : (x == 156 ? x : (x == 157 ? x : (x == 158 ? x : (x == 159 ? x : (x == 160 ? x : (x == 161 ? x : (x == 162 ? x : (x == 163 ? x : (x == 164 ? x : (x == 165 ? x : (x == 166 ? x : (x == 167 ? x : (x == 168 ? x : (x == 169 ? x : (x == 170 ? x : (x == 171 ? x : (x == 172 ? x : (x == 173 ? x : (x == 174 ? x : (x == 175 ? x : (x == 176 ? x : (x == 177 ? x : (x == 178 ? x : (x == 179 ? x : (x == 180 ? x : (x == 181 ? x : (x == 182 ? x : (x == 183 ? x : (x == 184 ? x : (x == 185 ? x : (x == 186 ? x : (x == 187 ? x : (x == 188 ? x : (x == 189 ? x : (x == 190 ? x : (x == 191 ? x : (x == 192 ? x : (x == 193 ? x : (x == 194 ? x : (x == 195 ? x : (x == 196 ? x : (x == 197 ? x : (x == 198 ? x : (x == 199 ? x : (x == 200 ? x : (x == 201 ? x : (x == 202 ? x : (x == 203 ? x : (x == 204 ? x : (x == 205 ? x : (x == 206 ? x : (x == 207 ? x : (x == 208 ? x : (x == 209 ? x : (x == 210 ? x : (x == 211 ? x : (x == 212 ? x : (x == 213 ? x : (x == 214 ? x : (x == 215 ? x : (x == 216 ? x : (x == 217 ? x : (x == 218 ? x : (x == 219 ? x : (x == 220 ? x : (x == 221 ? x : (x == 222 ? x : (x == 223 ? x : (x == 224 ? x : (x == 225 ? x : (x == 226 ? x : (x == 227 ? x : (x == 228 ? x : (x == 229 ? x : (x == 230 ? x : (x == 231 ? x : (x == 232 ? x : (x == 233 ? x : (x == 234 ? x : (x == 235 ? x : (x == 236 ? x : (x == 237 ? x : (x == 238 ? x : (x == 239 ? x : (x == 240 ? x : (x == 241 ? x : (x == 242 ? x : (x == 243 ? x : (x == 244 ? x : (x == 245 ? x : (x == 246 ? x : (x == 247 ? x : (x == 248 ? x : (x == 249 ? x : (x == 250 ? x : (x == 251 ? x : (x == 252 ? x : (x == 253 ? x : (x == 254 ? x : (x == 255 ? x : 0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + return x == 0 ? x : (x == 1 ? x : (x == 2 ? x : (x == 3 ? x : (x == 4 ? x : (x == 5 ? x : (x == 6 ? x : (x == 7 ? x : (x == 8 ? x : (x == 9 ? x : (x == 10 ? x : (x == 11 ? x : (x == 12 ? x : (x == 13 ? x : (x == 14 ? x : (x == 15 ? x : (x == 16 ? x : (x == 17 ? x : (x == 18 ? x : (x == 19 ? x : (x == 20 ? x : (x == 21 ? x : (x == 22 ? x : (x == 23 ? x : (x == 24 ? x : (x == 25 ? x : (x == 26 ? x : (x == 27 ? x : (x == 28 ? x : (x == 29 ? x : (x == 30 ? x : (x == 31 ? x : (x == 32 ? x : (x == 33 ? x : (x == 34 ? x : (x == 35 ? x : (x == 36 ? x : (x == 37 ? x : (x == 38 ? x : (x == 39 ? x : (x == 40 ? x : (x == 41 ? x : (x == 42 ? x : (x == 43 ? x : (x == 44 ? x : (x == 45 ? x : (x == 46 ? x : (x == 47 ? x : (x == 48 ? x : (x == 49 ? x : (x == 50 ? x : (x == 51 ? x : (x == 52 ? x : (x == 53 ? x : (x == 54 ? x : (x == 55 ? x : (x == 56 ? x : (x == 57 ? x : (x == 58 ? x : (x == 59 ? x : (x == 60 ? x : (x == 61 ? x : (x == 62 ? x : (x == 63 ? x : (x == 64 ? x : (x == 65 ? x : (x == 66 ? x : (x == 67 ? x : (x == 68 ? x : (x == 69 ? x : (x == 70 ? x : (x == 71 ? x : (x == 72 ? x : (x == 73 ? x : (x == 74 ? x : (x == 75 ? x : (x == 76 ? x : (x == 77 ? x : (x == 78 ? x : (x == 79 ? x : (x == 80 ? x : (x == 81 ? x : (x == 82 ? x : (x == 83 ? x : (x == 84 ? x : (x == 85 ? x : (x == 86 ? x : (x == 87 ? x : (x == 88 ? x : (x == 89 ? x : (x == 90 ? x : (x == 91 ? x : (x == 92 ? x : (x == 93 ? x : (x == 94 ? x : (x == 95 ? x : (x == 96 ? x : (x == 97 ? x : (x == 98 ? x : (x == 99 ? x : (x == 100 ? x : (x == 101 ? x : (x == 102 ? x : (x == 103 ? x : (x == 104 ? x : (x == 105 ? x : (x == 106 ? x : (x == 107 ? x : (x == 108 ? x : (x == 109 ? x : (x == 110 ? x : (x == 111 ? x : (x == 112 ? x : (x == 113 ? x : (x == 114 ? x : (x == 115 ? x : (x == 116 ? x : (x == 117 ? x : (x == 118 ? x : (x == 119 ? x : (x == 120 ? x : (x == 121 ? x : (x == 122 ? x : (x == 123 ? x : (x == 124 ? x : (x == 125 ? x : (x == 126 ? x : (x == 127 ? x : (x == 128 ? x : (x == 129 ? x : (x == 130 ? x : (x == 131 ? x : (x == 132 ? x : (x == 133 ? x : (x == 134 ? x : (x == 135 ? x : (x == 136 ? x : (x == 137 ? x : (x == 138 ? x : (x == 139 ? x : (x == 140 ? x : (x == 141 ? x : (x == 142 ? x : (x == 143 ? x : (x == 144 ? x : (x == 145 ? x : (x == 146 ? x : (x == 147 ? x : (x == 148 ? x : (x == 149 ? x : (x == 150 ? x : (x == 151 ? x : (x == 152 ? x : (x == 153 ? x : (x == 154 ? x : (x == 155 ? x : (x == 156 ? x : (x == 157 ? x : (x == 158 ? x : (x == 159 ? x : (x == 160 ? x : (x == 161 ? x : (x == 162 ? x : (x == 163 ? x : (x == 164 ? x : (x == 165 ? x : (x == 166 ? x : (x == 167 ? x : (x == 168 ? x : (x == 169 ? x : (x == 170 ? x : (x == 171 ? x : (x == 172 ? x : (x == 173 ? x : (x == 174 ? x : (x == 175 ? x : (x == 176 ? x : (x == 177 ? x : (x == 178 ? x : (x == 179 ? x : (x == 180 ? x : (x == 181 ? x : (x == 182 ? x : (x == 183 ? x : (x == 184 ? x : (x == 185 ? x : (x == 186 ? x : (x == 187 ? x : (x == 188 ? x : (x == 189 ? x : (x == 190 ? x : (x == 191 ? x : (x == 192 ? x : (x == 193 ? x : (x == 194 ? x : (x == 195 ? x : (x == 196 ? x : (x == 197 ? x : (x == 198 ? x : (x == 199 ? x : (x == 200 ? x : (x == 201 ? x : (x == 202 ? x : (x == 203 ? x : (x == 204 ? x : (x == 205 ? x : (x == 206 ? x : (x == 207 ? x : (x == 208 ? x : (x == 209 ? x : (x == 210 ? x : (x == 211 ? x : (x == 212 ? x : (x == 213 ? x : (x == 214 ? x : (x == 215 ? x : (x == 216 ? x : (x == 217 ? x : (x == 218 ? x : (x == 219 ? x : (x == 220 ? x : (x == 221 ? x : (x == 222 ? x : (x == 223 ? x : (x == 224 ? x : (x == 225 ? x : (x == 226 ? x : (x == 227 ? x : (x == 228 ? x : (x == 229 ? x : (x == 230 ? x : (x == 231 ? x : (x == 232 ? x : (x == 233 ? x : (x == 234 ? x : (x == 235 ? x : (x == 236 ? x : (x == 237 ? x : (x == 238 ? x : (x == 239 ? x : (x == 240 ? x : (x == 241 ? x : (x == 242 ? x : (x == 243 ? x : (x == 244 ? x : (x == 245 ? x : (x == 246 ? x : (x == 247 ? x : (x == 248 ? x : (x == 249 ? x : (x == 250 ? x : (x == 251 ? x : (x == 252 ? x : (x == 253 ? x : (x == 254 ? x : (x == 255 ? x : 0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); } \ No newline at end of file diff --git a/parser/benches/long_array.leo b/parser/benches/long_array.leo index 48094244b6..bd8e914940 100644 --- a/parser/benches/long_array.leo +++ b/parser/benches/long_array.leo @@ -53,5 +53,5 @@ function main() { [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31] ]; - return arr1[31][31] + arr2[15][31] + return arr1[31][31] + arr2[15][31]; } diff --git a/parser/benches/long_expr.leo b/parser/benches/long_expr.leo index 31cf1e0641..f6bc95d633 100644 --- a/parser/benches/long_expr.leo +++ b/parser/benches/long_expr.leo @@ -5,5 +5,5 @@ function main() { const d = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; const e = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1; - return a + b + c + d + e + return a + b + c + d + e; } diff --git a/parser/benches/many_assigns.leo b/parser/benches/many_assigns.leo index 202bbf0da4..60d7a38620 100644 --- a/parser/benches/many_assigns.leo +++ b/parser/benches/many_assigns.leo @@ -384,5 +384,5 @@ function main() { const x382: u8 = x381; const x383: u8 = x382; - return x383 + return x383; } diff --git a/parser/benches/many_foos.leo b/parser/benches/many_foos.leo index 099f04857d..64967e3950 100644 --- a/parser/benches/many_foos.leo +++ b/parser/benches/many_foos.leo @@ -1,196 +1,196 @@ function main() { - return x191(0u32) + return x191(0u32); } -function x0(val: u8) -> u8 { return val } -function x1(val: u8) -> u8 { return x0(val) } -function x2(val: u8) -> u8 { return x1(val) } -function x3(val: u8) -> u8 { return x2(val) } -function x4(val: u8) -> u8 { return x3(val) } -function x5(val: u8) -> u8 { return x4(val) } -function x6(val: u8) -> u8 { return x5(val) } -function x7(val: u8) -> u8 { return x6(val) } -function x8(val: u8) -> u8 { return x7(val) } -function x9(val: u8) -> u8 { return x8(val) } -function x10(val: u8) -> u8 { return x9(val) } -function x11(val: u8) -> u8 { return x10(val) } -function x12(val: u8) -> u8 { return x11(val) } -function x13(val: u8) -> u8 { return x12(val) } -function x14(val: u8) -> u8 { return x13(val) } -function x15(val: u8) -> u8 { return x14(val) } -function x16(val: u8) -> u8 { return x15(val) } -function x17(val: u8) -> u8 { return x16(val) } -function x18(val: u8) -> u8 { return x17(val) } -function x19(val: u8) -> u8 { return x18(val) } -function x20(val: u8) -> u8 { return x19(val) } -function x21(val: u8) -> u8 { return x20(val) } -function x22(val: u8) -> u8 { return x21(val) } -function x23(val: u8) -> u8 { return x22(val) } -function x24(val: u8) -> u8 { return x23(val) } -function x25(val: u8) -> u8 { return x24(val) } -function x26(val: u8) -> u8 { return x25(val) } -function x27(val: u8) -> u8 { return x26(val) } -function x28(val: u8) -> u8 { return x27(val) } -function x29(val: u8) -> u8 { return x28(val) } -function x30(val: u8) -> u8 { return x29(val) } -function x31(val: u8) -> u8 { return x30(val) } -function x32(val: u8) -> u8 { return x31(val) } -function x33(val: u8) -> u8 { return x32(val) } -function x34(val: u8) -> u8 { return x33(val) } -function x35(val: u8) -> u8 { return x34(val) } -function x36(val: u8) -> u8 { return x35(val) } -function x37(val: u8) -> u8 { return x36(val) } -function x38(val: u8) -> u8 { return x37(val) } -function x39(val: u8) -> u8 { return x38(val) } -function x40(val: u8) -> u8 { return x39(val) } -function x41(val: u8) -> u8 { return x40(val) } -function x42(val: u8) -> u8 { return x41(val) } -function x43(val: u8) -> u8 { return x42(val) } -function x44(val: u8) -> u8 { return x43(val) } -function x45(val: u8) -> u8 { return x44(val) } -function x46(val: u8) -> u8 { return x45(val) } -function x47(val: u8) -> u8 { return x46(val) } -function x48(val: u8) -> u8 { return x47(val) } -function x49(val: u8) -> u8 { return x48(val) } -function x50(val: u8) -> u8 { return x49(val) } -function x51(val: u8) -> u8 { return x50(val) } -function x52(val: u8) -> u8 { return x51(val) } -function x53(val: u8) -> u8 { return x52(val) } -function x54(val: u8) -> u8 { return x53(val) } -function x55(val: u8) -> u8 { return x54(val) } -function x56(val: u8) -> u8 { return x55(val) } -function x57(val: u8) -> u8 { return x56(val) } -function x58(val: u8) -> u8 { return x57(val) } -function x59(val: u8) -> u8 { return x58(val) } -function x60(val: u8) -> u8 { return x59(val) } -function x61(val: u8) -> u8 { return x60(val) } -function x62(val: u8) -> u8 { return x61(val) } -function x63(val: u8) -> u8 { return x62(val) } -function x64(val: u8) -> u8 { return x63(val) } -function x65(val: u8) -> u8 { return x64(val) } -function x66(val: u8) -> u8 { return x65(val) } -function x67(val: u8) -> u8 { return x66(val) } -function x68(val: u8) -> u8 { return x67(val) } -function x69(val: u8) -> u8 { return x68(val) } -function x70(val: u8) -> u8 { return x69(val) } -function x71(val: u8) -> u8 { return x70(val) } -function x72(val: u8) -> u8 { return x71(val) } -function x73(val: u8) -> u8 { return x72(val) } -function x74(val: u8) -> u8 { return x73(val) } -function x75(val: u8) -> u8 { return x74(val) } -function x76(val: u8) -> u8 { return x75(val) } -function x77(val: u8) -> u8 { return x76(val) } -function x78(val: u8) -> u8 { return x77(val) } -function x79(val: u8) -> u8 { return x78(val) } -function x80(val: u8) -> u8 { return x79(val) } -function x81(val: u8) -> u8 { return x80(val) } -function x82(val: u8) -> u8 { return x81(val) } -function x83(val: u8) -> u8 { return x82(val) } -function x84(val: u8) -> u8 { return x83(val) } -function x85(val: u8) -> u8 { return x84(val) } -function x86(val: u8) -> u8 { return x85(val) } -function x87(val: u8) -> u8 { return x86(val) } -function x88(val: u8) -> u8 { return x87(val) } -function x89(val: u8) -> u8 { return x88(val) } -function x90(val: u8) -> u8 { return x89(val) } -function x91(val: u8) -> u8 { return x90(val) } -function x92(val: u8) -> u8 { return x91(val) } -function x93(val: u8) -> u8 { return x92(val) } -function x94(val: u8) -> u8 { return x93(val) } -function x95(val: u8) -> u8 { return x94(val) } -function x96(val: u8) -> u8 { return x95(val) } -function x97(val: u8) -> u8 { return x96(val) } -function x98(val: u8) -> u8 { return x97(val) } -function x99(val: u8) -> u8 { return x98(val) } -function x100(val: u8) -> u8 { return x99(val) } -function x101(val: u8) -> u8 { return x100(val) } -function x102(val: u8) -> u8 { return x101(val) } -function x103(val: u8) -> u8 { return x102(val) } -function x104(val: u8) -> u8 { return x103(val) } -function x105(val: u8) -> u8 { return x104(val) } -function x106(val: u8) -> u8 { return x105(val) } -function x107(val: u8) -> u8 { return x106(val) } -function x108(val: u8) -> u8 { return x107(val) } -function x109(val: u8) -> u8 { return x108(val) } -function x110(val: u8) -> u8 { return x109(val) } -function x111(val: u8) -> u8 { return x110(val) } -function x112(val: u8) -> u8 { return x111(val) } -function x113(val: u8) -> u8 { return x112(val) } -function x114(val: u8) -> u8 { return x113(val) } -function x115(val: u8) -> u8 { return x114(val) } -function x116(val: u8) -> u8 { return x115(val) } -function x117(val: u8) -> u8 { return x116(val) } -function x118(val: u8) -> u8 { return x117(val) } -function x119(val: u8) -> u8 { return x118(val) } -function x120(val: u8) -> u8 { return x119(val) } -function x121(val: u8) -> u8 { return x120(val) } -function x122(val: u8) -> u8 { return x121(val) } -function x123(val: u8) -> u8 { return x122(val) } -function x124(val: u8) -> u8 { return x123(val) } -function x125(val: u8) -> u8 { return x124(val) } -function x126(val: u8) -> u8 { return x125(val) } -function x127(val: u8) -> u8 { return x126(val) } -function x128(val: u8) -> u8 { return x127(val) } -function x129(val: u8) -> u8 { return x128(val) } -function x130(val: u8) -> u8 { return x129(val) } -function x131(val: u8) -> u8 { return x130(val) } -function x132(val: u8) -> u8 { return x131(val) } -function x133(val: u8) -> u8 { return x132(val) } -function x134(val: u8) -> u8 { return x133(val) } -function x135(val: u8) -> u8 { return x134(val) } -function x136(val: u8) -> u8 { return x135(val) } -function x137(val: u8) -> u8 { return x136(val) } -function x138(val: u8) -> u8 { return x137(val) } -function x139(val: u8) -> u8 { return x138(val) } -function x140(val: u8) -> u8 { return x139(val) } -function x141(val: u8) -> u8 { return x140(val) } -function x142(val: u8) -> u8 { return x141(val) } -function x143(val: u8) -> u8 { return x142(val) } -function x144(val: u8) -> u8 { return x143(val) } -function x145(val: u8) -> u8 { return x144(val) } -function x146(val: u8) -> u8 { return x145(val) } -function x147(val: u8) -> u8 { return x146(val) } -function x148(val: u8) -> u8 { return x147(val) } -function x149(val: u8) -> u8 { return x148(val) } -function x150(val: u8) -> u8 { return x149(val) } -function x151(val: u8) -> u8 { return x150(val) } -function x152(val: u8) -> u8 { return x151(val) } -function x153(val: u8) -> u8 { return x152(val) } -function x154(val: u8) -> u8 { return x153(val) } -function x155(val: u8) -> u8 { return x154(val) } -function x156(val: u8) -> u8 { return x155(val) } -function x157(val: u8) -> u8 { return x156(val) } -function x158(val: u8) -> u8 { return x157(val) } -function x159(val: u8) -> u8 { return x158(val) } -function x160(val: u8) -> u8 { return x159(val) } -function x161(val: u8) -> u8 { return x160(val) } -function x162(val: u8) -> u8 { return x161(val) } -function x163(val: u8) -> u8 { return x162(val) } -function x164(val: u8) -> u8 { return x163(val) } -function x165(val: u8) -> u8 { return x164(val) } -function x166(val: u8) -> u8 { return x165(val) } -function x167(val: u8) -> u8 { return x166(val) } -function x168(val: u8) -> u8 { return x167(val) } -function x169(val: u8) -> u8 { return x168(val) } -function x170(val: u8) -> u8 { return x169(val) } -function x171(val: u8) -> u8 { return x170(val) } -function x172(val: u8) -> u8 { return x171(val) } -function x173(val: u8) -> u8 { return x172(val) } -function x174(val: u8) -> u8 { return x173(val) } -function x175(val: u8) -> u8 { return x174(val) } -function x176(val: u8) -> u8 { return x175(val) } -function x177(val: u8) -> u8 { return x176(val) } -function x178(val: u8) -> u8 { return x177(val) } -function x179(val: u8) -> u8 { return x178(val) } -function x180(val: u8) -> u8 { return x179(val) } -function x181(val: u8) -> u8 { return x180(val) } -function x182(val: u8) -> u8 { return x181(val) } -function x183(val: u8) -> u8 { return x182(val) } -function x184(val: u8) -> u8 { return x183(val) } -function x185(val: u8) -> u8 { return x184(val) } -function x186(val: u8) -> u8 { return x185(val) } -function x187(val: u8) -> u8 { return x186(val) } -function x188(val: u8) -> u8 { return x187(val) } -function x189(val: u8) -> u8 { return x188(val) } -function x190(val: u8) -> u8 { return x189(val) } -function x191(val: u8) -> u8 { return x190(val) } +function x0(val: u8) -> u8 { return val }; +function x1(val: u8) -> u8 { return x0(val) }; +function x2(val: u8) -> u8 { return x1(val) }; +function x3(val: u8) -> u8 { return x2(val) }; +function x4(val: u8) -> u8 { return x3(val) }; +function x5(val: u8) -> u8 { return x4(val) }; +function x6(val: u8) -> u8 { return x5(val) }; +function x7(val: u8) -> u8 { return x6(val) }; +function x8(val: u8) -> u8 { return x7(val) }; +function x9(val: u8) -> u8 { return x8(val) }; +function x10(val: u8) -> u8 { return x9(val) }; +function x11(val: u8) -> u8 { return x10(val) }; +function x12(val: u8) -> u8 { return x11(val) }; +function x13(val: u8) -> u8 { return x12(val) }; +function x14(val: u8) -> u8 { return x13(val) }; +function x15(val: u8) -> u8 { return x14(val) }; +function x16(val: u8) -> u8 { return x15(val) }; +function x17(val: u8) -> u8 { return x16(val) }; +function x18(val: u8) -> u8 { return x17(val) }; +function x19(val: u8) -> u8 { return x18(val) }; +function x20(val: u8) -> u8 { return x19(val) }; +function x21(val: u8) -> u8 { return x20(val) }; +function x22(val: u8) -> u8 { return x21(val) }; +function x23(val: u8) -> u8 { return x22(val) }; +function x24(val: u8) -> u8 { return x23(val) }; +function x25(val: u8) -> u8 { return x24(val) }; +function x26(val: u8) -> u8 { return x25(val) }; +function x27(val: u8) -> u8 { return x26(val) }; +function x28(val: u8) -> u8 { return x27(val) }; +function x29(val: u8) -> u8 { return x28(val) }; +function x30(val: u8) -> u8 { return x29(val) }; +function x31(val: u8) -> u8 { return x30(val) }; +function x32(val: u8) -> u8 { return x31(val) }; +function x33(val: u8) -> u8 { return x32(val) }; +function x34(val: u8) -> u8 { return x33(val) }; +function x35(val: u8) -> u8 { return x34(val) }; +function x36(val: u8) -> u8 { return x35(val) }; +function x37(val: u8) -> u8 { return x36(val) }; +function x38(val: u8) -> u8 { return x37(val) }; +function x39(val: u8) -> u8 { return x38(val) }; +function x40(val: u8) -> u8 { return x39(val) }; +function x41(val: u8) -> u8 { return x40(val) }; +function x42(val: u8) -> u8 { return x41(val) }; +function x43(val: u8) -> u8 { return x42(val) }; +function x44(val: u8) -> u8 { return x43(val) }; +function x45(val: u8) -> u8 { return x44(val) }; +function x46(val: u8) -> u8 { return x45(val) }; +function x47(val: u8) -> u8 { return x46(val) }; +function x48(val: u8) -> u8 { return x47(val) }; +function x49(val: u8) -> u8 { return x48(val) }; +function x50(val: u8) -> u8 { return x49(val) }; +function x51(val: u8) -> u8 { return x50(val) }; +function x52(val: u8) -> u8 { return x51(val) }; +function x53(val: u8) -> u8 { return x52(val) }; +function x54(val: u8) -> u8 { return x53(val) }; +function x55(val: u8) -> u8 { return x54(val) }; +function x56(val: u8) -> u8 { return x55(val) }; +function x57(val: u8) -> u8 { return x56(val) }; +function x58(val: u8) -> u8 { return x57(val) }; +function x59(val: u8) -> u8 { return x58(val) }; +function x60(val: u8) -> u8 { return x59(val) }; +function x61(val: u8) -> u8 { return x60(val) }; +function x62(val: u8) -> u8 { return x61(val) }; +function x63(val: u8) -> u8 { return x62(val) }; +function x64(val: u8) -> u8 { return x63(val) }; +function x65(val: u8) -> u8 { return x64(val) }; +function x66(val: u8) -> u8 { return x65(val) }; +function x67(val: u8) -> u8 { return x66(val) }; +function x68(val: u8) -> u8 { return x67(val) }; +function x69(val: u8) -> u8 { return x68(val) }; +function x70(val: u8) -> u8 { return x69(val) }; +function x71(val: u8) -> u8 { return x70(val) }; +function x72(val: u8) -> u8 { return x71(val) }; +function x73(val: u8) -> u8 { return x72(val) }; +function x74(val: u8) -> u8 { return x73(val) }; +function x75(val: u8) -> u8 { return x74(val) }; +function x76(val: u8) -> u8 { return x75(val) }; +function x77(val: u8) -> u8 { return x76(val) }; +function x78(val: u8) -> u8 { return x77(val) }; +function x79(val: u8) -> u8 { return x78(val) }; +function x80(val: u8) -> u8 { return x79(val) }; +function x81(val: u8) -> u8 { return x80(val) }; +function x82(val: u8) -> u8 { return x81(val) }; +function x83(val: u8) -> u8 { return x82(val) }; +function x84(val: u8) -> u8 { return x83(val) }; +function x85(val: u8) -> u8 { return x84(val) }; +function x86(val: u8) -> u8 { return x85(val) }; +function x87(val: u8) -> u8 { return x86(val) }; +function x88(val: u8) -> u8 { return x87(val) }; +function x89(val: u8) -> u8 { return x88(val) }; +function x90(val: u8) -> u8 { return x89(val) }; +function x91(val: u8) -> u8 { return x90(val) }; +function x92(val: u8) -> u8 { return x91(val) }; +function x93(val: u8) -> u8 { return x92(val) }; +function x94(val: u8) -> u8 { return x93(val) }; +function x95(val: u8) -> u8 { return x94(val) }; +function x96(val: u8) -> u8 { return x95(val) }; +function x97(val: u8) -> u8 { return x96(val) }; +function x98(val: u8) -> u8 { return x97(val) }; +function x99(val: u8) -> u8 { return x98(val) }; +function x100(val: u8) -> u8 { return x99(val) }; +function x101(val: u8) -> u8 { return x100(val) }; +function x102(val: u8) -> u8 { return x101(val) }; +function x103(val: u8) -> u8 { return x102(val) }; +function x104(val: u8) -> u8 { return x103(val) }; +function x105(val: u8) -> u8 { return x104(val) }; +function x106(val: u8) -> u8 { return x105(val) }; +function x107(val: u8) -> u8 { return x106(val) }; +function x108(val: u8) -> u8 { return x107(val) }; +function x109(val: u8) -> u8 { return x108(val) }; +function x110(val: u8) -> u8 { return x109(val) }; +function x111(val: u8) -> u8 { return x110(val) }; +function x112(val: u8) -> u8 { return x111(val) }; +function x113(val: u8) -> u8 { return x112(val) }; +function x114(val: u8) -> u8 { return x113(val) }; +function x115(val: u8) -> u8 { return x114(val) }; +function x116(val: u8) -> u8 { return x115(val) }; +function x117(val: u8) -> u8 { return x116(val) }; +function x118(val: u8) -> u8 { return x117(val) }; +function x119(val: u8) -> u8 { return x118(val) }; +function x120(val: u8) -> u8 { return x119(val) }; +function x121(val: u8) -> u8 { return x120(val) }; +function x122(val: u8) -> u8 { return x121(val) }; +function x123(val: u8) -> u8 { return x122(val) }; +function x124(val: u8) -> u8 { return x123(val) }; +function x125(val: u8) -> u8 { return x124(val) }; +function x126(val: u8) -> u8 { return x125(val) }; +function x127(val: u8) -> u8 { return x126(val) }; +function x128(val: u8) -> u8 { return x127(val) }; +function x129(val: u8) -> u8 { return x128(val) }; +function x130(val: u8) -> u8 { return x129(val) }; +function x131(val: u8) -> u8 { return x130(val) }; +function x132(val: u8) -> u8 { return x131(val) }; +function x133(val: u8) -> u8 { return x132(val) }; +function x134(val: u8) -> u8 { return x133(val) }; +function x135(val: u8) -> u8 { return x134(val) }; +function x136(val: u8) -> u8 { return x135(val) }; +function x137(val: u8) -> u8 { return x136(val) }; +function x138(val: u8) -> u8 { return x137(val) }; +function x139(val: u8) -> u8 { return x138(val) }; +function x140(val: u8) -> u8 { return x139(val) }; +function x141(val: u8) -> u8 { return x140(val) }; +function x142(val: u8) -> u8 { return x141(val) }; +function x143(val: u8) -> u8 { return x142(val) }; +function x144(val: u8) -> u8 { return x143(val) }; +function x145(val: u8) -> u8 { return x144(val) }; +function x146(val: u8) -> u8 { return x145(val) }; +function x147(val: u8) -> u8 { return x146(val) }; +function x148(val: u8) -> u8 { return x147(val) }; +function x149(val: u8) -> u8 { return x148(val) }; +function x150(val: u8) -> u8 { return x149(val) }; +function x151(val: u8) -> u8 { return x150(val) }; +function x152(val: u8) -> u8 { return x151(val) }; +function x153(val: u8) -> u8 { return x152(val) }; +function x154(val: u8) -> u8 { return x153(val) }; +function x155(val: u8) -> u8 { return x154(val) }; +function x156(val: u8) -> u8 { return x155(val) }; +function x157(val: u8) -> u8 { return x156(val) }; +function x158(val: u8) -> u8 { return x157(val) }; +function x159(val: u8) -> u8 { return x158(val) }; +function x160(val: u8) -> u8 { return x159(val) }; +function x161(val: u8) -> u8 { return x160(val) }; +function x162(val: u8) -> u8 { return x161(val) }; +function x163(val: u8) -> u8 { return x162(val) }; +function x164(val: u8) -> u8 { return x163(val) }; +function x165(val: u8) -> u8 { return x164(val) }; +function x166(val: u8) -> u8 { return x165(val) }; +function x167(val: u8) -> u8 { return x166(val) }; +function x168(val: u8) -> u8 { return x167(val) }; +function x169(val: u8) -> u8 { return x168(val) }; +function x170(val: u8) -> u8 { return x169(val) }; +function x171(val: u8) -> u8 { return x170(val) }; +function x172(val: u8) -> u8 { return x171(val) }; +function x173(val: u8) -> u8 { return x172(val) }; +function x174(val: u8) -> u8 { return x173(val) }; +function x175(val: u8) -> u8 { return x174(val) }; +function x176(val: u8) -> u8 { return x175(val) }; +function x177(val: u8) -> u8 { return x176(val) }; +function x178(val: u8) -> u8 { return x177(val) }; +function x179(val: u8) -> u8 { return x178(val) }; +function x180(val: u8) -> u8 { return x179(val) }; +function x181(val: u8) -> u8 { return x180(val) }; +function x182(val: u8) -> u8 { return x181(val) }; +function x183(val: u8) -> u8 { return x182(val) }; +function x184(val: u8) -> u8 { return x183(val) }; +function x185(val: u8) -> u8 { return x184(val) }; +function x186(val: u8) -> u8 { return x185(val) }; +function x187(val: u8) -> u8 { return x186(val) }; +function x188(val: u8) -> u8 { return x187(val) }; +function x189(val: u8) -> u8 { return x188(val) }; +function x190(val: u8) -> u8 { return x189(val) }; +function x191(val: u8) -> u8 { return x190(val) }; diff --git a/parser/src/parser/statement.rs b/parser/src/parser/statement.rs index 002cc0363a..906abc11dd 100644 --- a/parser/src/parser/statement.rs +++ b/parser/src/parser/statement.rs @@ -167,7 +167,7 @@ impl ParserContext { pub fn parse_return_statement(&mut self) -> SyntaxResult { let start = self.expect(Token::Return)?; let expr = self.parse_expression()?; - self.eat(Token::Semicolon); + self.expect(Token::Semicolon)?; Ok(ReturnStatement { span: &start + expr.span(), diff --git a/parser/tests/serialization/deprecated_error.leo b/parser/tests/serialization/deprecated_error.leo index ce128173b5..d1ce342312 100644 --- a/parser/tests/serialization/deprecated_error.leo +++ b/parser/tests/serialization/deprecated_error.leo @@ -1,5 +1,5 @@ function main() { - return 1 + 1 + return 1 + 1; } test function old { diff --git a/parser/tests/serialization/main.leo b/parser/tests/serialization/main.leo index ef22115243..b12eb1ae6b 100644 --- a/parser/tests/serialization/main.leo +++ b/parser/tests/serialization/main.leo @@ -1,3 +1,3 @@ function main() { - return 1 + 1 + return 1 + 1; } diff --git a/tests/old/fail/circuits/self_circuit.leo b/tests/old/fail/circuits/self_circuit.leo index 18329433f7..6faa42278b 100644 --- a/tests/old/fail/circuits/self_circuit.leo +++ b/tests/old/fail/circuits/self_circuit.leo @@ -1,6 +1,6 @@ circuit Foo { static function new() -> Self { - return Self { } + return Self { }; } } diff --git a/tests/old/pass/array/registers.leo b/tests/old/pass/array/registers.leo index fb8980868e..a6d29145e5 100644 --- a/tests/old/pass/array/registers.leo +++ b/tests/old/pass/array/registers.leo @@ -1,3 +1,3 @@ function main(input) -> [u8; 3] { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/tests/old/pass/boolean/output_register.leo b/tests/old/pass/boolean/output_register.leo index fb01d41dbe..618868a2fb 100644 --- a/tests/old/pass/boolean/output_register.leo +++ b/tests/old/pass/boolean/output_register.leo @@ -1,3 +1,3 @@ function main(input) -> bool { - return input.registers.r + return input.registers.r; } \ No newline at end of file diff --git a/tests/old/pass/circuits/duplicate_name_context.leo b/tests/old/pass/circuits/duplicate_name_context.leo index 66640e75a2..8644d27fcb 100644 --- a/tests/old/pass/circuits/duplicate_name_context.leo +++ b/tests/old/pass/circuits/duplicate_name_context.leo @@ -2,7 +2,7 @@ circuit Bar { b2: u32 function add_five(z:u32) -> u32 { - return z+5u32 + return z+5u32; } } diff --git a/tests/old/pass/circuits/inline_member_pass.leo b/tests/old/pass/circuits/inline_member_pass.leo index 8e58e4935a..6fd7f7dff7 100644 --- a/tests/old/pass/circuits/inline_member_pass.leo +++ b/tests/old/pass/circuits/inline_member_pass.leo @@ -2,7 +2,7 @@ circuit Foo { x: u8 function new(x: u8) -> Self { - return Self { x } + return Self { x }; } } diff --git a/tests/old/pass/circuits/member_function.leo b/tests/old/pass/circuits/member_function.leo index 258b6c675e..eee44be448 100644 --- a/tests/old/pass/circuits/member_function.leo +++ b/tests/old/pass/circuits/member_function.leo @@ -2,7 +2,7 @@ circuit Foo { x: u32, function echo(self) -> u32 { - return self.x + return self.x; } } diff --git a/tests/old/pass/circuits/member_function_fail.leo b/tests/old/pass/circuits/member_function_fail.leo index 5a1c4100c5..57b15383a3 100644 --- a/tests/old/pass/circuits/member_function_fail.leo +++ b/tests/old/pass/circuits/member_function_fail.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_function_invalid.leo b/tests/old/pass/circuits/member_function_invalid.leo index aa689eb976..7283cf144d 100644 --- a/tests/old/pass/circuits/member_function_invalid.leo +++ b/tests/old/pass/circuits/member_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_function_nested.leo b/tests/old/pass/circuits/member_function_nested.leo index e512c9df52..b8bf172947 100644 --- a/tests/old/pass/circuits/member_function_nested.leo +++ b/tests/old/pass/circuits/member_function_nested.leo @@ -2,11 +2,11 @@ circuit Foo { x: u32, function add_x(self, y: u32) -> u32 { - return self.x + y + return self.x + y; } function call_add_x(self, y: u32) -> u32 { - return self.add_x(y) + return self.add_x(y); } } diff --git a/tests/old/pass/circuits/member_static_function.leo b/tests/old/pass/circuits/member_static_function.leo index 9d53314f27..68f6065754 100644 --- a/tests/old/pass/circuits/member_static_function.leo +++ b/tests/old/pass/circuits/member_static_function.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_static_function_invalid.leo b/tests/old/pass/circuits/member_static_function_invalid.leo index 7829b4b430..b886cff8fa 100644 --- a/tests/old/pass/circuits/member_static_function_invalid.leo +++ b/tests/old/pass/circuits/member_static_function_invalid.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_static_function_undefined.leo b/tests/old/pass/circuits/member_static_function_undefined.leo index ece1d00963..121c80e34c 100644 --- a/tests/old/pass/circuits/member_static_function_undefined.leo +++ b/tests/old/pass/circuits/member_static_function_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function echo(x: u32) -> u32 { - return x + return x; } } diff --git a/tests/old/pass/circuits/member_variable_and_function.leo b/tests/old/pass/circuits/member_variable_and_function.leo index 3b90db7eaa..f90cdca072 100644 --- a/tests/old/pass/circuits/member_variable_and_function.leo +++ b/tests/old/pass/circuits/member_variable_and_function.leo @@ -2,7 +2,7 @@ circuit Foo { foo: u32, function bar() -> u32 { - return 1u32 + return 1u32; } } diff --git a/tests/old/pass/circuits/pedersen_mock.leo b/tests/old/pass/circuits/pedersen_mock.leo index 4abef65caa..0fc6752f2f 100644 --- a/tests/old/pass/circuits/pedersen_mock.leo +++ b/tests/old/pass/circuits/pedersen_mock.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [u32; 512] function new(parameters: [u32; 512]) -> Self { - return Self { parameters: parameters } + return Self { parameters: parameters }; } function hash(self, bits: [bool; 512]) -> u32 { @@ -11,7 +11,7 @@ circuit PedersenHash { const base = bits[i] ? self.parameters[i] : 0u32; digest += base; } - return digest + return digest; } } diff --git a/tests/old/pass/circuits/self_member.leo b/tests/old/pass/circuits/self_member.leo index 2b3401a228..237baac9de 100644 --- a/tests/old/pass/circuits/self_member.leo +++ b/tests/old/pass/circuits/self_member.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar(self) -> u32 { - return self.f + return self.f; } } diff --git a/tests/old/pass/circuits/self_member_invalid.leo b/tests/old/pass/circuits/self_member_invalid.leo index 163499d619..7283b3260a 100644 --- a/tests/old/pass/circuits/self_member_invalid.leo +++ b/tests/old/pass/circuits/self_member_invalid.leo @@ -2,7 +2,7 @@ circuit Foo { f: u32, function bar() -> u32 { - return f + return f; } } diff --git a/tests/old/pass/circuits/self_member_undefined.leo b/tests/old/pass/circuits/self_member_undefined.leo index 05a40905d7..8b52d305a3 100644 --- a/tests/old/pass/circuits/self_member_undefined.leo +++ b/tests/old/pass/circuits/self_member_undefined.leo @@ -1,6 +1,6 @@ circuit Foo { function bar() -> u32 { - return self.f + return self.f; } } diff --git a/tests/old/pass/core/blake2s_input.leo b/tests/old/pass/core/blake2s_input.leo index 6044795c3d..51de777341 100644 --- a/tests/old/pass/core/blake2s_input.leo +++ b/tests/old/pass/core/blake2s_input.leo @@ -1,5 +1,5 @@ import core.unstable.blake2s.Blake2s; function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return Blake2s::hash(seed, message) + return Blake2s::hash(seed, message); } diff --git a/tests/old/pass/function/conditional_return.leo b/tests/old/pass/function/conditional_return.leo index 7ecd0e625c..e27dd7aea5 100644 --- a/tests/old/pass/function/conditional_return.leo +++ b/tests/old/pass/function/conditional_return.leo @@ -1,7 +1,7 @@ function main(x: u8) -> u8 { if x == 2u8 { - return 3u8 + return 3u8; } else { - return 4u8 + return 4u8; } } \ No newline at end of file diff --git a/tests/old/pass/function/iteration.leo b/tests/old/pass/function/iteration.leo index b1fcee6964..9be86b5a7c 100644 --- a/tests/old/pass/function/iteration.leo +++ b/tests/old/pass/function/iteration.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/tests/old/pass/function/iteration_repeated.leo b/tests/old/pass/function/iteration_repeated.leo index d76380a6b5..ef4f992d96 100644 --- a/tests/old/pass/function/iteration_repeated.leo +++ b/tests/old/pass/function/iteration_repeated.leo @@ -5,7 +5,7 @@ function iteration() -> u32 { a += 1; } - return a + return a; } function main() { diff --git a/tests/old/pass/function/multiple_returns.leo b/tests/old/pass/function/multiple_returns.leo index d927c51976..73797c6ca3 100644 --- a/tests/old/pass/function/multiple_returns.leo +++ b/tests/old/pass/function/multiple_returns.leo @@ -1,5 +1,5 @@ function tuple() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/tests/old/pass/function/multiple_returns_fail.leo b/tests/old/pass/function/multiple_returns_fail.leo index d4a8b36eac..daa773f2e8 100644 --- a/tests/old/pass/function/multiple_returns_fail.leo +++ b/tests/old/pass/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored } - return 2i8 //ignored - return 3i8 //returns + return 2i8; //ignored + return 3i8; //returns } \ No newline at end of file diff --git a/tests/old/pass/function/multiple_returns_fail_conditional.leo b/tests/old/pass/function/multiple_returns_fail_conditional.leo index 227fe5ce12..ded39534a4 100644 --- a/tests/old/pass/function/multiple_returns_fail_conditional.leo +++ b/tests/old/pass/function/multiple_returns_fail_conditional.leo @@ -2,8 +2,8 @@ function main () -> u16 { if false { const a = 1u16; const b = a + 1u16; - return b + return b; } else if false { - return 0u16 + return 0u16; } } \ No newline at end of file diff --git a/tests/old/pass/function/multiple_returns_main.leo b/tests/old/pass/function/multiple_returns_main.leo index 0bc82e1e4b..c00cd56bed 100644 --- a/tests/old/pass/function/multiple_returns_main.leo +++ b/tests/old/pass/function/multiple_returns_main.leo @@ -1,3 +1,3 @@ function main(input) -> (bool, bool) { - return (input.registers.a, input.registers.b) + return (input.registers.a, input.registers.b); } \ No newline at end of file diff --git a/tests/old/pass/function/newlines.leo b/tests/old/pass/function/newlines.leo index 8c703f81d3..e0b10dead1 100644 --- a/tests/old/pass/function/newlines.leo +++ b/tests/old/pass/function/newlines.leo @@ -5,5 +5,5 @@ function main( u32, u32, ) { - return (a, b) + return (a, b); } \ No newline at end of file diff --git a/tests/old/pass/function/repeated.leo b/tests/old/pass/function/repeated.leo index f83fa6098b..2f9bc43d77 100644 --- a/tests/old/pass/function/repeated.leo +++ b/tests/old/pass/function/repeated.leo @@ -1,5 +1,5 @@ function one() -> bool { - return true + return true; } function main() { diff --git a/tests/old/pass/function/return.leo b/tests/old/pass/function/return.leo index 10c7138977..e839700ee3 100644 --- a/tests/old/pass/function/return.leo +++ b/tests/old/pass/function/return.leo @@ -1,5 +1,5 @@ function one() -> u32 { - return 1u32 + return 1u32; } function main() { diff --git a/tests/old/pass/function/return_array_nested_fail.leo b/tests/old/pass/function/return_array_nested_fail.leo index 8eca684b8a..0db89a09e3 100644 --- a/tests/old/pass/function/return_array_nested_fail.leo +++ b/tests/old/pass/function/return_array_nested_fail.leo @@ -1,5 +1,5 @@ function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (2, 3)] // The correct 3x2 array tuple is `[0u8; (3, 2)]` + return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]` } function main() { diff --git a/tests/old/pass/function/return_array_nested_pass.leo b/tests/old/pass/function/return_array_nested_pass.leo index bfbfc8fd29..c7586f3f08 100644 --- a/tests/old/pass/function/return_array_nested_pass.leo +++ b/tests/old/pass/function/return_array_nested_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/tests/old/pass/function/return_array_tuple_fail.leo b/tests/old/pass/function/return_array_tuple_fail.leo index c960456ac1..d2afcd2790 100644 --- a/tests/old/pass/function/return_array_tuple_fail.leo +++ b/tests/old/pass/function/return_array_tuple_fail.leo @@ -1,5 +1,5 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 3]; 2] // The correct 3x2 nested array is `[0u8; 2]; 3]` + return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]` } function main() { diff --git a/tests/old/pass/function/return_array_tuple_pass.leo b/tests/old/pass/function/return_array_tuple_pass.leo index 4199e31990..6f5a63e806 100644 --- a/tests/old/pass/function/return_array_tuple_pass.leo +++ b/tests/old/pass/function/return_array_tuple_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/tests/old/pass/function/return_tuple.leo b/tests/old/pass/function/return_tuple.leo index a3b1bbc36a..24328aeaaa 100644 --- a/tests/old/pass/function/return_tuple.leo +++ b/tests/old/pass/function/return_tuple.leo @@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) { const a: (u8, u8) = (1, 2); const b: u32 = 3; - return (a, b) + return (a, b); } function main() { diff --git a/tests/old/pass/function/return_tuple_conditional.leo b/tests/old/pass/function/return_tuple_conditional.leo index 839081b2a4..b8040d47ec 100644 --- a/tests/old/pass/function/return_tuple_conditional.leo +++ b/tests/old/pass/function/return_tuple_conditional.leo @@ -4,9 +4,9 @@ function tuple_conditional () -> ( i64 ) { if true { - return (1, 1) + return (1, 1); } else { - return (2, 2) + return (2, 2); } } diff --git a/tests/old/pass/function/scope_fail.leo b/tests/old/pass/function/scope_fail.leo index 6f1d390541..693682d297 100644 --- a/tests/old/pass/function/scope_fail.leo +++ b/tests/old/pass/function/scope_fail.leo @@ -1,5 +1,5 @@ function foo() -> field { - return myGlobal + return myGlobal; } function main() { diff --git a/tests/old/pass/import/test-import.leo b/tests/old/pass/import/test-import.leo index 6dd3e2c88a..9a57d433f4 100644 --- a/tests/old/pass/import/test-import.leo +++ b/tests/old/pass/import/test-import.leo @@ -4,5 +4,5 @@ circuit Point { } function foo() -> u32 { - return 1u32 + return 1u32; } \ No newline at end of file diff --git a/tests/old/pass/mutability/swap.leo b/tests/old/pass/mutability/swap.leo index 2d9ddb4279..d0d663ea1a 100644 --- a/tests/old/pass/mutability/swap.leo +++ b/tests/old/pass/mutability/swap.leo @@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] { const t = a[i]; a[i] = a[j]; a[j] = t; - return a + return a; } function main() { diff --git a/tests/old/pass/statements/multiple_returns.leo b/tests/old/pass/statements/multiple_returns.leo index b8dd869b47..7362fc0732 100644 --- a/tests/old/pass/statements/multiple_returns.leo +++ b/tests/old/pass/statements/multiple_returns.leo @@ -1,7 +1,7 @@ function main(input) -> u32 { if input.registers.a == 0u32 { - return 0u32 + return 0u32; } else { - return 1u32 + return 1u32; } } \ No newline at end of file diff --git a/tests/old/pass/statements/num_returns_fail.leo b/tests/old/pass/statements/num_returns_fail.leo index 14b2fe6ad0..e8d491caed 100644 --- a/tests/old/pass/statements/num_returns_fail.leo +++ b/tests/old/pass/statements/num_returns_fail.leo @@ -1,3 +1,3 @@ function main() -> (bool, bool) { - return true + return true; } \ No newline at end of file diff --git a/tests/old/pass/syntax/undefined.leo b/tests/old/pass/syntax/undefined.leo index 856b07589a..0ab97f6cb0 100644 --- a/tests/old/pass/syntax/undefined.leo +++ b/tests/old/pass/syntax/undefined.leo @@ -1,3 +1,3 @@ function main() -> bool { - return a + return a; } \ No newline at end of file diff --git a/tests/old/pass/tuples/function.leo b/tests/old/pass/tuples/function.leo index 4222b858cb..a5a0dda085 100644 --- a/tests/old/pass/tuples/function.leo +++ b/tests/old/pass/tuples/function.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/tests/old/pass/tuples/function_multiple.leo b/tests/old/pass/tuples/function_multiple.leo index 73fbe277ae..09688207cd 100644 --- a/tests/old/pass/tuples/function_multiple.leo +++ b/tests/old/pass/tuples/function_multiple.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/tests/old/pass/tuples/function_typed.leo b/tests/old/pass/tuples/function_typed.leo index f89e7a3273..ebd2e1201d 100644 --- a/tests/old/pass/tuples/function_typed.leo +++ b/tests/old/pass/tuples/function_typed.leo @@ -1,5 +1,5 @@ function foo() -> (bool, bool) { - return (true, false) + return (true, false); } function main() { diff --git a/tests/parser/statement/return.leo b/tests/parser/statement/return.leo index 54c4bb55e2..e3e835c5df 100644 --- a/tests/parser/statement/return.leo +++ b/tests/parser/statement/return.leo @@ -12,3 +12,6 @@ return (); return x+y; return (x,y); + +return +5; \ No newline at end of file diff --git a/tests/parser/statement/return.leo.out b/tests/parser/statement/return.leo.out index 8557bd934a..fdd4add85e 100644 --- a/tests/parser/statement/return.leo.out +++ b/tests/parser/statement/return.leo.out @@ -90,3 +90,21 @@ outputs: col_stop: 13 path: return.leo content: "return (x,y);" + - Return: + expression: + Value: + Implicit: + - "5" + - line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 2 + path: return.leo + content: 5; + span: + line_start: 1 + line_stop: 2 + col_start: 1 + col_stop: 2 + path: return.leo + content: "return\n5;" diff --git a/tests/parser/statement/return_fail.leo b/tests/parser/statement/return_fail.leo new file mode 100644 index 0000000000..8b4008ef6e --- /dev/null +++ b/tests/parser/statement/return_fail.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseStatement +expectation: Fail +*/ + +return + +return 5 + +return +if x {} \ No newline at end of file diff --git a/tests/parser/statement/return_fail.leo.out b/tests/parser/statement/return_fail.leo.out new file mode 100644 index 0000000000..98d67bafad --- /dev/null +++ b/tests/parser/statement/return_fail.leo.out @@ -0,0 +1,7 @@ +--- +namespace: ParseStatement +expectation: Fail +outputs: + - " --> test: 1:1\n |\n 1 | return\n | ^^^^^^\n |\n = unexpected EOF" + - " --> test: 1:8\n |\n 1 | return 5\n | ^\n |\n = unexpected EOF" + - " --> test: 2:1\n |\n 2 | if x {}\n | ^^\n |\n = expected 'expression', got 'if'" From 23c7c98b4a32ed2fbb36f4f4b6e9d3d2bc2063ce Mon Sep 17 00:00:00 2001 From: Protryon Date: Wed, 14 Apr 2021 10:54:56 -0700 Subject: [PATCH 19/30] fix many_foos test --- parser/benches/many_foos.leo | 384 +++++++++++++++++------------------ 1 file changed, 192 insertions(+), 192 deletions(-) diff --git a/parser/benches/many_foos.leo b/parser/benches/many_foos.leo index 64967e3950..1568cb0c0e 100644 --- a/parser/benches/many_foos.leo +++ b/parser/benches/many_foos.leo @@ -2,195 +2,195 @@ function main() { return x191(0u32); } -function x0(val: u8) -> u8 { return val }; -function x1(val: u8) -> u8 { return x0(val) }; -function x2(val: u8) -> u8 { return x1(val) }; -function x3(val: u8) -> u8 { return x2(val) }; -function x4(val: u8) -> u8 { return x3(val) }; -function x5(val: u8) -> u8 { return x4(val) }; -function x6(val: u8) -> u8 { return x5(val) }; -function x7(val: u8) -> u8 { return x6(val) }; -function x8(val: u8) -> u8 { return x7(val) }; -function x9(val: u8) -> u8 { return x8(val) }; -function x10(val: u8) -> u8 { return x9(val) }; -function x11(val: u8) -> u8 { return x10(val) }; -function x12(val: u8) -> u8 { return x11(val) }; -function x13(val: u8) -> u8 { return x12(val) }; -function x14(val: u8) -> u8 { return x13(val) }; -function x15(val: u8) -> u8 { return x14(val) }; -function x16(val: u8) -> u8 { return x15(val) }; -function x17(val: u8) -> u8 { return x16(val) }; -function x18(val: u8) -> u8 { return x17(val) }; -function x19(val: u8) -> u8 { return x18(val) }; -function x20(val: u8) -> u8 { return x19(val) }; -function x21(val: u8) -> u8 { return x20(val) }; -function x22(val: u8) -> u8 { return x21(val) }; -function x23(val: u8) -> u8 { return x22(val) }; -function x24(val: u8) -> u8 { return x23(val) }; -function x25(val: u8) -> u8 { return x24(val) }; -function x26(val: u8) -> u8 { return x25(val) }; -function x27(val: u8) -> u8 { return x26(val) }; -function x28(val: u8) -> u8 { return x27(val) }; -function x29(val: u8) -> u8 { return x28(val) }; -function x30(val: u8) -> u8 { return x29(val) }; -function x31(val: u8) -> u8 { return x30(val) }; -function x32(val: u8) -> u8 { return x31(val) }; -function x33(val: u8) -> u8 { return x32(val) }; -function x34(val: u8) -> u8 { return x33(val) }; -function x35(val: u8) -> u8 { return x34(val) }; -function x36(val: u8) -> u8 { return x35(val) }; -function x37(val: u8) -> u8 { return x36(val) }; -function x38(val: u8) -> u8 { return x37(val) }; -function x39(val: u8) -> u8 { return x38(val) }; -function x40(val: u8) -> u8 { return x39(val) }; -function x41(val: u8) -> u8 { return x40(val) }; -function x42(val: u8) -> u8 { return x41(val) }; -function x43(val: u8) -> u8 { return x42(val) }; -function x44(val: u8) -> u8 { return x43(val) }; -function x45(val: u8) -> u8 { return x44(val) }; -function x46(val: u8) -> u8 { return x45(val) }; -function x47(val: u8) -> u8 { return x46(val) }; -function x48(val: u8) -> u8 { return x47(val) }; -function x49(val: u8) -> u8 { return x48(val) }; -function x50(val: u8) -> u8 { return x49(val) }; -function x51(val: u8) -> u8 { return x50(val) }; -function x52(val: u8) -> u8 { return x51(val) }; -function x53(val: u8) -> u8 { return x52(val) }; -function x54(val: u8) -> u8 { return x53(val) }; -function x55(val: u8) -> u8 { return x54(val) }; -function x56(val: u8) -> u8 { return x55(val) }; -function x57(val: u8) -> u8 { return x56(val) }; -function x58(val: u8) -> u8 { return x57(val) }; -function x59(val: u8) -> u8 { return x58(val) }; -function x60(val: u8) -> u8 { return x59(val) }; -function x61(val: u8) -> u8 { return x60(val) }; -function x62(val: u8) -> u8 { return x61(val) }; -function x63(val: u8) -> u8 { return x62(val) }; -function x64(val: u8) -> u8 { return x63(val) }; -function x65(val: u8) -> u8 { return x64(val) }; -function x66(val: u8) -> u8 { return x65(val) }; -function x67(val: u8) -> u8 { return x66(val) }; -function x68(val: u8) -> u8 { return x67(val) }; -function x69(val: u8) -> u8 { return x68(val) }; -function x70(val: u8) -> u8 { return x69(val) }; -function x71(val: u8) -> u8 { return x70(val) }; -function x72(val: u8) -> u8 { return x71(val) }; -function x73(val: u8) -> u8 { return x72(val) }; -function x74(val: u8) -> u8 { return x73(val) }; -function x75(val: u8) -> u8 { return x74(val) }; -function x76(val: u8) -> u8 { return x75(val) }; -function x77(val: u8) -> u8 { return x76(val) }; -function x78(val: u8) -> u8 { return x77(val) }; -function x79(val: u8) -> u8 { return x78(val) }; -function x80(val: u8) -> u8 { return x79(val) }; -function x81(val: u8) -> u8 { return x80(val) }; -function x82(val: u8) -> u8 { return x81(val) }; -function x83(val: u8) -> u8 { return x82(val) }; -function x84(val: u8) -> u8 { return x83(val) }; -function x85(val: u8) -> u8 { return x84(val) }; -function x86(val: u8) -> u8 { return x85(val) }; -function x87(val: u8) -> u8 { return x86(val) }; -function x88(val: u8) -> u8 { return x87(val) }; -function x89(val: u8) -> u8 { return x88(val) }; -function x90(val: u8) -> u8 { return x89(val) }; -function x91(val: u8) -> u8 { return x90(val) }; -function x92(val: u8) -> u8 { return x91(val) }; -function x93(val: u8) -> u8 { return x92(val) }; -function x94(val: u8) -> u8 { return x93(val) }; -function x95(val: u8) -> u8 { return x94(val) }; -function x96(val: u8) -> u8 { return x95(val) }; -function x97(val: u8) -> u8 { return x96(val) }; -function x98(val: u8) -> u8 { return x97(val) }; -function x99(val: u8) -> u8 { return x98(val) }; -function x100(val: u8) -> u8 { return x99(val) }; -function x101(val: u8) -> u8 { return x100(val) }; -function x102(val: u8) -> u8 { return x101(val) }; -function x103(val: u8) -> u8 { return x102(val) }; -function x104(val: u8) -> u8 { return x103(val) }; -function x105(val: u8) -> u8 { return x104(val) }; -function x106(val: u8) -> u8 { return x105(val) }; -function x107(val: u8) -> u8 { return x106(val) }; -function x108(val: u8) -> u8 { return x107(val) }; -function x109(val: u8) -> u8 { return x108(val) }; -function x110(val: u8) -> u8 { return x109(val) }; -function x111(val: u8) -> u8 { return x110(val) }; -function x112(val: u8) -> u8 { return x111(val) }; -function x113(val: u8) -> u8 { return x112(val) }; -function x114(val: u8) -> u8 { return x113(val) }; -function x115(val: u8) -> u8 { return x114(val) }; -function x116(val: u8) -> u8 { return x115(val) }; -function x117(val: u8) -> u8 { return x116(val) }; -function x118(val: u8) -> u8 { return x117(val) }; -function x119(val: u8) -> u8 { return x118(val) }; -function x120(val: u8) -> u8 { return x119(val) }; -function x121(val: u8) -> u8 { return x120(val) }; -function x122(val: u8) -> u8 { return x121(val) }; -function x123(val: u8) -> u8 { return x122(val) }; -function x124(val: u8) -> u8 { return x123(val) }; -function x125(val: u8) -> u8 { return x124(val) }; -function x126(val: u8) -> u8 { return x125(val) }; -function x127(val: u8) -> u8 { return x126(val) }; -function x128(val: u8) -> u8 { return x127(val) }; -function x129(val: u8) -> u8 { return x128(val) }; -function x130(val: u8) -> u8 { return x129(val) }; -function x131(val: u8) -> u8 { return x130(val) }; -function x132(val: u8) -> u8 { return x131(val) }; -function x133(val: u8) -> u8 { return x132(val) }; -function x134(val: u8) -> u8 { return x133(val) }; -function x135(val: u8) -> u8 { return x134(val) }; -function x136(val: u8) -> u8 { return x135(val) }; -function x137(val: u8) -> u8 { return x136(val) }; -function x138(val: u8) -> u8 { return x137(val) }; -function x139(val: u8) -> u8 { return x138(val) }; -function x140(val: u8) -> u8 { return x139(val) }; -function x141(val: u8) -> u8 { return x140(val) }; -function x142(val: u8) -> u8 { return x141(val) }; -function x143(val: u8) -> u8 { return x142(val) }; -function x144(val: u8) -> u8 { return x143(val) }; -function x145(val: u8) -> u8 { return x144(val) }; -function x146(val: u8) -> u8 { return x145(val) }; -function x147(val: u8) -> u8 { return x146(val) }; -function x148(val: u8) -> u8 { return x147(val) }; -function x149(val: u8) -> u8 { return x148(val) }; -function x150(val: u8) -> u8 { return x149(val) }; -function x151(val: u8) -> u8 { return x150(val) }; -function x152(val: u8) -> u8 { return x151(val) }; -function x153(val: u8) -> u8 { return x152(val) }; -function x154(val: u8) -> u8 { return x153(val) }; -function x155(val: u8) -> u8 { return x154(val) }; -function x156(val: u8) -> u8 { return x155(val) }; -function x157(val: u8) -> u8 { return x156(val) }; -function x158(val: u8) -> u8 { return x157(val) }; -function x159(val: u8) -> u8 { return x158(val) }; -function x160(val: u8) -> u8 { return x159(val) }; -function x161(val: u8) -> u8 { return x160(val) }; -function x162(val: u8) -> u8 { return x161(val) }; -function x163(val: u8) -> u8 { return x162(val) }; -function x164(val: u8) -> u8 { return x163(val) }; -function x165(val: u8) -> u8 { return x164(val) }; -function x166(val: u8) -> u8 { return x165(val) }; -function x167(val: u8) -> u8 { return x166(val) }; -function x168(val: u8) -> u8 { return x167(val) }; -function x169(val: u8) -> u8 { return x168(val) }; -function x170(val: u8) -> u8 { return x169(val) }; -function x171(val: u8) -> u8 { return x170(val) }; -function x172(val: u8) -> u8 { return x171(val) }; -function x173(val: u8) -> u8 { return x172(val) }; -function x174(val: u8) -> u8 { return x173(val) }; -function x175(val: u8) -> u8 { return x174(val) }; -function x176(val: u8) -> u8 { return x175(val) }; -function x177(val: u8) -> u8 { return x176(val) }; -function x178(val: u8) -> u8 { return x177(val) }; -function x179(val: u8) -> u8 { return x178(val) }; -function x180(val: u8) -> u8 { return x179(val) }; -function x181(val: u8) -> u8 { return x180(val) }; -function x182(val: u8) -> u8 { return x181(val) }; -function x183(val: u8) -> u8 { return x182(val) }; -function x184(val: u8) -> u8 { return x183(val) }; -function x185(val: u8) -> u8 { return x184(val) }; -function x186(val: u8) -> u8 { return x185(val) }; -function x187(val: u8) -> u8 { return x186(val) }; -function x188(val: u8) -> u8 { return x187(val) }; -function x189(val: u8) -> u8 { return x188(val) }; -function x190(val: u8) -> u8 { return x189(val) }; -function x191(val: u8) -> u8 { return x190(val) }; +function x0(val: u8) -> u8 { return val; } +function x1(val: u8) -> u8 { return x0(val); } +function x2(val: u8) -> u8 { return x1(val); } +function x3(val: u8) -> u8 { return x2(val); } +function x4(val: u8) -> u8 { return x3(val); } +function x5(val: u8) -> u8 { return x4(val); } +function x6(val: u8) -> u8 { return x5(val); } +function x7(val: u8) -> u8 { return x6(val); } +function x8(val: u8) -> u8 { return x7(val); } +function x9(val: u8) -> u8 { return x8(val); } +function x10(val: u8) -> u8 { return x9(val); } +function x11(val: u8) -> u8 { return x10(val); } +function x12(val: u8) -> u8 { return x11(val); } +function x13(val: u8) -> u8 { return x12(val); } +function x14(val: u8) -> u8 { return x13(val); } +function x15(val: u8) -> u8 { return x14(val); } +function x16(val: u8) -> u8 { return x15(val); } +function x17(val: u8) -> u8 { return x16(val); } +function x18(val: u8) -> u8 { return x17(val); } +function x19(val: u8) -> u8 { return x18(val); } +function x20(val: u8) -> u8 { return x19(val); } +function x21(val: u8) -> u8 { return x20(val); } +function x22(val: u8) -> u8 { return x21(val); } +function x23(val: u8) -> u8 { return x22(val); } +function x24(val: u8) -> u8 { return x23(val); } +function x25(val: u8) -> u8 { return x24(val); } +function x26(val: u8) -> u8 { return x25(val); } +function x27(val: u8) -> u8 { return x26(val); } +function x28(val: u8) -> u8 { return x27(val); } +function x29(val: u8) -> u8 { return x28(val); } +function x30(val: u8) -> u8 { return x29(val); } +function x31(val: u8) -> u8 { return x30(val); } +function x32(val: u8) -> u8 { return x31(val); } +function x33(val: u8) -> u8 { return x32(val); } +function x34(val: u8) -> u8 { return x33(val); } +function x35(val: u8) -> u8 { return x34(val); } +function x36(val: u8) -> u8 { return x35(val); } +function x37(val: u8) -> u8 { return x36(val); } +function x38(val: u8) -> u8 { return x37(val); } +function x39(val: u8) -> u8 { return x38(val); } +function x40(val: u8) -> u8 { return x39(val); } +function x41(val: u8) -> u8 { return x40(val); } +function x42(val: u8) -> u8 { return x41(val); } +function x43(val: u8) -> u8 { return x42(val); } +function x44(val: u8) -> u8 { return x43(val); } +function x45(val: u8) -> u8 { return x44(val); } +function x46(val: u8) -> u8 { return x45(val); } +function x47(val: u8) -> u8 { return x46(val); } +function x48(val: u8) -> u8 { return x47(val); } +function x49(val: u8) -> u8 { return x48(val); } +function x50(val: u8) -> u8 { return x49(val); } +function x51(val: u8) -> u8 { return x50(val); } +function x52(val: u8) -> u8 { return x51(val); } +function x53(val: u8) -> u8 { return x52(val); } +function x54(val: u8) -> u8 { return x53(val); } +function x55(val: u8) -> u8 { return x54(val); } +function x56(val: u8) -> u8 { return x55(val); } +function x57(val: u8) -> u8 { return x56(val); } +function x58(val: u8) -> u8 { return x57(val); } +function x59(val: u8) -> u8 { return x58(val); } +function x60(val: u8) -> u8 { return x59(val); } +function x61(val: u8) -> u8 { return x60(val); } +function x62(val: u8) -> u8 { return x61(val); } +function x63(val: u8) -> u8 { return x62(val); } +function x64(val: u8) -> u8 { return x63(val); } +function x65(val: u8) -> u8 { return x64(val); } +function x66(val: u8) -> u8 { return x65(val); } +function x67(val: u8) -> u8 { return x66(val); } +function x68(val: u8) -> u8 { return x67(val); } +function x69(val: u8) -> u8 { return x68(val); } +function x70(val: u8) -> u8 { return x69(val); } +function x71(val: u8) -> u8 { return x70(val); } +function x72(val: u8) -> u8 { return x71(val); } +function x73(val: u8) -> u8 { return x72(val); } +function x74(val: u8) -> u8 { return x73(val); } +function x75(val: u8) -> u8 { return x74(val); } +function x76(val: u8) -> u8 { return x75(val); } +function x77(val: u8) -> u8 { return x76(val); } +function x78(val: u8) -> u8 { return x77(val); } +function x79(val: u8) -> u8 { return x78(val); } +function x80(val: u8) -> u8 { return x79(val); } +function x81(val: u8) -> u8 { return x80(val); } +function x82(val: u8) -> u8 { return x81(val); } +function x83(val: u8) -> u8 { return x82(val); } +function x84(val: u8) -> u8 { return x83(val); } +function x85(val: u8) -> u8 { return x84(val); } +function x86(val: u8) -> u8 { return x85(val); } +function x87(val: u8) -> u8 { return x86(val); } +function x88(val: u8) -> u8 { return x87(val); } +function x89(val: u8) -> u8 { return x88(val); } +function x90(val: u8) -> u8 { return x89(val); } +function x91(val: u8) -> u8 { return x90(val); } +function x92(val: u8) -> u8 { return x91(val); } +function x93(val: u8) -> u8 { return x92(val); } +function x94(val: u8) -> u8 { return x93(val); } +function x95(val: u8) -> u8 { return x94(val); } +function x96(val: u8) -> u8 { return x95(val); } +function x97(val: u8) -> u8 { return x96(val); } +function x98(val: u8) -> u8 { return x97(val); } +function x99(val: u8) -> u8 { return x98(val); } +function x100(val: u8) -> u8 { return x99(val); } +function x101(val: u8) -> u8 { return x100(val); } +function x102(val: u8) -> u8 { return x101(val); } +function x103(val: u8) -> u8 { return x102(val); } +function x104(val: u8) -> u8 { return x103(val); } +function x105(val: u8) -> u8 { return x104(val); } +function x106(val: u8) -> u8 { return x105(val); } +function x107(val: u8) -> u8 { return x106(val); } +function x108(val: u8) -> u8 { return x107(val); } +function x109(val: u8) -> u8 { return x108(val); } +function x110(val: u8) -> u8 { return x109(val); } +function x111(val: u8) -> u8 { return x110(val); } +function x112(val: u8) -> u8 { return x111(val); } +function x113(val: u8) -> u8 { return x112(val); } +function x114(val: u8) -> u8 { return x113(val); } +function x115(val: u8) -> u8 { return x114(val); } +function x116(val: u8) -> u8 { return x115(val); } +function x117(val: u8) -> u8 { return x116(val); } +function x118(val: u8) -> u8 { return x117(val); } +function x119(val: u8) -> u8 { return x118(val); } +function x120(val: u8) -> u8 { return x119(val); } +function x121(val: u8) -> u8 { return x120(val); } +function x122(val: u8) -> u8 { return x121(val); } +function x123(val: u8) -> u8 { return x122(val); } +function x124(val: u8) -> u8 { return x123(val); } +function x125(val: u8) -> u8 { return x124(val); } +function x126(val: u8) -> u8 { return x125(val); } +function x127(val: u8) -> u8 { return x126(val); } +function x128(val: u8) -> u8 { return x127(val); } +function x129(val: u8) -> u8 { return x128(val); } +function x130(val: u8) -> u8 { return x129(val); } +function x131(val: u8) -> u8 { return x130(val); } +function x132(val: u8) -> u8 { return x131(val); } +function x133(val: u8) -> u8 { return x132(val); } +function x134(val: u8) -> u8 { return x133(val); } +function x135(val: u8) -> u8 { return x134(val); } +function x136(val: u8) -> u8 { return x135(val); } +function x137(val: u8) -> u8 { return x136(val); } +function x138(val: u8) -> u8 { return x137(val); } +function x139(val: u8) -> u8 { return x138(val); } +function x140(val: u8) -> u8 { return x139(val); } +function x141(val: u8) -> u8 { return x140(val); } +function x142(val: u8) -> u8 { return x141(val); } +function x143(val: u8) -> u8 { return x142(val); } +function x144(val: u8) -> u8 { return x143(val); } +function x145(val: u8) -> u8 { return x144(val); } +function x146(val: u8) -> u8 { return x145(val); } +function x147(val: u8) -> u8 { return x146(val); } +function x148(val: u8) -> u8 { return x147(val); } +function x149(val: u8) -> u8 { return x148(val); } +function x150(val: u8) -> u8 { return x149(val); } +function x151(val: u8) -> u8 { return x150(val); } +function x152(val: u8) -> u8 { return x151(val); } +function x153(val: u8) -> u8 { return x152(val); } +function x154(val: u8) -> u8 { return x153(val); } +function x155(val: u8) -> u8 { return x154(val); } +function x156(val: u8) -> u8 { return x155(val); } +function x157(val: u8) -> u8 { return x156(val); } +function x158(val: u8) -> u8 { return x157(val); } +function x159(val: u8) -> u8 { return x158(val); } +function x160(val: u8) -> u8 { return x159(val); } +function x161(val: u8) -> u8 { return x160(val); } +function x162(val: u8) -> u8 { return x161(val); } +function x163(val: u8) -> u8 { return x162(val); } +function x164(val: u8) -> u8 { return x163(val); } +function x165(val: u8) -> u8 { return x164(val); } +function x166(val: u8) -> u8 { return x165(val); } +function x167(val: u8) -> u8 { return x166(val); } +function x168(val: u8) -> u8 { return x167(val); } +function x169(val: u8) -> u8 { return x168(val); } +function x170(val: u8) -> u8 { return x169(val); } +function x171(val: u8) -> u8 { return x170(val); } +function x172(val: u8) -> u8 { return x171(val); } +function x173(val: u8) -> u8 { return x172(val); } +function x174(val: u8) -> u8 { return x173(val); } +function x175(val: u8) -> u8 { return x174(val); } +function x176(val: u8) -> u8 { return x175(val); } +function x177(val: u8) -> u8 { return x176(val); } +function x178(val: u8) -> u8 { return x177(val); } +function x179(val: u8) -> u8 { return x178(val); } +function x180(val: u8) -> u8 { return x179(val); } +function x181(val: u8) -> u8 { return x180(val); } +function x182(val: u8) -> u8 { return x181(val); } +function x183(val: u8) -> u8 { return x182(val); } +function x184(val: u8) -> u8 { return x183(val); } +function x185(val: u8) -> u8 { return x184(val); } +function x186(val: u8) -> u8 { return x185(val); } +function x187(val: u8) -> u8 { return x186(val); } +function x188(val: u8) -> u8 { return x187(val); } +function x189(val: u8) -> u8 { return x188(val); } +function x190(val: u8) -> u8 { return x189(val); } +function x191(val: u8) -> u8 { return x190(val); } From df60874da9af24e7cd164c8eb7cc89dcc61e1033 Mon Sep 17 00:00:00 2001 From: Protryon Date: Wed, 14 Apr 2021 11:21:05 -0700 Subject: [PATCH 20/30] fix tests --- asg/src/prelude.rs | 2 +- asg/tests/fail/function/multiple_returns_fail.leo | 6 +++--- asg/tests/pass/form_ast.rs | 4 ++-- asg/tests/pass/function/mod.rs | 6 +++--- asg/tests/pass/function/return_array_nested_pass.leo | 4 ++-- asg/tests/pass/function/return_array_tuple_pass.leo | 4 ++-- compiler/tests/function/multiple_returns_fail.leo | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/asg/src/prelude.rs b/asg/src/prelude.rs index e977fd137f..d4a2faffbc 100644 --- a/asg/src/prelude.rs +++ b/asg/src/prelude.rs @@ -29,7 +29,7 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result< r#" circuit Blake2s { function hash(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] { - return [0; 32] + return [0; 32]; } } "#, diff --git a/asg/tests/fail/function/multiple_returns_fail.leo b/asg/tests/fail/function/multiple_returns_fail.leo index d4a8b36eac..daa773f2e8 100644 --- a/asg/tests/fail/function/multiple_returns_fail.leo +++ b/asg/tests/fail/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored } - return 2i8 //ignored - return 3i8 //returns + return 2i8; //ignored + return 3i8; //returns } \ No newline at end of file diff --git a/asg/tests/pass/form_ast.rs b/asg/tests/pass/form_ast.rs index 3a012d9e14..dfb72639b9 100644 --- a/asg/tests/pass/form_ast.rs +++ b/asg/tests/pass/form_ast.rs @@ -36,7 +36,7 @@ fn test_function_rename() { a += 1; } - return a + return a; } function main() { @@ -63,7 +63,7 @@ fn test_imports() { } function foo() -> u32 { - return 1u32 + return 1u32; } "#; imports diff --git a/asg/tests/pass/function/mod.rs b/asg/tests/pass/function/mod.rs index 3ae7434608..9f5a05f44a 100644 --- a/asg/tests/pass/function/mod.rs +++ b/asg/tests/pass/function/mod.rs @@ -32,7 +32,7 @@ fn test_iteration() { fn test_const_args() { let program_string = r#" function one(const value: u32) -> u32 { - return value + 1 + return value + 1; } function main() { @@ -52,7 +52,7 @@ fn test_const_args() { fn test_const_args_used() { let program_string = r#" function index(arr: [u8; 3], const value: u32) -> u8 { - return arr[value] + return arr[value]; } function main() { @@ -73,7 +73,7 @@ fn test_const_args_used() { fn test_const_args_fail() { let program_string = r#" function index(arr: [u8; 3], const value: u32) -> u8 { - return arr[value] + return arr[value]; } function main(x_value: u32) { diff --git a/asg/tests/pass/function/return_array_nested_pass.leo b/asg/tests/pass/function/return_array_nested_pass.leo index bfbfc8fd29..c7586f3f08 100644 --- a/asg/tests/pass/function/return_array_nested_pass.leo +++ b/asg/tests/pass/function/return_array_nested_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [[u8; 2]; 3] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [[u8; 2]; 3] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/asg/tests/pass/function/return_array_tuple_pass.leo b/asg/tests/pass/function/return_array_tuple_pass.leo index 4199e31990..6f5a63e806 100644 --- a/asg/tests/pass/function/return_array_tuple_pass.leo +++ b/asg/tests/pass/function/return_array_tuple_pass.leo @@ -1,9 +1,9 @@ function array_3x2_nested() -> [u8; (3, 2)] { - return [[0u8; 2]; 3] + return [[0u8; 2]; 3]; } function array_3x2_tuple() -> [u8; (3, 2)] { - return [0u8; (3, 2)] + return [0u8; (3, 2)]; } function main() { diff --git a/compiler/tests/function/multiple_returns_fail.leo b/compiler/tests/function/multiple_returns_fail.leo index d4a8b36eac..daa773f2e8 100644 --- a/compiler/tests/function/multiple_returns_fail.leo +++ b/compiler/tests/function/multiple_returns_fail.leo @@ -1,7 +1,7 @@ function main () -> i8 { if true { - return 1i8 //ignored + return 1i8; //ignored } - return 2i8 //ignored - return 3i8 //returns + return 2i8; //ignored + return 3i8; //returns } \ No newline at end of file From a666ef2a05522a42d32679b18d5d5d638caba82b Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 14 Apr 2021 18:31:27 -0400 Subject: [PATCH 21/30] regen parser tests --- .../expression/literal/address_parse.leo.out | 2 +- tests/parser/statement/return.leo | 3 +++ tests/parser/statement/return.leo.out | 18 ++++++++++++++++++ tests/parser/statement/return_fail.leo | 11 +++++++++++ tests/parser/statement/return_fail.leo.out | 7 +++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/parser/statement/return_fail.leo create mode 100644 tests/parser/statement/return_fail.leo.out diff --git a/tests/parser/expression/literal/address_parse.leo.out b/tests/parser/expression/literal/address_parse.leo.out index 4d13340fd2..fa74c96da2 100644 --- a/tests/parser/expression/literal/address_parse.leo.out +++ b/tests/parser/expression/literal/address_parse.leo.out @@ -37,4 +37,4 @@ outputs: col_start: 1 col_stop: 64 path: address_parse.leo - content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st \ No newline at end of file + content: aleo1aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st diff --git a/tests/parser/statement/return.leo b/tests/parser/statement/return.leo index 54c4bb55e2..e3e835c5df 100644 --- a/tests/parser/statement/return.leo +++ b/tests/parser/statement/return.leo @@ -12,3 +12,6 @@ return (); return x+y; return (x,y); + +return +5; \ No newline at end of file diff --git a/tests/parser/statement/return.leo.out b/tests/parser/statement/return.leo.out index 8557bd934a..fdd4add85e 100644 --- a/tests/parser/statement/return.leo.out +++ b/tests/parser/statement/return.leo.out @@ -90,3 +90,21 @@ outputs: col_stop: 13 path: return.leo content: "return (x,y);" + - Return: + expression: + Value: + Implicit: + - "5" + - line_start: 2 + line_stop: 2 + col_start: 1 + col_stop: 2 + path: return.leo + content: 5; + span: + line_start: 1 + line_stop: 2 + col_start: 1 + col_stop: 2 + path: return.leo + content: "return\n5;" diff --git a/tests/parser/statement/return_fail.leo b/tests/parser/statement/return_fail.leo new file mode 100644 index 0000000000..ed865c792a --- /dev/null +++ b/tests/parser/statement/return_fail.leo @@ -0,0 +1,11 @@ +/* +namespace: ParseStatement +expectation: Fail +*/ + +return + +return 5 + +return +if x {} \ No newline at end of file diff --git a/tests/parser/statement/return_fail.leo.out b/tests/parser/statement/return_fail.leo.out new file mode 100644 index 0000000000..98d67bafad --- /dev/null +++ b/tests/parser/statement/return_fail.leo.out @@ -0,0 +1,7 @@ +--- +namespace: ParseStatement +expectation: Fail +outputs: + - " --> test: 1:1\n |\n 1 | return\n | ^^^^^^\n |\n = unexpected EOF" + - " --> test: 1:8\n |\n 1 | return 5\n | ^\n |\n = unexpected EOF" + - " --> test: 2:1\n |\n 2 | if x {}\n | ^^\n |\n = expected 'expression', got 'if'" From 3bc90da57c0e1ce128be8b74eda49ffa31f33eaa Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 15 Apr 2021 10:29:26 +0000 Subject: [PATCH 22/30] Bump abnf from 0.10.2 to 0.11.3 Bumps [abnf](https://github.com/duesee/abnf) from 0.10.2 to 0.11.3. - [Release notes](https://github.com/duesee/abnf/releases) - [Commits](https://github.com/duesee/abnf/commits) Signed-off-by: dependabot-preview[bot] --- Cargo.lock | 4 ++-- grammar/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a9084993c..ce953b20cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "abnf" -version = "0.10.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd8863e7db43447ad50376e19b0549343b72ad45cbd394b3fc8fe3ede961facc" +checksum = "96e669320c520d87931e752d603dd442b4709c73b1b8b1fcba838f9c5acc1791" dependencies = [ "abnf-core", "nom 6.1.2", diff --git a/grammar/Cargo.toml b/grammar/Cargo.toml index 1e909e2653..122f9c8a03 100644 --- a/grammar/Cargo.toml +++ b/grammar/Cargo.toml @@ -18,5 +18,5 @@ license = "GPL-3.0" edition = "2018" [dependencies] -abnf = "0.10.2" +abnf = "0.11.3" anyhow = "1.0" From 820dc7d02b733d74bd4beb3f1b92e65c929d18f2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 15 Apr 2021 10:30:05 +0000 Subject: [PATCH 23/30] Bump notify from 4.0.15 to 4.0.16 Bumps [notify](https://github.com/notify-rs/notify) from 4.0.15 to 4.0.16. - [Release notes](https://github.com/notify-rs/notify/releases) - [Changelog](https://github.com/notify-rs/notify/blob/v4.0.16/CHANGELOG.md) - [Commits](https://github.com/notify-rs/notify/compare/v4.0.15...v4.0.16) Signed-off-by: dependabot-preview[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a9084993c..c02bd8df22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1738,9 +1738,9 @@ dependencies = [ [[package]] name = "notify" -version = "4.0.15" +version = "4.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd" +checksum = "2599080e87c9bd051ddb11b10074f4da7b1223298df65d4c2ec5bcf309af1533" dependencies = [ "bitflags", "filetime", diff --git a/Cargo.toml b/Cargo.toml index b772a48247..305e0483fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,7 +111,7 @@ version = "0.3.1" version = "1.4.0" [dependencies.notify] -version = "4.0.15" +version = "4.0.16" [dependencies.rand] version = "0.8" From d8e021107cf4b55402a3baf4a70d7f2cce38ccca Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 15 Apr 2021 11:20:58 -0700 Subject: [PATCH 24/30] comment out leo-clone ci check --- .circleci/leo-clone.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.circleci/leo-clone.sh b/.circleci/leo-clone.sh index c625b8d355..6b3be3d492 100755 --- a/.circleci/leo-clone.sh +++ b/.circleci/leo-clone.sh @@ -1,18 +1,18 @@ -# leo clone - -# Clone the test-app package. -export PACKAGE="$ALEO_PM_USERNAME/test-app" -$LEO clone $PACKAGE - -# Assert that the 'test-app' folder is not empty - -cd test-app || exit 1 -if [ "$(ls -A $DIR)" ]; then - echo "$DIR is not empty" -else - echo "$DIR is empty" - exit 1 -fi - -ls -la -$LEO run +## leo clone +# +## Clone the test-app package. +#export PACKAGE="$ALEO_PM_USERNAME/test-app" +#$LEO clone $PACKAGE +# +## Assert that the 'test-app' folder is not empty +# +#cd test-app || exit 1 +#if [ "$(ls -A $DIR)" ]; then +# echo "$DIR is not empty" +#else +# echo "$DIR is empty" +# exit 1 +#fi +# +#ls -la +#$LEO run From 540219e10628c57dd55145474a4a4e6197a36adf Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 15 Apr 2021 11:29:27 -0700 Subject: [PATCH 25/30] comment out leo-clone ci check yaml --- .circleci/config.yml | 24 ++++++++++++------------ .circleci/leo-clone.sh | 36 ++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4dc51b709b..09c30acfa8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -171,18 +171,18 @@ jobs: export LEO=/home/circleci/project/project/bin/leo ./project/.circleci/leo-login-logout.sh - leo-clone: - docker: - - image: cimg/rust:1.51.0 - resource_class: xlarge - steps: - - attach_workspace: - at: /home/circleci/project/ - - run: - name: leo clone - command: | - export LEO=/home/circleci/project/project/bin/leo - ./project/.circleci/leo-clone.sh +# leo-clone: +# docker: +# - image: cimg/rust:1.51.0 +# resource_class: xlarge +# steps: +# - attach_workspace: +# at: /home/circleci/project/ +# - run: +# name: leo clone +# command: | +# export LEO=/home/circleci/project/project/bin/leo +# ./project/.circleci/leo-clone.sh leo-publish: docker: diff --git a/.circleci/leo-clone.sh b/.circleci/leo-clone.sh index 6b3be3d492..c625b8d355 100755 --- a/.circleci/leo-clone.sh +++ b/.circleci/leo-clone.sh @@ -1,18 +1,18 @@ -## leo clone -# -## Clone the test-app package. -#export PACKAGE="$ALEO_PM_USERNAME/test-app" -#$LEO clone $PACKAGE -# -## Assert that the 'test-app' folder is not empty -# -#cd test-app || exit 1 -#if [ "$(ls -A $DIR)" ]; then -# echo "$DIR is not empty" -#else -# echo "$DIR is empty" -# exit 1 -#fi -# -#ls -la -#$LEO run +# leo clone + +# Clone the test-app package. +export PACKAGE="$ALEO_PM_USERNAME/test-app" +$LEO clone $PACKAGE + +# Assert that the 'test-app' folder is not empty + +cd test-app || exit 1 +if [ "$(ls -A $DIR)" ]; then + echo "$DIR is not empty" +else + echo "$DIR is empty" + exit 1 +fi + +ls -la +$LEO run From ad5572f3ceed756615664faf3f5d9bd818a5dff5 Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 15 Apr 2021 11:33:22 -0700 Subject: [PATCH 26/30] comment out leo-clone ci check yaml main workflow --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 09c30acfa8..2d9092acee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -222,9 +222,9 @@ workflows: - leo-login-logout: requires: - leo-executable - - leo-clone: - requires: - - leo-executable +# - leo-clone: +# requires: +# - leo-executable - leo-publish: requires: - leo-executable From 59f86c4b34ffc684c21430f5e25aeb501f7818b9 Mon Sep 17 00:00:00 2001 From: gluax Date: Thu, 15 Apr 2021 14:34:22 -0400 Subject: [PATCH 27/30] fix call for immutable context, add it to test --- asg/src/expression/call.rs | 2 +- .../circuits/mutable_call_immutable_context.leo | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/asg/src/expression/call.rs b/asg/src/expression/call.rs index ada5458e5c..d0ae36f32e 100644 --- a/asg/src/expression/call.rs +++ b/asg/src/expression/call.rs @@ -71,7 +71,7 @@ impl<'a> ExpressionNode<'a> for CallExpression<'a> { } fn is_mut_ref(&self) -> bool { - false + true } fn const_value(&self) -> Option { diff --git a/compiler/tests/circuits/mutable_call_immutable_context.leo b/compiler/tests/circuits/mutable_call_immutable_context.leo index d68e1866c5..d235d11cb7 100644 --- a/compiler/tests/circuits/mutable_call_immutable_context.leo +++ b/compiler/tests/circuits/mutable_call_immutable_context.leo @@ -3,10 +3,23 @@ circuit TestMe { function test_me(mut self) -> u8 { self.x += 1; - return self.x + return self.x; } + + function new() -> Self { + return Self { x: 1u8 }; + } +} + +function my_fn() -> TestMe { + return TestMe { x: 0u8 }; } function main () { const t = TestMe {x: 6u8}.test_me(); + console.assert(t == 7u8); + const u = my_fn().test_me(); + console.assert(u == 1u8); + const v = TestMe::new().test_me(); + console.assert(v == 2u8); } \ No newline at end of file From e98079fecfbabb3641750108d701bbc1360aa83e Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 15 Apr 2021 11:57:52 -0700 Subject: [PATCH 28/30] rename abnf enum --- grammar/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammar/src/main.rs b/grammar/src/main.rs index f2bf4aacbb..1aa6f71ede 100644 --- a/grammar/src/main.rs +++ b/grammar/src/main.rs @@ -179,7 +179,7 @@ impl<'a> Processor<'a> { fn parse_abnf_node(node: &Node, sum: &mut Vec) { match node { // these two are just vectors of rules - Node::Alternation(vec) | Node::Concatenation(vec) => { + Node::Alternatives(vec) | Node::Concatenation(vec) => { for node in vec { parse_abnf_node(node, sum); } From 1fee0d31011cd63f0a8db7e0dbaeaef630f9c88c Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 15 Apr 2021 12:11:22 -0700 Subject: [PATCH 29/30] fix parser tests --- .../parser/expression/array_init_fail.leo.out | 4 +- .../expression/array_inline_fail.leo.out | 10 ++-- .../expression/circuit_init_fail.leo.out | 22 ++++----- .../expression/literal/address_fail.leo.out | 18 ++++---- .../expression/literal/group_fail.leo.out | 8 ++-- .../parser/functions/const_input_fail.leo.out | 2 +- .../parser/functions/input_typed_fail.leo.out | 2 +- .../parser/statement/definition_fail.leo.out | 46 +++++++++---------- 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tests/parser/expression/array_init_fail.leo.out b/tests/parser/expression/array_init_fail.leo.out index 1b221a239e..3e6e920477 100644 --- a/tests/parser/expression/array_init_fail.leo.out +++ b/tests/parser/expression/array_init_fail.leo.out @@ -2,5 +2,5 @@ namespace: ParseExpression expectation: Fail outputs: - - " --> test: 1:1\n |\n 1 | [...0u8; 1]\n | ^^^^^^^\n |\n = illegal spread in array initializer" - - " --> test: 1:1\n |\n 1 | [...0; 1]\n | ^^^^^\n |\n = illegal spread in array initializer" + - " --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^^^^^^^\n |\n = illegal spread in array initializer" + - " --> test:1:1\n |\n 1 | [...0; 1]\n | ^^^^^\n |\n = illegal spread in array initializer" diff --git a/tests/parser/expression/array_inline_fail.leo.out b/tests/parser/expression/array_inline_fail.leo.out index 7aeb1f3509..3565e3e59c 100644 --- a/tests/parser/expression/array_inline_fail.leo.out +++ b/tests/parser/expression/array_inline_fail.leo.out @@ -2,8 +2,8 @@ namespace: ParseExpression expectation: Fail outputs: - - " --> test: 1:2\n |\n 1 | [,]\n | ^\n |\n = expected 'expression', got ','" - - " --> test: 1:2\n |\n 1 | [,,]\n | ^\n |\n = expected 'expression', got ','" - - " --> test: 1:4\n |\n 1 | [0,,]\n | ^\n |\n = expected 'expression', got ','" - - " --> test: 1:2\n |\n 1 | [,0]\n | ^\n |\n = expected 'expression', got ','" - - " --> test: 1:2\n |\n 1 | [,0,]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | [,]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | [,,]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:4\n |\n 1 | [0,,]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | [,0]\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | [,0,]\n | ^\n |\n = expected 'expression', got ','" diff --git a/tests/parser/expression/circuit_init_fail.leo.out b/tests/parser/expression/circuit_init_fail.leo.out index 626a69811d..3aae92971f 100644 --- a/tests/parser/expression/circuit_init_fail.leo.out +++ b/tests/parser/expression/circuit_init_fail.leo.out @@ -2,15 +2,15 @@ namespace: ParseExpression expectation: Fail outputs: - - " --> test: 1:3\n |\n 1 | x {\n | ^\n |\n = unexpected EOF" + - " --> test:1:3\n |\n 1 | x {\n | ^\n |\n = unexpected EOF" - "did not consume all input: '}' @ 1:3-4\n" - - " --> test: 1:4\n |\n 1 | x {,}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:5\n |\n 1 | x { , }\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:4\n |\n 1 | x {,,,}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:6\n |\n 1 | x {x,,}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:4\n |\n 1 | x {,,x}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:4\n |\n 1 | x {,x}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:8\n |\n 1 | x {x:y,,}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:4\n |\n 1 | x {,,x:y}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:4\n |\n 1 | x {,x:y}\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:6\n |\n 1 | x {x:}\n | ^\n |\n = expected 'expression', got '}'" + - " --> test:1:4\n |\n 1 | x {,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:5\n |\n 1 | x { , }\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,,,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:6\n |\n 1 | x {x,,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,,x}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,x}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:8\n |\n 1 | x {x:y,,}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,,x:y}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:4\n |\n 1 | x {,x:y}\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:6\n |\n 1 | x {x:}\n | ^\n |\n = expected 'expression', got '}'" diff --git a/tests/parser/expression/literal/address_fail.leo.out b/tests/parser/expression/literal/address_fail.leo.out index b040bf28e9..c0fc912fd4 100644 --- a/tests/parser/expression/literal/address_fail.leo.out +++ b/tests/parser/expression/literal/address_fail.leo.out @@ -2,12 +2,12 @@ namespace: Token expectation: Fail outputs: - - " --> test: 1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1'" - - " --> test: 1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9'" - - " --> test: 1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d'" - - " --> test: 1:1\n |\n 1 | aleo1\n | ^^^^^\n |\n = invalid address literal: 'aleo1'" - - " --> test: 1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st'" - - " --> test: 1:1\n |\n 1 | aleo1\n | ^^^^^\n |\n = invalid address literal: 'aleo1'" - - " --> test: 1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1'" - - " --> test: 1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d11\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d11'" - - " --> test: 1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1x\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1x'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6Z2eu975wnpz2925ntjccd5cfqxtyu8sta57J9'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d'" + - " --> test:1:1\n |\n 1 | aleo1\n | ^^^^^\n |\n = invalid address literal: 'aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8st'" + - " --> test:1:1\n |\n 1 | aleo1\n | ^^^^^\n |\n = invalid address literal: 'aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1aleo1'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d11\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d11'" + - " --> test:1:1\n |\n 1 | aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1x\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = invalid address literal: 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57d1x'" diff --git a/tests/parser/expression/literal/group_fail.leo.out b/tests/parser/expression/literal/group_fail.leo.out index 1427ce26ae..da65de24fa 100644 --- a/tests/parser/expression/literal/group_fail.leo.out +++ b/tests/parser/expression/literal/group_fail.leo.out @@ -2,12 +2,12 @@ namespace: ParseExpression expectation: Fail outputs: - - " --> test: 1:1\n |\n 1 | group\n | ^^^^^\n |\n = expected 'expression', got 'group'" + - " --> test:1:1\n |\n 1 | group\n | ^^^^^\n |\n = expected 'expression', got 'group'" - "did not consume all input: 'group' @ 1:3-8\n" - "did not consume all input: 'group' @ 1:6-11\n" - - " --> test: 1:2\n |\n 1 | (,)group\n | ^\n |\n = expected 'expression', got ','" - - " --> test: 1:2\n |\n 1 | (+, -,)group\n | ^\n |\n = expected 'expression', got '+'" - - " --> test: 1:2\n |\n 1 | (,+, -)group\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | (,)group\n | ^\n |\n = expected 'expression', got ','" + - " --> test:1:2\n |\n 1 | (+, -,)group\n | ^\n |\n = expected 'expression', got '+'" + - " --> test:1:2\n |\n 1 | (,+, -)group\n | ^\n |\n = expected 'expression', got ','" - "did not consume all input: 'group' @ 1:6-11\n" - "did not consume all input: 'group' @ 1:12-17\n" - "did not consume all input: 'group' @ 1:15-20\n" diff --git a/tests/parser/functions/const_input_fail.leo.out b/tests/parser/functions/const_input_fail.leo.out index dd5472db2f..468e683fd9 100644 --- a/tests/parser/functions/const_input_fail.leo.out +++ b/tests/parser/functions/const_input_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - " --> test: 3:18\n |\n 3 | function x(const input) {\n | ^^^^^\n |\n = expected 'ident', got 'input'" + - " --> test:3:18\n |\n 3 | function x(const input) {\n | ^^^^^\n |\n = expected 'ident', got 'input'" diff --git a/tests/parser/functions/input_typed_fail.leo.out b/tests/parser/functions/input_typed_fail.leo.out index 7a24da1657..c35229cc21 100644 --- a/tests/parser/functions/input_typed_fail.leo.out +++ b/tests/parser/functions/input_typed_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - " --> test: 3:17\n |\n 3 | function x(input: u32) {\n | ^\n |\n = expected ')' -- got ':'" + - " --> test:3:17\n |\n 3 | function x(input: u32) {\n | ^\n |\n = expected ')' -- got ':'" diff --git a/tests/parser/statement/definition_fail.leo.out b/tests/parser/statement/definition_fail.leo.out index 4f8a067062..fcb8db8960 100644 --- a/tests/parser/statement/definition_fail.leo.out +++ b/tests/parser/statement/definition_fail.leo.out @@ -2,26 +2,26 @@ namespace: ParseStatement expectation: Fail outputs: - - " --> test: 1:0\n |\n 1 | let mut x = expr;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x = ();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x = x+y;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x = (x,y);\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x = x();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x = expr;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x = ();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x = x+y;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x = (x,y);\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x = x();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x: u32 = expr;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x: u32 = ();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x: u32 = x+y;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x: u32 = (x,y);\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | let mut x: u32 = x();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x: u32 = expr;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x: u32 = ();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x: u32 = x+y;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x: u32 = (x,y);\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:0\n |\n 1 | const mut x: u32 = x();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." - - " --> test: 1:10\n |\n 1 | let (x,y,,) = ();\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:6\n |\n 1 | let (,x,y) = ();\n | ^\n |\n = expected 'ident', got ','" - - " --> test: 1:8\n |\n 1 | let (x,,y) = ();\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:0\n |\n 1 | let mut x = expr;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = ();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = x+y;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = (x,y);\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x = x();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = expr;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = ();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = x+y;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = (x,y);\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x = x();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = expr;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = ();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = x+y;\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = (x,y);\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | let mut x: u32 = x();\n |^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = expr;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = ();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = x+y;\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = (x,y);\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:0\n |\n 1 | const mut x: u32 = x();\n |^^^^^^^^^\n |\n = let mut = ... is deprecated. `let` keyword implies mutabality by default." + - " --> test:1:10\n |\n 1 | let (x,y,,) = ();\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:6\n |\n 1 | let (,x,y) = ();\n | ^\n |\n = expected 'ident', got ','" + - " --> test:1:8\n |\n 1 | let (x,,y) = ();\n | ^\n |\n = expected 'ident', got ','" From 4eac0401784a20e2ed5e7a1acdc566570f31f6d1 Mon Sep 17 00:00:00 2001 From: howardwu Date: Thu, 15 Apr 2021 13:49:42 -0700 Subject: [PATCH 30/30] chore(leo): bump version for new release --- .resources/release-version | 2 +- Cargo.lock | 26 +++++++++++++------------- Cargo.toml | 19 +++++++++---------- asg-passes/Cargo.toml | 4 ++-- asg/Cargo.toml | 6 +++--- ast/Cargo.toml | 4 ++-- compiler/Cargo.toml | 18 +++++++++--------- grammar/Cargo.toml | 2 +- imports/Cargo.toml | 8 ++++---- input/Cargo.toml | 2 +- linter/Cargo.toml | 2 +- package/Cargo.toml | 2 +- parser/Cargo.toml | 4 ++-- state/Cargo.toml | 6 +++--- synthesizer/Cargo.toml | 2 +- 15 files changed, 53 insertions(+), 54 deletions(-) diff --git a/.resources/release-version b/.resources/release-version index 8b3a0227b4..ec7b967829 100644 --- a/.resources/release-version +++ b/.resources/release-version @@ -1 +1 @@ -v1.3.0 \ No newline at end of file +v1.4.0 \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e89992d372..a5661976ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1246,7 +1246,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "leo-abnf" -version = "1.3.0" +version = "1.4.0" dependencies = [ "abnf", "anyhow", @@ -1254,7 +1254,7 @@ dependencies = [ [[package]] name = "leo-asg" -version = "1.3.0" +version = "1.4.0" dependencies = [ "criterion", "indexmap", @@ -1270,14 +1270,14 @@ dependencies = [ [[package]] name = "leo-asg-passes" -version = "1.3.0" +version = "1.4.0" dependencies = [ "leo-asg", ] [[package]] name = "leo-ast" -version = "1.3.0" +version = "1.4.0" dependencies = [ "anyhow", "criterion", @@ -1292,7 +1292,7 @@ dependencies = [ [[package]] name = "leo-compiler" -version = "1.3.0" +version = "1.4.0" dependencies = [ "bincode", "hex", @@ -1326,7 +1326,7 @@ dependencies = [ [[package]] name = "leo-imports" -version = "1.3.0" +version = "1.4.0" dependencies = [ "indexmap", "leo-asg", @@ -1338,7 +1338,7 @@ dependencies = [ [[package]] name = "leo-input" -version = "1.3.0" +version = "1.4.0" dependencies = [ "from-pest", "pest", @@ -1350,7 +1350,7 @@ dependencies = [ [[package]] name = "leo-lang" -version = "1.3.0" +version = "1.4.0" dependencies = [ "ansi_term 0.12.1", "anyhow", @@ -1390,11 +1390,11 @@ dependencies = [ [[package]] name = "leo-linter" -version = "1.3.0" +version = "1.4.0" [[package]] name = "leo-package" -version = "1.3.0" +version = "1.4.0" dependencies = [ "lazy_static", "serde", @@ -1407,7 +1407,7 @@ dependencies = [ [[package]] name = "leo-parser" -version = "1.3.0" +version = "1.4.0" dependencies = [ "criterion", "indexmap", @@ -1423,7 +1423,7 @@ dependencies = [ [[package]] name = "leo-state" -version = "1.3.0" +version = "1.4.0" dependencies = [ "indexmap", "leo-ast", @@ -1441,7 +1441,7 @@ dependencies = [ [[package]] name = "leo-synthesizer" -version = "1.3.0" +version = "1.4.0" dependencies = [ "num-bigint", "serde", diff --git a/Cargo.toml b/Cargo.toml index 305e0483fb..dc9bfb5f6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-lang" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "The Leo programming language" homepage = "https://aleo.org" @@ -42,31 +42,31 @@ members = [ [dependencies.leo-ast] path = "./ast" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-compiler] path = "./compiler" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-imports] path = "./imports" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-input] path = "./input" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-package] path = "./package" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-state] path = "./state" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-synthesizer] path = "./synthesizer" -version = "1.3.0" +version = "1.4.0" [dependencies.snarkvm-algorithms] version = "0.2.2" @@ -150,8 +150,7 @@ features = [ "fmt" ] [dependencies.zip] version = "0.5" -# add ansi support for Windows builds -[target.'cfg(windows)'.dependencies.ansi_term] +[target."cfg(windows)".dependencies.ansi_term] version = "0.12.1" [dev-dependencies.rusty-hook] diff --git a/asg-passes/Cargo.toml b/asg-passes/Cargo.toml index 217e53b17c..5c9a4a5566 100644 --- a/asg-passes/Cargo.toml +++ b/asg-passes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-asg-passes" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "The Leo programming language" homepage = "https://aleo.org" @@ -22,4 +22,4 @@ path = "src/lib.rs" [dependencies.leo-asg] path = "../asg" -version = "1.3.0" +version = "1.4.0" diff --git a/asg/Cargo.toml b/asg/Cargo.toml index 3ce2935526..dd0b7bfaf6 100644 --- a/asg/Cargo.toml +++ b/asg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-asg" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "ASG of the Leo programming language" homepage = "https://aleo.org" @@ -30,11 +30,11 @@ version = "1.6" version = "1.0" [dependencies.leo-ast] -version = "1.3.0" +version = "1.4.0" path = "../ast" [dependencies.leo-parser] -version = "1.3.0" +version = "1.4.0" path = "../parser" [dependencies.num-bigint] diff --git a/ast/Cargo.toml b/ast/Cargo.toml index e5c68b6240..852ff666e9 100644 --- a/ast/Cargo.toml +++ b/ast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-ast" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Core AST of the Leo programming language" homepage = "https://aleo.org" @@ -19,7 +19,7 @@ edition = "2018" [dependencies.leo-input] path = "../input" -version = "1.3.0" +version = "1.4.0" [dependencies.indexmap] version = "1.6.2" diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 140f95c915..ab918e75ec 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-compiler" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Compiler of the Leo programming language" homepage = "https://aleo.org" @@ -19,35 +19,35 @@ edition = "2018" [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-imports] path = "../imports" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-input] path = "../input" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-package] path = "../package" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-state] path = "../state" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-asg] path = "../asg" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-parser] path = "../parser" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-asg-passes] path = "../asg-passes" -version = "1.3.0" +version = "1.4.0" [dependencies.snarkvm-curves] version = "0.2.2" diff --git a/grammar/Cargo.toml b/grammar/Cargo.toml index 122f9c8a03..21be08b853 100644 --- a/grammar/Cargo.toml +++ b/grammar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-abnf" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "ABNF to Markdown converter for the Leo programming language" homepage = "https://aleo.org" diff --git a/imports/Cargo.toml b/imports/Cargo.toml index c8fe120726..990ff34d32 100644 --- a/imports/Cargo.toml +++ b/imports/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-imports" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Import parser for Leo program package dependencies" homepage = "https://aleo.org" @@ -19,15 +19,15 @@ edition = "2018" [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-asg] path = "../asg" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-parser] path = "../parser" -version = "1.3.0" +version = "1.4.0" [dependencies.indexmap] version = "1.6.2" diff --git a/input/Cargo.toml b/input/Cargo.toml index 6350d5151d..f6740591d1 100644 --- a/input/Cargo.toml +++ b/input/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-input" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Input parser of the Leo programming language" homepage = "https://aleo.org" diff --git a/linter/Cargo.toml b/linter/Cargo.toml index f07b144c9c..bf214997cd 100644 --- a/linter/Cargo.toml +++ b/linter/Cargo.toml @@ -2,7 +2,7 @@ dependencies = { } [package] name = "leo-linter" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Linter of the Leo programming language" homepage = "https://aleo.org" diff --git a/package/Cargo.toml b/package/Cargo.toml index f608bfefb2..ff048d7808 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-package" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Package parser of the Leo programming language" homepage = "https://aleo.org" diff --git a/parser/Cargo.toml b/parser/Cargo.toml index 49e1d7dc88..51495b9046 100644 --- a/parser/Cargo.toml +++ b/parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-parser" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "AST generated by pest from the Leo grammar rules" homepage = "https://aleo.org" @@ -24,7 +24,7 @@ harness = false [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.lazy_static] version = "1.3.0" diff --git a/state/Cargo.toml b/state/Cargo.toml index ece7ec71fd..918478ee42 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-state" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "State parser of the Leo programming language" homepage = "https://aleo.org" @@ -19,11 +19,11 @@ edition = "2018" [dependencies.leo-input] path = "../input" -version = "1.3.0" +version = "1.4.0" [dependencies.leo-ast] path = "../ast" -version = "1.3.0" +version = "1.4.0" [dependencies.snarkvm-algorithms] version = "0.2.2" diff --git a/synthesizer/Cargo.toml b/synthesizer/Cargo.toml index 43a26b8ef9..8a0f57fece 100644 --- a/synthesizer/Cargo.toml +++ b/synthesizer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leo-synthesizer" -version = "1.3.0" +version = "1.4.0" authors = [ "The Aleo Team " ] description = "Circuit synthesizer of the Leo programming language" homepage = "https://aleo.org"