mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-20 19:47:22 +03:00
pull testnet3, regen tests
This commit is contained in:
commit
f6f286ac8a
@ -44,7 +44,7 @@ commands:
|
||||
jobs:
|
||||
check-style:
|
||||
docker:
|
||||
- image: cimg/rust:1.63
|
||||
- image: cimg/rust:1.65
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -59,7 +59,7 @@ jobs:
|
||||
|
||||
clippy:
|
||||
docker:
|
||||
- image: cimg/rust:1.63
|
||||
- image: cimg/rust:1.65
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -77,7 +77,7 @@ jobs:
|
||||
|
||||
leo-executable:
|
||||
docker:
|
||||
- image: cimg/rust:1.63
|
||||
- image: cimg/rust:1.65
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- checkout
|
||||
@ -96,7 +96,7 @@ jobs:
|
||||
|
||||
leo-new:
|
||||
docker:
|
||||
- image: cimg/rust:1.63
|
||||
- image: cimg/rust:1.65
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -109,7 +109,7 @@ jobs:
|
||||
|
||||
leo-clean:
|
||||
docker:
|
||||
- image: cimg/rust:1.63
|
||||
- image: cimg/rust:1.65
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
@ -122,7 +122,7 @@ jobs:
|
||||
|
||||
test-examples:
|
||||
docker:
|
||||
- image: cimg/rust:1.63
|
||||
- image: cimg/rust:1.65
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
|
@ -1 +1 @@
|
||||
v1.5.3
|
||||
v1.6.0
|
1111
Cargo.lock
generated
1111
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
26
Cargo.toml
26
Cargo.toml
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-lang"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "The Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -36,48 +36,48 @@ members = [
|
||||
"docs/grammar",
|
||||
"errors",
|
||||
"leo/package",
|
||||
"tests/test-framework",
|
||||
"tests/test-framework"
|
||||
]
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "./compiler/ast"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-compiler]
|
||||
path = "./compiler/compiler"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "./errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-package]
|
||||
path = "./leo/package"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-parser]
|
||||
path = "./compiler/parser"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-span]
|
||||
path = "./compiler/span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.aleo]
|
||||
git = "https://github.com/AleoHQ/aleo.git"
|
||||
rev = "05a1318"
|
||||
version = "0.3.0"
|
||||
|
||||
[dependencies.snarkvm]
|
||||
git = "https://github.com/AleoHQ/snarkVM.git"
|
||||
version = "0.9.3"
|
||||
features = ["aleo-cli", "circuit", "console", "parallel"]
|
||||
version = "0.9.7"
|
||||
features = [ "aleo-cli", "circuit", "console", "parallel" ]
|
||||
|
||||
[dependencies.backtrace]
|
||||
version = "0.3.66"
|
||||
|
||||
[dependencies.clap]
|
||||
version = "3.2"
|
||||
features = ["derive", "env"]
|
||||
features = [ "derive", "env" ]
|
||||
|
||||
[dependencies.color-backtrace]
|
||||
version = "0.5.1"
|
||||
@ -93,7 +93,7 @@ version = "4.0.0"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.9"
|
||||
features = ["serde"]
|
||||
features = [ "serde" ]
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "1.4.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-ast"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Core AST of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -20,11 +20,11 @@ rust-version = "1.63"
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "../../errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-span]
|
||||
path = "../span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.9"
|
||||
@ -43,7 +43,7 @@ features = [ "preserve_order" ]
|
||||
|
||||
[dependencies.smallvec]
|
||||
version = "1.10.0"
|
||||
features = ["serde"]
|
||||
features = [ "serde" ]
|
||||
|
||||
[dev-dependencies.criterion]
|
||||
version = "0.4"
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "leo-compiler"
|
||||
version = "1.5.3"
|
||||
authors = ["The Aleo Team <hello@aleo.org>"]
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Compiler of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
repository = "https://github.com/AleoHQ/leo"
|
||||
@ -10,33 +10,33 @@ keywords = [
|
||||
"cryptography",
|
||||
"leo",
|
||||
"programming-language",
|
||||
"zero-knowledge",
|
||||
"zero-knowledge"
|
||||
]
|
||||
categories = ["cryptography::cryptocurrencies", "web-programming"]
|
||||
include = ["Cargo.toml", "src", "README.md", "LICENSE.md"]
|
||||
categories = [ "cryptography::cryptocurrencies", "web-programming" ]
|
||||
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
|
||||
license = "GPL-3.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.63"
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "../ast"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "../../errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-passes]
|
||||
path = "../passes"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-parser]
|
||||
path = "../parser"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-span]
|
||||
path = "../span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.sha2]
|
||||
version = "0.10"
|
||||
@ -47,12 +47,12 @@ version = "1.4.0"
|
||||
|
||||
[dev-dependencies.snarkvm]
|
||||
git = "https://github.com/AleoHQ/snarkVM.git"
|
||||
version = "0.9.3"
|
||||
features = ["aleo-cli", "circuit", "console", "parallel"]
|
||||
version = "0.9.7"
|
||||
features = [ "aleo-cli", "circuit", "console", "parallel" ]
|
||||
|
||||
[dev-dependencies.serde]
|
||||
version = "1.0.147"
|
||||
features = ["derive"]
|
||||
features = [ "derive" ]
|
||||
|
||||
[dev-dependencies.serde_yaml]
|
||||
version = "0.8.25"
|
||||
@ -61,5 +61,5 @@ version = "0.8.25"
|
||||
version = "3.3"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
ci_skip = ["leo-ast/ci_skip"]
|
||||
default = [ ]
|
||||
ci_skip = [ "leo-ast/ci_skip" ]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-core"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "The Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -22,12 +22,12 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "../ast"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "../../errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-span]
|
||||
path = "../span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-parser"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Leo parser"
|
||||
homepage = "https://aleo.org"
|
||||
@ -20,24 +20,24 @@ rust-version = "1.63"
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "../ast"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "../../errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-span]
|
||||
path = "../span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.snarkvm-console]
|
||||
git = "https://github.com/AleoHQ/snarkVM.git"
|
||||
version = "0.9.3"
|
||||
features = ["account", "network"]
|
||||
version = "0.9.7"
|
||||
features = [ "account", "network" ]
|
||||
|
||||
[dependencies.clap]
|
||||
version = "3.2"
|
||||
features = ["derive"]
|
||||
features = [ "derive" ]
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.9"
|
||||
|
@ -279,7 +279,7 @@ impl ParserContext<'_> {
|
||||
|
||||
/// Returns a [`ParamMode`] AST node if the next tokens represent a function parameter mode.
|
||||
pub(super) fn parse_mode(&mut self) -> Result<Mode> {
|
||||
// TODO: Allow explicit "private" mode.
|
||||
let private = self.eat(&Token::Private).then_some(self.prev_token.span);
|
||||
let public = self.eat(&Token::Public).then_some(self.prev_token.span);
|
||||
let constant = self.eat(&Token::Constant).then_some(self.prev_token.span);
|
||||
let const_ = self.eat(&Token::Const).then_some(self.prev_token.span);
|
||||
@ -288,16 +288,21 @@ impl ParserContext<'_> {
|
||||
self.emit_warning(ParserWarning::const_parameter_or_input(span));
|
||||
}
|
||||
|
||||
match (public, constant, const_) {
|
||||
(None, Some(_), None) => Ok(Mode::Const),
|
||||
(None, None, Some(_)) => Ok(Mode::Const),
|
||||
(None, None, None) => Ok(Mode::None),
|
||||
(Some(_), None, None) => Ok(Mode::Public),
|
||||
(Some(m1), Some(m2), None) | (Some(m1), None, Some(m2)) | (None, Some(m1), Some(m2)) => {
|
||||
Err(ParserError::inputs_multiple_variable_types_specified(m1 + m2).into())
|
||||
}
|
||||
(Some(m1), Some(m2), Some(m3)) => {
|
||||
Err(ParserError::inputs_multiple_variable_types_specified(m1 + m2 + m3).into())
|
||||
match (private, public, constant, const_) {
|
||||
(None, None, None, None) => Ok(Mode::None),
|
||||
(Some(_), None, None, None) => Ok(Mode::Private),
|
||||
(None, Some(_), None, None) => Ok(Mode::Public),
|
||||
(None, None, Some(_), None) => Ok(Mode::Const),
|
||||
(None, None, None, Some(_)) => Ok(Mode::Const),
|
||||
_ => {
|
||||
let mut spans = [private, public, constant, const_].into_iter().flatten();
|
||||
|
||||
// There must exist at least one mode, since the none case is handled above.
|
||||
let starting_span = spans.next().unwrap();
|
||||
// Sum the spans.
|
||||
let summed_span = spans.fold(starting_span, |span, next| span + next);
|
||||
// Emit an error.
|
||||
Err(ParserError::inputs_multiple_variable_modes_specified(summed_span).into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -420,6 +420,7 @@ impl Token {
|
||||
"let" => Token::Let,
|
||||
"leo" => Token::Leo,
|
||||
"mapping" => Token::Mapping,
|
||||
"private" => Token::Private,
|
||||
"program" => Token::Program,
|
||||
"public" => Token::Public,
|
||||
"record" => Token::Record,
|
||||
|
@ -83,6 +83,7 @@ mod tests {
|
||||
test_ident
|
||||
12345
|
||||
address
|
||||
async
|
||||
bool
|
||||
const
|
||||
else
|
||||
@ -102,7 +103,9 @@ mod tests {
|
||||
input
|
||||
let
|
||||
mut
|
||||
private
|
||||
program
|
||||
public
|
||||
return
|
||||
scalar
|
||||
self
|
||||
@ -161,7 +164,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
output,
|
||||
r#""test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" test_ident 12345 address bool const else false field finalize for function group i128 i64 i32 i16 i8 if in input let mut program return scalar self string struct test then transition true u128 u64 u32 u16 u8 console ! != && ( ) * ** + , - -> => _ . .. / : ; < <= = == > >= [ ] { { } } || ? @ // test
|
||||
r#""test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" test_ident 12345 address async bool const else false field finalize for function group i128 i64 i32 i16 i8 if in input let mut private program public return scalar self string struct test then transition true u128 u64 u32 u16 u8 console ! != && ( ) * ** + , - -> => _ . .. / : ; < <= = == > >= [ ] { { } } || ? @ // test
|
||||
/* test */ // "#
|
||||
);
|
||||
});
|
||||
|
@ -126,6 +126,7 @@ pub enum Token {
|
||||
Increment,
|
||||
Let,
|
||||
Mapping,
|
||||
Private,
|
||||
Program,
|
||||
// For public inputs.
|
||||
Public,
|
||||
@ -172,6 +173,7 @@ pub const KEYWORD_TOKENS: &[Token] = &[
|
||||
Token::Increment,
|
||||
Token::Let,
|
||||
Token::Mapping,
|
||||
Token::Private,
|
||||
Token::Program,
|
||||
Token::Public,
|
||||
Token::Record,
|
||||
@ -226,8 +228,9 @@ impl Token {
|
||||
Token::Let => sym::Let,
|
||||
Token::Leo => sym::leo,
|
||||
Token::Mapping => sym::mapping,
|
||||
Token::Private => sym::private,
|
||||
Token::Program => sym::program,
|
||||
Token::Public => sym::Public,
|
||||
Token::Public => sym::public,
|
||||
Token::Record => sym::record,
|
||||
Token::Return => sym::Return,
|
||||
Token::Scalar => sym::scalar,
|
||||
@ -348,6 +351,7 @@ impl fmt::Display for Token {
|
||||
Increment => write!(f, "increment"),
|
||||
Let => write!(f, "let"),
|
||||
Mapping => write!(f, "mapping"),
|
||||
Private => write!(f, "private"),
|
||||
Program => write!(f, "program"),
|
||||
Public => write!(f, "public"),
|
||||
Return => write!(f, "return"),
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-passes"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "The Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -26,26 +26,26 @@ version = "1.9"
|
||||
|
||||
[dependencies.leo-ast]
|
||||
path = "../ast"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "../../errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-parser]
|
||||
path = "../parser"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-span]
|
||||
path = "../span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.leo-core]
|
||||
path = "../core"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.itertools]
|
||||
version = "0.10.5"
|
||||
|
||||
[dependencies.num-traits]
|
||||
version = "0.2.15"
|
||||
version = "0.2.15"
|
||||
|
@ -42,7 +42,7 @@ impl<'a> Pass for Unroller<'a> {
|
||||
// Reconstructs the AST based off any flattening work that is done.
|
||||
let mut reconstructor = Self::new(st, handler);
|
||||
let program = reconstructor.reconstruct_program(ast.into_repr());
|
||||
handler.last_err()?;
|
||||
handler.last_err().map_err(|e| *e)?;
|
||||
|
||||
Ok((Ast::new(program), reconstructor.symbol_table.take()))
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ impl<'a> Pass for CreateSymbolTable<'a> {
|
||||
fn do_pass((ast, handler): Self::Input) -> Self::Output {
|
||||
let mut visitor = CreateSymbolTable::new(handler);
|
||||
visitor.visit_program(ast.as_repr());
|
||||
handler.last_err()?;
|
||||
handler.last_err().map_err(|e| *e)?;
|
||||
|
||||
Ok(visitor.symbol_table)
|
||||
}
|
||||
|
@ -23,10 +23,63 @@ use leo_span::sym;
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
// TODO: Generally, cleanup tyc logic.
|
||||
// TODO: Cleanup logic for tuples.
|
||||
|
||||
impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
||||
fn visit_program(&mut self, input: &'a Program) {
|
||||
match self.is_imported {
|
||||
// If the program is imported, then it is not allowed to import any other programs.
|
||||
true => {
|
||||
input.imports.values().for_each(|(_, span)| {
|
||||
self.emit_err(TypeCheckerError::imported_program_cannot_import_program(*span))
|
||||
});
|
||||
}
|
||||
// Otherwise, typecheck the imported programs.
|
||||
false => {
|
||||
// Set `self.is_imported`.
|
||||
let previous_is_imported = core::mem::replace(&mut self.is_imported, true);
|
||||
|
||||
// Typecheck the imported programs.
|
||||
input.imports.values().for_each(|import| self.visit_import(&import.0));
|
||||
|
||||
// Set `self.is_imported` to its previous state.
|
||||
self.is_imported = previous_is_imported;
|
||||
}
|
||||
}
|
||||
|
||||
// Typecheck the program scopes.
|
||||
input
|
||||
.program_scopes
|
||||
.values()
|
||||
.for_each(|scope| self.visit_program_scope(scope));
|
||||
}
|
||||
|
||||
fn visit_program_scope(&mut self, input: &'a ProgramScope) {
|
||||
// Typecheck the struct definitions.
|
||||
input.structs.values().for_each(|function| self.visit_struct(function));
|
||||
|
||||
// Typecheck the mapping definitions.
|
||||
input.mappings.values().for_each(|mapping| self.visit_mapping(mapping));
|
||||
|
||||
// Typecheck the function definitions.
|
||||
let mut transition_count = 0;
|
||||
for function in input.functions.values() {
|
||||
self.visit_function(function);
|
||||
if matches!(function.call_type, CallType::Transition) {
|
||||
transition_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Use the snarkVM configurations to parameterize the check, need similar checks for structs (all in separate PR)
|
||||
// Check that the number of transitions does not exceed the maximum.
|
||||
if transition_count > 15 {
|
||||
self.emit_err(TypeCheckerError::too_many_transitions(
|
||||
15,
|
||||
input.program_id.name.span + input.program_id.network.span,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_struct(&mut self, input: &'a Struct) {
|
||||
// Check for conflicting struct/record member names.
|
||||
let mut used = HashSet::new();
|
||||
@ -153,7 +206,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
||||
true if input_var.mode() == Mode::Const => self.emit_err(
|
||||
TypeCheckerError::transition_function_inputs_cannot_be_const(input_var.span()),
|
||||
),
|
||||
// If the function is not a program function, then check that the parameters do not have an associated mode.
|
||||
// If the function is not a transition function, then check that the parameters do not have an associated mode.
|
||||
false if input_var.mode() != Mode::None => self.emit_err(
|
||||
TypeCheckerError::regular_function_inputs_cannot_have_modes(input_var.span()),
|
||||
),
|
||||
@ -308,32 +361,4 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
|
||||
// Unset `is_transition_function` flag.
|
||||
self.is_transition_function = false;
|
||||
}
|
||||
|
||||
fn visit_program(&mut self, input: &'a Program) {
|
||||
match self.is_imported {
|
||||
// If the program is imported, then it is not allowed to import any other programs.
|
||||
true => {
|
||||
input.imports.values().for_each(|(_, span)| {
|
||||
self.emit_err(TypeCheckerError::imported_program_cannot_import_program(*span))
|
||||
});
|
||||
}
|
||||
// Otherwise, typecheck the imported programs.
|
||||
false => {
|
||||
// Set `self.is_imported`.
|
||||
let previous_is_imported = core::mem::replace(&mut self.is_imported, true);
|
||||
|
||||
// Typecheck the imported programs.
|
||||
input.imports.values().for_each(|import| self.visit_import(&import.0));
|
||||
|
||||
// Set `self.is_imported` to its previous state.
|
||||
self.is_imported = previous_is_imported;
|
||||
}
|
||||
}
|
||||
|
||||
// Typecheck the program scopes.
|
||||
input
|
||||
.program_scopes
|
||||
.values()
|
||||
.for_each(|scope| self.visit_program_scope(scope));
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ impl<'a> Pass for TypeChecker<'a> {
|
||||
fn do_pass((ast, handler, st): Self::Input) -> Self::Output {
|
||||
let mut visitor = TypeChecker::new(st, handler);
|
||||
visitor.visit_program(ast.as_repr());
|
||||
handler.last_err()?;
|
||||
handler.last_err().map_err(|e| *e)?;
|
||||
|
||||
Ok(visitor.symbol_table.take())
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Span handling in the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -20,7 +20,7 @@ rust-version = "1.63"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.9"
|
||||
features = ["serde"]
|
||||
features = [ "serde" ]
|
||||
|
||||
[dependencies.fxhash]
|
||||
version = "0.2.1"
|
||||
@ -30,6 +30,4 @@ version = "1.0.1"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0.147"
|
||||
features = ["derive", "rc"]
|
||||
|
||||
|
||||
features = [ "derive", "rc" ]
|
||||
|
@ -206,7 +206,6 @@ symbols! {
|
||||
mapping,
|
||||
Mut: "mut",
|
||||
prelude,
|
||||
Public,
|
||||
Return: "return",
|
||||
SelfLower: "self",
|
||||
SelfUpper: "Self",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-abnf"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "ABNF to Markdown converter for the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Errors of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -20,7 +20,7 @@ rust-version = "1.63"
|
||||
|
||||
[dependencies.leo-span]
|
||||
path = "../compiler/span"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.anyhow]
|
||||
version = "1.0"
|
||||
|
@ -239,9 +239,9 @@ impl Handler {
|
||||
|
||||
/// Gets the last emitted error's exit code if it exists.
|
||||
/// Then exits the program with it if it did exist.
|
||||
pub fn last_err(&self) -> Result<(), LeoError> {
|
||||
pub fn last_err(&self) -> Result<(), Box<LeoError>> {
|
||||
if let Some(code) = self.inner.borrow().last_emited_err_code() {
|
||||
Err(LeoError::LastErrorCode(code))
|
||||
Err(Box::new(LeoError::LastErrorCode(code)))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
@ -183,12 +183,12 @@ create_messages!(
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a user specified more than a type on a parameter.
|
||||
/// For when a user specified more than one mode on a parameter.
|
||||
@formatted
|
||||
inputs_multiple_variable_types_specified {
|
||||
inputs_multiple_variable_modes_specified {
|
||||
args: (),
|
||||
msg: "A parameter cannot be both public and const.",
|
||||
help: None,
|
||||
msg: "A parameter cannot have multiple modes.",
|
||||
help: Some("Consider using either `constant`, `public`, `private`, or none at all.".to_string()),
|
||||
}
|
||||
|
||||
/// For when the lexer encountered a bidi override character
|
||||
|
@ -309,14 +309,14 @@ create_messages!(
|
||||
finalize_input_mode_must_be_public {
|
||||
args: (),
|
||||
msg: format!("An input to a finalize block must be public."),
|
||||
help: Some("Add a `public` modifier to the input variable declaration or remove the visibility modifier entirely.".to_string()),
|
||||
help: Some("Use a `public` modifier to the input variable declaration or remove the visibility modifier entirely.".to_string()),
|
||||
}
|
||||
|
||||
@formatted
|
||||
finalize_output_mode_must_be_public {
|
||||
args: (),
|
||||
msg: format!("An output of a finalize block must be public."),
|
||||
help: Some("Add a `public` modifier to the output type declaration or remove the visibility modifier entirely.".to_string()),
|
||||
msg: format!("An output from a finalize block must be public."),
|
||||
help: Some("Use a `public` modifier to the output type declaration or remove the visibility modifier entirely.".to_string()),
|
||||
}
|
||||
|
||||
@formatted
|
||||
@ -447,6 +447,13 @@ create_messages!(
|
||||
help: None,
|
||||
}
|
||||
|
||||
@formatted
|
||||
too_many_transitions {
|
||||
args: (max: impl Display),
|
||||
msg: format!("The number of transitions exceeds the maximum. snarkVM allows up to {max} transitions within a single program."),
|
||||
help: None,
|
||||
}
|
||||
|
||||
// TODO: Consider chainging this to a warning.
|
||||
|
||||
@formatted
|
||||
|
13
examples/fibonacci/README.md
Normal file
13
examples/fibonacci/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# fibonacci.aleo
|
||||
|
||||
## Build Guide
|
||||
|
||||
To run this program, run:
|
||||
```bash
|
||||
leo run fibonacci
|
||||
```
|
||||
|
||||
## Overview
|
||||
This example shows how to calculate Fibonacci number using the [fast-doubling method](https://math.stackexchange.com/questions/1124590/need-help-understanding-fibonacci-fast-doubling-proof).
|
||||
|
||||
It takes the input data from `inputs/fibonacci.in`
|
3
examples/fibonacci/inputs/fibonacci.in
Normal file
3
examples/fibonacci/inputs/fibonacci.in
Normal file
@ -0,0 +1,3 @@
|
||||
// The program input for fibonacci/src/main.leo
|
||||
[fibonacci]
|
||||
public n: u8 = 63u8;
|
10
examples/fibonacci/program.json
Normal file
10
examples/fibonacci/program.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"program": "fibonacci.aleo",
|
||||
"version": "0.0.0",
|
||||
"description": "",
|
||||
"development": {
|
||||
"private_key": "APrivateKey1zkpFebmqLzRHMbtdwensSVNUPDWV6WnYw5JcNsYVLDuu8ig",
|
||||
"address": "aleo1l0l25evjzxac3j4r5xf7uwv3jfnqwll2g9h8j0g5vvk0grnnmq8qexra3d"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
48
examples/fibonacci/src/main.leo
Normal file
48
examples/fibonacci/src/main.leo
Normal file
@ -0,0 +1,48 @@
|
||||
program fibonacci.aleo {
|
||||
// This calculates the n-th fibonacci number (up to 64th)
|
||||
transition fibonacci(public n: u8) -> u128 {
|
||||
console.assert(n <= 64u8);
|
||||
|
||||
let f0: u128 = 0u128;
|
||||
let f1: u128 = 1u128;
|
||||
let c: u8 = 0u8;
|
||||
|
||||
let z: u8 = reverse_bits(n);
|
||||
|
||||
for i:u8 in 0u8..8u8 {
|
||||
if n > 0u8 {
|
||||
let f2i1: u128 = f1 * f1 + f0 * f0;
|
||||
let f2i: u128 = f0 * (2u128 * f1 - f0);
|
||||
if z & 1u8.shl(c) == 0u8 {
|
||||
f0 = f2i;
|
||||
f1 = f2i1;
|
||||
} else {
|
||||
f0 = f2i1;
|
||||
f1 = f2i + f2i1;
|
||||
}
|
||||
c = c + 1u8;
|
||||
n = n >> 1u8;
|
||||
}
|
||||
}
|
||||
|
||||
return f0;
|
||||
}
|
||||
|
||||
function reverse_bits(n: u8) -> u8 {
|
||||
let reverse: u8 = 0u8;
|
||||
|
||||
for i:u8 in 0u8..8u8 {
|
||||
if n > 0u8 {
|
||||
reverse = reverse << 1u8;
|
||||
|
||||
if n & 1u8 == 1u8 {
|
||||
reverse ^= 1u8;
|
||||
}
|
||||
|
||||
n = n >> 1u8;
|
||||
}
|
||||
}
|
||||
|
||||
return reverse;
|
||||
}
|
||||
}
|
@ -180,6 +180,9 @@ impl Command for Build {
|
||||
None
|
||||
};
|
||||
|
||||
// Unset the Leo panic hook.
|
||||
let _ = std::panic::take_hook();
|
||||
|
||||
// Change the cwd to the build directory to compile aleo files.
|
||||
std::env::set_current_dir(&build_directory)
|
||||
.map_err(|err| PackageError::failed_to_set_cwd(build_directory.display(), err))?;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
use crate::commands::ALEO_CLI_COMMAND;
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
use leo_errors::{CliError, PackageError, Result};
|
||||
use leo_package::build::BuildDirectory;
|
||||
|
||||
@ -49,6 +50,9 @@ impl Command for Deploy {
|
||||
std::env::set_current_dir(&build_directory)
|
||||
.map_err(|err| PackageError::failed_to_set_cwd(build_directory.display(), err))?;
|
||||
|
||||
// Unset the Leo panic hook.
|
||||
let _ = std::panic::take_hook();
|
||||
|
||||
// Call the `aleo node` command from the Aleo SDK.
|
||||
println!();
|
||||
let command = AleoDeploy::try_parse_from([ALEO_CLI_COMMAND]).map_err(CliError::failed_to_parse_aleo_node)?;
|
||||
|
@ -66,7 +66,7 @@ impl Command for New {
|
||||
// Initialize the Leo package in the directory created by `aleo new`.
|
||||
Package::initialize(&self.name, &package_path)?;
|
||||
|
||||
// Change the cwd to the Leo package directory. to compile aleo files.
|
||||
// Change the cwd to the Leo package directory to compile aleo files.
|
||||
std::env::set_current_dir(&package_path)
|
||||
.map_err(|err| PackageError::failed_to_set_cwd(package_path.display(), err))?;
|
||||
|
||||
|
@ -86,6 +86,10 @@ impl Command for Run {
|
||||
if self.compiler_options.offline {
|
||||
arguments.push(String::from("--offline"));
|
||||
}
|
||||
|
||||
// Unset the Leo panic hook
|
||||
let _ = std::panic::take_hook();
|
||||
|
||||
println!();
|
||||
let command = AleoRun::try_parse_from(&arguments).map_err(CliError::failed_to_parse_aleo_run)?;
|
||||
let res = command.parse().map_err(CliError::failed_to_execute_aleo_run)?;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leo-package"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Package parser of the Leo programming language"
|
||||
homepage = "https://aleo.org"
|
||||
@ -20,11 +20,11 @@ rust-version = "1.63"
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "../../errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.9"
|
||||
features = ["serde"]
|
||||
features = [ "serde" ]
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
|
24
tests/compiler/finalize/private_input_ouput_fail.leo
Normal file
24
tests/compiler/finalize/private_input_ouput_fail.leo
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
transition foo(public a: u8) -> u8 {
|
||||
async finalize(a);
|
||||
return a + a;
|
||||
}
|
||||
|
||||
finalize foo(private a: u8) -> u8 {
|
||||
return a * a;
|
||||
}
|
||||
|
||||
transition bar(public a: u8) -> u8 {
|
||||
async finalize (a);
|
||||
return a + a;
|
||||
}
|
||||
|
||||
finalize bar(a: u8) -> private u8 {
|
||||
return a * a;
|
||||
}
|
||||
}
|
11
tests/compiler/function/private_input_output.leo
Normal file
11
tests/compiler/function/private_input_output.leo
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
transition foo(private a: u8, public b: u8) -> private u8 {
|
||||
let c: u8 = a + b;
|
||||
return c;
|
||||
}
|
||||
}
|
71
tests/compiler/function/too_many_transitions_fail.leo
Normal file
71
tests/compiler/function/too_many_transitions_fail.leo
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
|
||||
transition one() -> u8 {
|
||||
return 1u8 + 1u8;
|
||||
}
|
||||
|
||||
transition two() -> u8 {
|
||||
return 2u8 + 2u8;
|
||||
}
|
||||
|
||||
transition three() -> u8 {
|
||||
return 3u8 + 3u8;
|
||||
}
|
||||
|
||||
transition four() -> u8 {
|
||||
return 4u8 + 4u8;
|
||||
}
|
||||
|
||||
transition five() -> u8 {
|
||||
return 5u8 + 5u8;
|
||||
}
|
||||
|
||||
transition six() -> u8 {
|
||||
return 6u8 + 6u8;
|
||||
}
|
||||
|
||||
transition seven() -> u8 {
|
||||
return 7u8 + 7u8;
|
||||
}
|
||||
|
||||
transition eight() -> u8 {
|
||||
return 8u8 + 8u8;
|
||||
}
|
||||
|
||||
transition nine() -> u8 {
|
||||
return 9u8 + 9u8;
|
||||
}
|
||||
|
||||
transition ten() -> u8 {
|
||||
return 10u8 + 10u8;
|
||||
}
|
||||
|
||||
transition eleven() -> u8 {
|
||||
return 11u8 + 11u8;
|
||||
}
|
||||
|
||||
transition twelve() -> u8 {
|
||||
return 12u8 + 12u8;
|
||||
}
|
||||
|
||||
transition thirteen() -> u8 {
|
||||
return 13u8 + 13u8;
|
||||
}
|
||||
|
||||
transition fourteen() -> u8 {
|
||||
return 14u8 + 14u8;
|
||||
}
|
||||
|
||||
transition fifteen() -> u8 {
|
||||
return 15u8 + 15u8;
|
||||
}
|
||||
|
||||
transition sixteen() -> u8 {
|
||||
return 16u8 + 16u8;
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372032]: An input to a finalize block must be public.\n --> compiler-test:10:62\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^^^^\n |\n = Add a `public` modifier to the input variable declaration or remove the visibility modifier entirely.\nError [ETYC0372033]: An output of a finalize block must be public.\n --> compiler-test:10:87\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^\n |\n = Add a `public` modifier to the output type declaration or remove the visibility modifier entirely.\nError [ETYC0372038]: Function must return a value.\n --> compiler-test:10:5\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n 11 | increment(account, receiver, amount);\n 12 | }\n | ^\n"
|
||||
- "Error [ETYC0372032]: An input to a finalize block must be public.\n --> compiler-test:10:62\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^^^^\n |\n = Use a `public` modifier to the input variable declaration or remove the visibility modifier entirely.\nError [ETYC0372033]: An output from a finalize block must be public.\n --> compiler-test:10:87\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n | ^^^\n |\n = Use a `public` modifier to the output type declaration or remove the visibility modifier entirely.\nError [ETYC0372038]: Function must return a value.\n --> compiler-test:10:5\n |\n 10 | finalize mint_public (public receiver: address, constant amount: u64) -> constant u64 {\n 11 | increment(account, receiver, amount);\n 12 | }\n | ^\n"
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370030]: `async finalize` is deprecated.\n --> compiler-test:5:9\n |\n 5 | async finalize(a);\n | ^^^^^\n |\n = Use `return <expr> then finalize(<args>)` instead."
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- output:
|
||||
- initial_input_ast: no input
|
||||
initial_ast: b5c5ae7110c20b2fa7949b853a1a5b0a43b94667901da28ce759b3df3639145c
|
||||
unrolled_ast: b5c5ae7110c20b2fa7949b853a1a5b0a43b94667901da28ce759b3df3639145c
|
||||
ssa_ast: 34a50a879f1b146118035e5d19e022d857c9bdab0853d3eb1e826487b5805671
|
||||
flattened_ast: 2c89be5251a0f6f950735e04cbdbff7d32e6105c7d23cd78abed8301eeb062b0
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372052]: The number of transitions exceeds the maximum. snarkVM allows up to 15 transitions within a single program.\n --> compiler-test:3:9\n |\n 3 | program test.aleo {\n | ^^^^^^^^^\n"
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372054]: A record cannot contain a tuple.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\n"
|
||||
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:8:9\n |\n 8 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\n"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372054]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | bar: (Bar, Bar),\n | ^^^\nError [ETYC0372054]: A struct cannot contain a tuple.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\n"
|
||||
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | bar: (Bar, Bar),\n | ^^^\nError [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\nError [ETYC0372029]: A struct or record cannot contain another record.\n --> compiler-test:11:9\n |\n 11 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\n"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EAST0372006]: function `foo` shadowed by\n --> compiler-test:9:46\n |\n 9 | transition foo(flag: bool, a: u8, b: u8, foo: Foo, i: i8) -> u8 {\n | ^^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:10:9\n |\n 10 | a + b;\n | ^^^^^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:11:9\n |\n 11 | flag ? a : b;\n | ^^^^^^^^^^^^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:12:9\n |\n 12 | foo.a;\n | ^^^^^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:13:9\n |\n 13 | Foo {\n 14 | a: a,\n 15 | };\n | ^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:16:9\n |\n 16 | a;\n | ^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:17:9\n |\n 17 | 1u8;\n | ^^^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:18:9\n |\n 18 | -i8;\n | ^^^^\nError [ETYC0372059]: An expression statement must be a function call.\n --> compiler-test:19:9\n |\n 19 | ();\n | ^^^\n"
|
||||
- "Error [EAST0372006]: function `foo` shadowed by\n --> compiler-test:9:46\n |\n 9 | transition foo(flag: bool, a: u8, b: u8, foo: Foo, i: i8) -> u8 {\n | ^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:10:9\n |\n 10 | a + b;\n | ^^^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:11:9\n |\n 11 | flag ? a : b;\n | ^^^^^^^^^^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:12:9\n |\n 12 | foo.a;\n | ^^^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:13:9\n |\n 13 | Foo {\n 14 | a: a,\n 15 | };\n | ^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:16:9\n |\n 16 | a;\n | ^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:17:9\n |\n 17 | 1u8;\n | ^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:18:9\n |\n 18 | -i8;\n | ^^^^\nError [ETYC0372060]: An expression statement must be a function call.\n --> compiler-test:19:9\n |\n 19 | ();\n | ^^^\n"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372061]: The left-hand side of a `DefinitionStatement` can only be an identifier or tuple. Note that a tuple must contain at least two elements.\n --> compiler-test:6:9\n |\n 6 | let b: () = ();\n | ^^^^^^^^^^^^^^\nError [ETYC0372062]: Unit expressions can only be used in return statements.\n --> compiler-test:6:21\n |\n 6 | let b: () = ();\n | ^^\nError [ETYC0372061]: The left-hand side of a `DefinitionStatement` can only be an identifier or tuple. Note that a tuple must contain at least two elements.\n --> compiler-test:11:9\n |\n 11 | let b: () = bar();\n | ^^^^^^^^^^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:11:21\n |\n 11 | let b: () = bar();\n | ^^^^^\nError [ETYC0372006]: Call expected `1` args, but got `0`\n --> compiler-test:11:21\n |\n 11 | let b: () = bar();\n | ^^^^^\n"
|
||||
- "Error [ETYC0372062]: The left-hand side of a `DefinitionStatement` can only be an identifier or tuple. Note that a tuple must contain at least two elements.\n --> compiler-test:6:9\n |\n 6 | let b: () = ();\n | ^^^^^^^^^^^^^^\nError [ETYC0372063]: Unit expressions can only be used in return statements.\n --> compiler-test:6:21\n |\n 6 | let b: () = ();\n | ^^\nError [ETYC0372062]: The left-hand side of a `DefinitionStatement` can only be an identifier or tuple. Note that a tuple must contain at least two elements.\n --> compiler-test:11:9\n |\n 11 | let b: () = bar();\n | ^^^^^^^^^^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:11:21\n |\n 11 | let b: () = bar();\n | ^^^^^\nError [ETYC0372006]: Call expected `1` args, but got `0`\n --> compiler-test:11:21\n |\n 11 | let b: () = bar();\n | ^^^^^\n"
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Failed to parse string. Parsing Error: VerboseError { errors: [(\"closure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\\n\\n\", Nom(Tag)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\\n\\n\", Nom(Alt)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\\n\\n\", Nom(Many1))] }"
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372062]: Unit expressions can only be used in return statements.\n --> compiler-test:10:13\n |\n 10 | foo(());\n | ^^\n"
|
||||
- "Error [ETYC0372063]: Unit expressions can only be used in return statements.\n --> compiler-test:10:13\n |\n 10 | foo(());\n | ^^\n"
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372058]: A function cannot take in tuples as input.\n --> compiler-test:4:20\n |\n 4 | transition baz(a: (u8, u16)) -> u8 {\n | ^\n"
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372055]: A function cannot take in a tuple as input.\n --> compiler-test:4:20\n |\n 4 | transition foo(a: (u8, u16)) -> (u8, u16) {\n | ^\n"
|
||||
- "Error [ETYC0372056]: A function cannot take in a tuple as input.\n --> compiler-test:4:20\n |\n 4 | transition foo(a: (u8, u16)) -> (u8, u16) {\n | ^\n"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372054]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | amounts: (u64, u64),\n | ^^^^^^^\n"
|
||||
- "Error [ETYC0372055]: A record cannot contain a tuple.\n --> compiler-test:7:9\n |\n 7 | amounts: (u64, u64),\n | ^^^^^^^\n"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372053]: A tuple type cannot contain a tuple.\n --> compiler-test:4:35\n |\n 4 | transition bar(a: u8) -> (u8, (u8, u8)) {\n | ^^^^^^^^\nError [ETYC0372057]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:5:20\n |\n 5 | return (a, (a + a, a * a));\n | ^^^^^^^^^^^^^^\nError [ETYC0372057]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:5:20\n |\n 5 | return (a, (a + a, a * a));\n | ^^^^^^^^^^^^^^\n"
|
||||
- "Error [ETYC0372054]: A tuple type cannot contain a tuple.\n --> compiler-test:4:35\n |\n 4 | transition bar(a: u8) -> (u8, (u8, u8)) {\n | ^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:5:20\n |\n 5 | return (a, (a + a, a * a));\n | ^^^^^^^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:5:20\n |\n 5 | return (a, (a + a, a * a));\n | ^^^^^^^^^^^^^^\n"
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370027]: The keyword `circuit` is deprecated.\n --> compiler-test:12:5\n |\n 12 | circuit Token {\n | ^^^^^^^\n |\n = Use `struct` instead."
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372054]: A struct cannot contain a tuple.\n --> compiler-test:5:9\n |\n 5 | mem: (u8, u16)\n | ^^^\nError [ETYC0372054]: A struct cannot contain a tuple.\n --> compiler-test:9:9\n |\n 9 | mems: (A, A)\n | ^^^^\n"
|
||||
- "Error [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:5:9\n |\n 5 | mem: (u8, u16)\n | ^^^\nError [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:9:9\n |\n 9 | mems: (A, A)\n | ^^^^\n"
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372056]: A struct cannot contain a tuple.\n --> compiler-test:22:9\n |\n 22 | mem: (u8, u16)\n | ^^^\nError [ETYC0372058]: A function cannot take in tuples as input.\n --> compiler-test:8:18\n |\n 8 | function foo(a: (u8, u16)) -> (u8, u16) {\n | ^\nError [ETYC0372055]: A tuple type cannot contain a tuple.\n --> compiler-test:12:28\n |\n 12 | function bar() -> (u8, (u16, u32)) {\n | ^^^^^^^^^^\nError [ETYC0372060]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372060]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `i8, i16, i32, i64, i128, u8, u16, u32, u64, u128`, but got `(u8,u16)`\n --> compiler-test:17:13\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:29\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:34\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\n"
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372054]: A struct cannot contain a tuple.\n --> compiler-test:22:9\n |\n 22 | mem: (u8, u16)\n | ^^^\nError [ETYC0372055]: A function cannot take in a tuple as input.\n --> compiler-test:8:18\n |\n 8 | function foo(a: (u8, u16)) -> (u8, u16) {\n | ^\nError [ETYC0372053]: A tuple type cannot contain a tuple.\n --> compiler-test:12:28\n |\n 12 | function bar() -> (u8, (u16, u32)) {\n | ^^^^^^^^^^\nError [ETYC0372057]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372057]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `i8, i16, i32, i64, i128, u8, u16, u32, u64, u128`, but got `(u8,u16)`\n --> compiler-test:17:13\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:29\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:34\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\n"
|
||||
- "Error [ETYC0372055]: A struct cannot contain a tuple.\n --> compiler-test:22:9\n |\n 22 | mem: (u8, u16)\n | ^^^\nError [ETYC0372056]: A function cannot take in a tuple as input.\n --> compiler-test:8:18\n |\n 8 | function foo(a: (u8, u16)) -> (u8, u16) {\n | ^\nError [ETYC0372054]: A tuple type cannot contain a tuple.\n --> compiler-test:12:28\n |\n 12 | function bar() -> (u8, (u16, u32)) {\n | ^^^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372058]: A tuple expression cannot contain another tuple expression.\n --> compiler-test:13:22\n |\n 13 | return (1u8, (2u16, 3u32));\n | ^^^^^^^^^^^^\nError [ETYC0372007]: Expected one type from `i8, i16, i32, i64, i128, u8, u16, u32, u64, u128`, but got `(u8,u16)`\n --> compiler-test:17:13\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:29\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\nError [ETYC0372003]: Expected type `(u8,u16)` but type `u8` was found\n --> compiler-test:17:34\n |\n 17 | for i: (u8, u16) in 0u8..2u8 {}\n | ^^^\n"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370019]: A parameter cannot be both public and const.\n --> test:4:24\n |\n 4 | function x(x: u32, public const y: i32) {\n | ^^^^^^^^^^^^"
|
||||
- "Error [EPAR0370019]: A parameter cannot have multiple modes.\n --> test:4:24\n |\n 4 | function x(x: u32, public const y: i32) {\n | ^^^^^^^^^^^^\n |\n = Consider using either `constant`, `public`, `private`, or none at all."
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Input
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370019]: A parameter cannot be both public and const.\n --> test:4:1\n |\n 4 | public constant a: bool = true;\n | ^^^^^^^^^^^^^^^"
|
||||
- "Error [EPAR0370019]: A parameter cannot have multiple modes.\n --> test:4:1\n |\n 4 | public constant a: bool = true;\n | ^^^^^^^^^^^^^^^\n |\n = Consider using either `constant`, `public`, `private`, or none at all."
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "leo-test-framework"
|
||||
version = "1.5.3"
|
||||
authors = ["The Aleo Team <hello@aleo.org>"]
|
||||
version = "1.6.0"
|
||||
authors = [ "The Aleo Team <hello@aleo.org>" ]
|
||||
description = "Leo testing framework"
|
||||
homepage = "https://aleo.org"
|
||||
repository = "https://github.com/AleoHQ/leo"
|
||||
@ -10,10 +10,10 @@ keywords = [
|
||||
"cryptography",
|
||||
"leo",
|
||||
"programming-language",
|
||||
"zero-knowledge",
|
||||
"zero-knowledge"
|
||||
]
|
||||
categories = ["cryptography::cryptocurrencies", "web-programming"]
|
||||
include = ["Cargo.toml", "src", "README.md", "LICENSE.md"]
|
||||
categories = [ "cryptography::cryptocurrencies", "web-programming" ]
|
||||
include = [ "Cargo.toml", "src", "benches", "README.md", "LICENSE.md" ]
|
||||
license = "GPL-3.0"
|
||||
edition = "2018"
|
||||
|
||||
@ -23,22 +23,22 @@ harness = false
|
||||
|
||||
[dependencies.leo-errors]
|
||||
path = "../../errors"
|
||||
version = "1.5.3"
|
||||
version = "1.6.0"
|
||||
|
||||
[dependencies.backtrace]
|
||||
version = "0.3.66"
|
||||
|
||||
[dependencies.clap]
|
||||
version = "3.2"
|
||||
features = ["derive"]
|
||||
features = [ "derive" ]
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
features = ["derive"]
|
||||
features = [ "derive" ]
|
||||
|
||||
[dependencies.serde_json]
|
||||
version = "1.0"
|
||||
features = ["preserve_order"]
|
||||
features = [ "preserve_order" ]
|
||||
|
||||
[dependencies.serde_yaml]
|
||||
version = "0.8"
|
||||
|
Loading…
Reference in New Issue
Block a user