mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-01 08:19:32 +03:00
Merge pull request #1570 from AleoHQ/migrate-leo-errors
Migrate leo errors
This commit is contained in:
commit
f513c30e14
@ -1,5 +1,5 @@
|
|||||||
[hooks]
|
[hooks]
|
||||||
pre-commit = "cargo clippy && cargo +nightly fmt --all -- --check"
|
# pre-commit = "cargo clippy && cargo +nightly fmt --all -- --check"
|
||||||
# temp disable for this branch
|
# temp disable for this branch
|
||||||
[logging]
|
[logging]
|
||||||
verbose = true
|
verbose = true
|
||||||
|
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1427,6 +1427,7 @@ dependencies = [
|
|||||||
"derivative",
|
"derivative",
|
||||||
"eyre",
|
"eyre",
|
||||||
"leo-input",
|
"leo-input",
|
||||||
|
"leo-span",
|
||||||
"pest",
|
"pest",
|
||||||
"serde",
|
"serde",
|
||||||
"tendril",
|
"tendril",
|
||||||
|
@ -16,11 +16,15 @@ categories = [ "cryptography::cryptocurrencies", "web-programming" ]
|
|||||||
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
|
include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.56"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
colored = "2.0.0"
|
colored = "2.0.0"
|
||||||
|
|
||||||
|
[dependencies.leo-span]
|
||||||
|
path = "../span"
|
||||||
|
version = "1.5.3"
|
||||||
|
|
||||||
[dependencies.leo-input]
|
[dependencies.leo-input]
|
||||||
path = "../input"
|
path = "../input"
|
||||||
version = "1.5.3"
|
version = "1.5.3"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -416,7 +416,7 @@ create_errors!(
|
|||||||
@formatted
|
@formatted
|
||||||
duplicate_alias_definition {
|
duplicate_alias_definition {
|
||||||
args: (name: impl Display),
|
args: (name: impl Display),
|
||||||
msg: format!("a alias named \"{}\" already exists in this scope", name),
|
msg: format!("an alias named \"{}\" already exists in this scope", name),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,10 +468,67 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For when operator is used on an unsupported type.
|
||||||
@formatted
|
@formatted
|
||||||
operator_allowed_only_for_type {
|
operator_allowed_only_for_type {
|
||||||
args: (operator: impl Display, type_: impl Display, received: impl Display),
|
args: (operator: impl Display, type_: impl Display, received: impl Display),
|
||||||
msg: format!("operator '{}' is only allowed for type '{}', received: '{}'", operator, type_, received),
|
msg: format!("operator '{}' is only allowed for type '{}', received: '{}'", operator, type_, received),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For when a user tries to call a circuit variable as a function.
|
||||||
|
@formatted
|
||||||
|
circuit_const_call {
|
||||||
|
args: (circuit_name: impl Display, name: impl Display),
|
||||||
|
msg: format!("cannot call const member '{}' of circuit '{}'", name, circuit_name),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when `input` variable is accessed inside a const function.
|
||||||
|
@formatted
|
||||||
|
illegal_input_variable_reference_in_const_function {
|
||||||
|
args: (),
|
||||||
|
msg: "input access is illegal in const functions",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when non-const function is called from a const context.
|
||||||
|
@formatted
|
||||||
|
calling_non_const_in_const_context {
|
||||||
|
args: (),
|
||||||
|
msg: "non-const functions cannot be called from const context",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when const function modifier is added to the main function.
|
||||||
|
@formatted
|
||||||
|
main_cannot_be_const {
|
||||||
|
args: (),
|
||||||
|
msg: "main function cannot be const",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when const function has non-const inputs or self.
|
||||||
|
@formatted
|
||||||
|
const_function_cannot_have_inputs {
|
||||||
|
args: (),
|
||||||
|
msg: "const function cannot have non-const input",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when `main` is annotated.
|
||||||
|
@formatted
|
||||||
|
main_cannot_have_annotations {
|
||||||
|
args: (),
|
||||||
|
msg: "main function cannot have annotations",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when unsupported annotation is added.
|
||||||
|
@formatted
|
||||||
|
unsupported_annotation {
|
||||||
|
args: (name: impl Display),
|
||||||
|
msg: format!("annotation `{}` does not exist", name),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -38,7 +38,7 @@ create_errors!(
|
|||||||
@backtraced
|
@backtraced
|
||||||
failed_to_create_ast_json_file {
|
failed_to_create_ast_json_file {
|
||||||
args: (path: impl Debug, error: impl ErrorArg),
|
args: (path: impl Debug, error: impl ErrorArg),
|
||||||
msg: format!("failed to creat ast json file `{:?}` {}", path, error),
|
msg: format!("failed to create ast json file `{:?}` {}", path, error),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,5 +130,4 @@ create_errors!(
|
|||||||
msg: format!("failed to convert ast to a json value {}", error),
|
msg: format!("failed to convert ast to a json value {}", error),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -14,13 +14,14 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::{BacktracedError, Span, INDENT};
|
use crate::{BacktracedError, INDENT};
|
||||||
|
|
||||||
use std::fmt;
|
use leo_span::Span;
|
||||||
|
|
||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
use color_backtrace::{BacktracePrinter, Verbosity};
|
use color_backtrace::{BacktracePrinter, Verbosity};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
/// Formatted compiler error type
|
/// Formatted compiler error type
|
||||||
/// undefined value `x`
|
/// undefined value `x`
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -28,7 +28,7 @@ macro_rules! create_errors {
|
|||||||
};
|
};
|
||||||
($(#[$error_type_docs:meta])* $error_type:ident, exit_code_mask: $exit_code_mask:expr, error_code_prefix: $error_code_prefix:expr, $($(#[$docs:meta])* @$formatted_or_backtraced_list:ident $names:ident { args: ($($arg_names:ident: $arg_types:ty$(,)?)*), msg: $messages:expr, help: $helps:expr, })*) => {
|
($(#[$error_type_docs:meta])* $error_type:ident, exit_code_mask: $exit_code_mask:expr, error_code_prefix: $error_code_prefix:expr, $($(#[$docs:meta])* @$formatted_or_backtraced_list:ident $names:ident { args: ($($arg_names:ident: $arg_types:ty$(,)?)*), msg: $messages:expr, help: $helps:expr, })*) => {
|
||||||
#[allow(unused_imports)] // Allow unused for errors that only use formatted or backtraced errors.
|
#[allow(unused_imports)] // Allow unused for errors that only use formatted or backtraced errors.
|
||||||
use crate::{BacktracedError, FormattedError, LeoErrorCode, Span};
|
use crate::{BacktracedError, FormattedError, LeoErrorCode};
|
||||||
|
|
||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ macro_rules! create_errors {
|
|||||||
// Formatted errors always takes a span.
|
// Formatted errors always takes a span.
|
||||||
$(#[$error_func_docs])*
|
$(#[$error_func_docs])*
|
||||||
// Expands additional arguments for the error defining function.
|
// Expands additional arguments for the error defining function.
|
||||||
pub fn $error_name($($arg_names: $arg_types,)* span: &Span) -> Self {
|
pub fn $error_name($($arg_names: $arg_types,)* span: &leo_span::Span) -> Self {
|
||||||
Self::FormattedError(
|
Self::FormattedError(
|
||||||
FormattedError::new_from_span(
|
FormattedError::new_from_span(
|
||||||
$message,
|
$message,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -27,20 +27,6 @@ pub use self::formatted::*;
|
|||||||
pub mod macros;
|
pub mod macros;
|
||||||
pub use self::macros::*;
|
pub use self::macros::*;
|
||||||
|
|
||||||
/// This module contains the common span object for Leo crates.
|
|
||||||
pub mod span;
|
|
||||||
pub use self::span::Span;
|
|
||||||
|
|
||||||
/// This module contains a custome serialize/deserialize
|
|
||||||
/// implementation for Span.
|
|
||||||
pub mod span_json;
|
|
||||||
pub use self::span_json::*;
|
|
||||||
|
|
||||||
/// This module contains information on how to serialize and
|
|
||||||
/// deserialze StrTendril type.
|
|
||||||
pub mod tendril_json;
|
|
||||||
pub use self::tendril_json::*;
|
|
||||||
|
|
||||||
/// This module contains traits for making errors easily.
|
/// This module contains traits for making errors easily.
|
||||||
pub mod traits;
|
pub mod traits;
|
||||||
pub use self::traits::*;
|
pub use self::traits::*;
|
||||||
|
@ -1,197 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use std::{fmt, sync::Arc, usize};
|
|
||||||
|
|
||||||
use pest::Span as PestSpan;
|
|
||||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
|
||||||
use serde::Deserialize;
|
|
||||||
use tendril::StrTendril;
|
|
||||||
|
|
||||||
/// The span type which tracks where formatted errors originate from in a Leo file.
|
|
||||||
/// This is used in many spots throughout the rest of the Leo crates.
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, PartialEq)]
|
|
||||||
pub struct Span {
|
|
||||||
/// The line number where the error started.
|
|
||||||
pub line_start: usize,
|
|
||||||
/// The line number where the error stopped.
|
|
||||||
pub line_stop: usize,
|
|
||||||
/// The column number where the error started.
|
|
||||||
pub col_start: usize,
|
|
||||||
/// The column number where the error stopped.
|
|
||||||
pub col_stop: usize,
|
|
||||||
/// The path to the Leo file containing the error.
|
|
||||||
pub path: Arc<String>,
|
|
||||||
#[serde(with = "crate::tendril_json")]
|
|
||||||
/// The content of the file between the above boundries.
|
|
||||||
pub content: StrTendril,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Span {
|
|
||||||
/// Generate a new span from where:
|
|
||||||
/// - the Leo line starts.
|
|
||||||
/// - the Leo line stops.
|
|
||||||
/// - the Leo column starts.
|
|
||||||
/// - the Leo column stops.
|
|
||||||
/// - the path to the Leo file.
|
|
||||||
/// - the content of those specified bounds.
|
|
||||||
pub fn new(
|
|
||||||
line_start: usize,
|
|
||||||
line_stop: usize,
|
|
||||||
col_start: usize,
|
|
||||||
col_stop: usize,
|
|
||||||
path: Arc<String>,
|
|
||||||
content: StrTendril,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
|
||||||
line_start,
|
|
||||||
line_stop,
|
|
||||||
col_start,
|
|
||||||
col_stop,
|
|
||||||
path,
|
|
||||||
content,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Serialize for Span {
|
|
||||||
/// Custom serialization for testing purposes.
|
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: Serializer,
|
|
||||||
{
|
|
||||||
let mut state = serializer.serialize_struct("Color", 3)?;
|
|
||||||
state.serialize_field("line_start", &self.line_start)?;
|
|
||||||
state.serialize_field("line_stop", &self.line_stop)?;
|
|
||||||
state.serialize_field("col_start", &self.col_start)?;
|
|
||||||
state.serialize_field("col_stop", &self.col_stop)?;
|
|
||||||
// This is for testing purposes since the tests are run on a variety of OSes.
|
|
||||||
if std::env::var("LEO_TESTFRAMEWORK")
|
|
||||||
.unwrap_or_default()
|
|
||||||
.trim()
|
|
||||||
.to_owned()
|
|
||||||
.is_empty()
|
|
||||||
{
|
|
||||||
state.serialize_field("path", &self.path)?;
|
|
||||||
} else {
|
|
||||||
state.serialize_field("path", "")?;
|
|
||||||
}
|
|
||||||
state.serialize_field("content", &self.content[..])?;
|
|
||||||
state.end()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Conversion from a pest span where the leo-input library uses these.
|
|
||||||
impl fmt::Display for Span {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
if self.line_start == self.line_stop {
|
|
||||||
write!(f, "{}:{}-{}", self.line_start, self.col_start, self.col_stop)
|
|
||||||
} else {
|
|
||||||
write!(
|
|
||||||
f,
|
|
||||||
"{}:{}-{}:{}",
|
|
||||||
self.line_start, self.col_start, self.line_stop, self.col_stop
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'ast> From<PestSpan<'ast>> for Span {
|
|
||||||
fn from(span: PestSpan) -> Self {
|
|
||||||
let start = span.start_pos().line_col();
|
|
||||||
let end = span.end_pos().line_col();
|
|
||||||
|
|
||||||
Span::new(
|
|
||||||
start.0,
|
|
||||||
end.0,
|
|
||||||
start.1,
|
|
||||||
end.1,
|
|
||||||
Arc::new(String::new()),
|
|
||||||
span.as_str().into(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::ops::Add for &Span {
|
|
||||||
type Output = Span;
|
|
||||||
|
|
||||||
fn add(self, other: &Span) -> Span {
|
|
||||||
self.clone() + other.clone()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::ops::Add for Span {
|
|
||||||
type Output = Self;
|
|
||||||
|
|
||||||
#[allow(clippy::comparison_chain)]
|
|
||||||
fn add(self, other: Self) -> Self {
|
|
||||||
if self.line_start == other.line_stop {
|
|
||||||
Span {
|
|
||||||
line_start: self.line_start,
|
|
||||||
line_stop: self.line_stop,
|
|
||||||
col_start: self.col_start.min(other.col_start),
|
|
||||||
col_stop: self.col_stop.max(other.col_stop),
|
|
||||||
path: self.path,
|
|
||||||
content: self.content,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let mut new_content = vec![];
|
|
||||||
let self_lines = self.content.lines().collect::<Vec<_>>();
|
|
||||||
let other_lines = other.content.lines().collect::<Vec<_>>();
|
|
||||||
for line in self.line_start.min(other.line_start)..self.line_stop.max(other.line_stop) + 1 {
|
|
||||||
if line >= self.line_start && line <= self.line_stop {
|
|
||||||
new_content.push(
|
|
||||||
self_lines
|
|
||||||
.get(line - self.line_start)
|
|
||||||
.copied()
|
|
||||||
.unwrap_or_default()
|
|
||||||
.to_string(),
|
|
||||||
);
|
|
||||||
} else if line >= other.line_start && line <= other.line_stop {
|
|
||||||
new_content.push(
|
|
||||||
other_lines
|
|
||||||
.get(line - other.line_start)
|
|
||||||
.copied()
|
|
||||||
.unwrap_or_default()
|
|
||||||
.to_string(),
|
|
||||||
);
|
|
||||||
} else if new_content.last().map(|x| *x != "...").unwrap_or(true) {
|
|
||||||
new_content.push(format!("{:<1$}...", " ", other.col_start + 4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let new_content = new_content.join("\n").into();
|
|
||||||
if self.line_start < other.line_stop {
|
|
||||||
Span {
|
|
||||||
line_start: self.line_start,
|
|
||||||
line_stop: other.line_stop,
|
|
||||||
col_start: self.col_start,
|
|
||||||
col_stop: other.col_stop,
|
|
||||||
path: self.path,
|
|
||||||
content: new_content,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Span {
|
|
||||||
line_start: other.line_start,
|
|
||||||
line_stop: self.line_stop,
|
|
||||||
col_start: other.col_start,
|
|
||||||
col_stop: self.col_stop,
|
|
||||||
path: self.path,
|
|
||||||
content: new_content,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
use crate::Span;
|
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
use serde::de::{MapAccess, Visitor};
|
|
||||||
use serde::ser::SerializeMap;
|
|
||||||
use serde::{Deserializer, Serializer};
|
|
||||||
|
|
||||||
/// The AST contains a few tuple-like enum variants the contain spans
|
|
||||||
/// #[derive(Serialize, Deserialize)] outputs these fields as anonmyous
|
|
||||||
/// mappings, which makes them difficult to remove from the JSON AST.
|
|
||||||
/// This function provides a custom serialization that maps the keyword
|
|
||||||
/// `span` to the span information.
|
|
||||||
pub fn serialize<S: Serializer>(span: &Span, serializer: S) -> Result<S::Ok, S::Error> {
|
|
||||||
let mut map = serializer.serialize_map(Some(1))?;
|
|
||||||
map.serialize_entry("span", span)?;
|
|
||||||
map.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Custom deserialization to enable removing spans from enums.
|
|
||||||
pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result<Span, D::Error> {
|
|
||||||
deserializer.deserialize_map(SpanMapVisitor)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This visitor is used by the deserializer to unwrap mappings
|
|
||||||
/// and extract span information.
|
|
||||||
struct SpanMapVisitor;
|
|
||||||
|
|
||||||
impl<'de> Visitor<'de> for SpanMapVisitor {
|
|
||||||
type Value = Span;
|
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
formatter.write_str("Mapping from `span` keyword to span information")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_map<M: MapAccess<'de>>(self, mut access: M) -> Result<Self::Value, M::Error> {
|
|
||||||
let (_, value): (String, Span) = access.next_entry()?.unwrap();
|
|
||||||
Ok(value)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
use serde::{Deserialize, Deserializer, Serializer};
|
|
||||||
use tendril::StrTendril;
|
|
||||||
|
|
||||||
/// Serialization for the StrTendril type.
|
|
||||||
pub fn serialize<S: Serializer>(tendril: &StrTendril, serializer: S) -> Result<S::Ok, S::Error> {
|
|
||||||
serializer.serialize_str(&tendril[..])
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Deserialization for the StrTendril type.
|
|
||||||
pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result<StrTendril, D::Error> {
|
|
||||||
Ok(String::deserialize(deserializer)?.into())
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -87,31 +87,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when a user tries to user console assert outside of a test function.
|
|
||||||
@formatted
|
|
||||||
console_assertion_depends_on_input {
|
|
||||||
args: (),
|
|
||||||
msg: "console.assert() does not produce constraints and cannot use inputs. \
|
|
||||||
Assertions should only be used in @test functions",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a console assert fails.
|
|
||||||
@formatted
|
|
||||||
console_assertion_failed {
|
|
||||||
args: (),
|
|
||||||
msg: "console.assert(...) failed",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a console assert value is not a boolean.
|
|
||||||
@formatted
|
|
||||||
console_assertion_must_be_boolean {
|
|
||||||
args: (),
|
|
||||||
msg: "Assertion expression must evaluate to a boolean value",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a experssion gadget oepration cannot be enforced due to a SnarkVM syntehsis error.
|
/// For when a experssion gadget oepration cannot be enforced due to a SnarkVM syntehsis error.
|
||||||
@formatted
|
@formatted
|
||||||
cannot_enforce_expression {
|
cannot_enforce_expression {
|
||||||
@ -131,30 +106,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when an array length goes out of the legal bounds of 2^32.
|
|
||||||
@formatted
|
|
||||||
array_length_out_of_bounds {
|
|
||||||
args: (),
|
|
||||||
msg: "array length cannot be >= 2^32",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an array index goes out of the legal bounds of 2^32.
|
|
||||||
@formatted
|
|
||||||
array_index_out_of_legal_bounds {
|
|
||||||
args: (),
|
|
||||||
msg: "array index cannot be >= 2^32",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a boolean expression does not resolve to a boolean type.
|
|
||||||
@formatted
|
|
||||||
conditional_boolean_expression_fails_to_resolve_to_bool {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("if, else conditional must resolve to a boolean, found `{}`", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the expected circuit member could not be found.
|
/// For when the expected circuit member could not be found.
|
||||||
@formatted
|
@formatted
|
||||||
expected_circuit_member {
|
expected_circuit_member {
|
||||||
@ -163,38 +114,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the operation has no implementation on the type of variable received.
|
|
||||||
@formatted
|
|
||||||
incompatible_types {
|
|
||||||
args: (operation: impl Display),
|
|
||||||
msg: format!("no implementation for `{}`", operation),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a tuple index goes out of the tuples size bounds.
|
|
||||||
@formatted
|
|
||||||
tuple_index_out_of_bounds {
|
|
||||||
args: (index: impl Display),
|
|
||||||
msg: format!("cannot access index {} of tuple out of bounds", index),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an array index goes out of the arrays size bounds.
|
|
||||||
@formatted
|
|
||||||
array_index_out_of_bounds {
|
|
||||||
args: (index: impl Display),
|
|
||||||
msg: format!("cannot access index {} of array out of bounds", index),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a invalid array slice length is requested.
|
|
||||||
@formatted
|
|
||||||
array_invalid_slice_length {
|
|
||||||
args: (),
|
|
||||||
msg: "illegal length of slice",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an array index does not resolve to an integer type.
|
/// For when an array index does not resolve to an integer type.
|
||||||
@formatted
|
@formatted
|
||||||
invalid_index_expression {
|
invalid_index_expression {
|
||||||
@ -203,57 +122,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when a typed array receives an assignment of an array with a different length.
|
|
||||||
@formatted
|
|
||||||
unexpected_array_length {
|
|
||||||
args: (expected: impl Display, actual: impl Display),
|
|
||||||
msg: format!("expected array length {}, found one with length {}", expected, actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the circuit static member does not exist.
|
|
||||||
@formatted
|
|
||||||
invalid_circuit_static_member_access {
|
|
||||||
args: (member: impl Display),
|
|
||||||
msg: format!("invalid circuit static member `{}` must be accessed using `::` syntax", member),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a user is trying to use an array in access expression before it is declared.
|
|
||||||
@formatted
|
|
||||||
undefined_array {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("array `{}` must be declared before it is used in an expression", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user is trying to us a circuit that is not yet declared.
|
|
||||||
@formatted
|
|
||||||
undefined_circuit {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"circuit `{}` must be declared before it is used in an expression",
|
|
||||||
actual
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to use an identifier not declared in scope.
|
|
||||||
@formatted
|
|
||||||
undefined_identifier {
|
|
||||||
args: (name: impl Display),
|
|
||||||
msg: format!("Cannot find value `{}` in this scope", name),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to access an undefined circuit member.
|
|
||||||
@formatted
|
|
||||||
undefined_circuit_member_access {
|
|
||||||
args: (circuit: impl Display, member: impl Display),
|
|
||||||
msg: format!("Circuit `{}` has no member `{}`", circuit, member),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the input variable type mismatches the declared function input type.
|
/// For when the input variable type mismatches the declared function input type.
|
||||||
@formatted
|
@formatted
|
||||||
input_variable_type_mismatch {
|
input_variable_type_mismatch {
|
||||||
@ -265,30 +133,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the declared function input variable was expected to be constant
|
|
||||||
/// but the input file did not have it in the constants section.
|
|
||||||
@formatted
|
|
||||||
expected_const_input_variable {
|
|
||||||
args: (variable: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"Expected input variable `{}` to be constant. Move input variable `{}` to [constants] section of input file",
|
|
||||||
variable, variable
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the declared function input variable was expected to be mutable
|
|
||||||
/// but the input file did not have it in the main section.
|
|
||||||
@formatted
|
|
||||||
expected_non_const_input_variable {
|
|
||||||
args: (variable: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"Expected input variable `{}` to be non-constant. Move input variable `{}` to [main] section of input file",
|
|
||||||
variable, variable
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the declared function input variable was expected to be a valid array
|
/// For when the declared function input variable was expected to be a valid array
|
||||||
/// in the input file.
|
/// in the input file.
|
||||||
@formatted
|
@formatted
|
||||||
@ -330,7 +174,7 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the declared function input variable was expected to be a valid tuple
|
/// For when the declared function input variable was not defined
|
||||||
/// in the input file.
|
/// in the input file.
|
||||||
@formatted
|
@formatted
|
||||||
function_input_not_found {
|
function_input_not_found {
|
||||||
@ -339,6 +183,14 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For when the declared function input register was not defined
|
||||||
|
@formatted
|
||||||
|
function_missing_input_register {
|
||||||
|
args: (expected: impl Display),
|
||||||
|
msg: format!("missing input '{}' for registers", expected),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
/// For when the declared function input variable was defined twice
|
/// For when the declared function input variable was defined twice
|
||||||
/// in the input file.
|
/// in the input file.
|
||||||
@formatted
|
@formatted
|
||||||
@ -367,6 +219,14 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For when a circuit was passed as input
|
||||||
|
@formatted
|
||||||
|
circuit_as_input {
|
||||||
|
args: (),
|
||||||
|
msg: "input circuits not supported for input",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
/// For when there's an IO error with the output file.
|
/// For when there's an IO error with the output file.
|
||||||
@backtraced
|
@backtraced
|
||||||
output_file_io_error {
|
output_file_io_error {
|
||||||
@ -375,14 +235,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the output file cannot be read.
|
|
||||||
@backtraced
|
|
||||||
output_file_cannot_read {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot read the provided ouput file - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the output file cannot be removed.
|
/// For when the output file cannot be removed.
|
||||||
@backtraced
|
@backtraced
|
||||||
output_file_cannot_remove {
|
output_file_cannot_remove {
|
||||||
@ -391,98 +243,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the user tries to index a single array more than once.
|
|
||||||
@formatted
|
|
||||||
statement_array_assign_index {
|
|
||||||
args: (),
|
|
||||||
msg: "Cannot assign single index to array of values",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to use a non const value as an index.
|
|
||||||
@formatted
|
|
||||||
statement_array_assign_index_const {
|
|
||||||
args: (),
|
|
||||||
msg: "Cannot assign to non-const array index",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to assign an index to something not an array of length >= 1;
|
|
||||||
@formatted
|
|
||||||
statement_array_assign_interior_index {
|
|
||||||
args: (),
|
|
||||||
msg: "Cannot assign single index to interior of array of values",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to assign a range of values to something that expected a single value.
|
|
||||||
@formatted
|
|
||||||
statement_array_assign_range {
|
|
||||||
args: (),
|
|
||||||
msg: "Cannot assign range of array values to single value",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to index a value from an array that is >= the array length.
|
|
||||||
@formatted
|
|
||||||
statement_array_assign_index_bounds {
|
|
||||||
args: (index: impl Display, length: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"Array assign index `{}` out of range for array of length `{}`",
|
|
||||||
index, length
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user defines an array range values that is >= the array length.
|
|
||||||
@formatted
|
|
||||||
statement_array_assign_range_order {
|
|
||||||
args: (start: impl Display, stop: impl Display, length: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"Array assign range `{}`..`{}` out of range for array of length `{}`",
|
|
||||||
start, stop, length
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the statement conditional boolean fails to resolve to a boolean.
|
|
||||||
@formatted
|
|
||||||
statement_conditional_boolean_fails_to_resolve_to_boolean {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("If, else conditional must resolve to a boolean, found `{}`", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there was an error in SnarkVM trying to do a bit and operation.
|
|
||||||
@formatted
|
|
||||||
statement_indicator_calculation {
|
|
||||||
args: (name: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"Constraint system failed to evaluate branch selection indicator `{}`",
|
|
||||||
name
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a multi definition statement found a differing number of values and variable names.
|
|
||||||
@formatted
|
|
||||||
statement_invalid_number_of_definitions {
|
|
||||||
args: (expected: impl Display, actual: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"Multiple definition statement expected {} values, found {} variable names",
|
|
||||||
expected, actual
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to assign multiple variables to a single value.
|
|
||||||
@formatted
|
|
||||||
statement_multiple_definition {
|
|
||||||
args: (value: impl Display),
|
|
||||||
msg: format!("cannot assign multiple variables to a single value: {}", value),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a function returns multiple times.
|
/// For when a function returns multiple times.
|
||||||
@formatted
|
@formatted
|
||||||
statement_multiple_returns {
|
statement_multiple_returns {
|
||||||
@ -513,65 +273,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the user tries to index a single tuple more than once.
|
|
||||||
@formatted
|
|
||||||
statement_tuple_assign_index {
|
|
||||||
args: (),
|
|
||||||
msg: "Cannot assign single index to tuple of values",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user tries to index a value from an tuple that is >= the tuple length.
|
|
||||||
@formatted
|
|
||||||
statement_tuple_assign_index_bounds {
|
|
||||||
args: (index: impl Display, length: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"Tuple assign index `{}` out of range for tuple of length `{}`",
|
|
||||||
index, length
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user doesn't assign or return the expression.
|
|
||||||
@formatted
|
|
||||||
statement_unassigned {
|
|
||||||
args: (),
|
|
||||||
msg: "Expected assignment of return values for expression",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a statement tries to use an unknown variable.
|
|
||||||
@formatted
|
|
||||||
statement_undefined_variable {
|
|
||||||
args: (name: impl Display),
|
|
||||||
msg: format!("Attempted to assign to unknown variable `{}`", name),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user defines a statement that tries to access an unknown circuit member variable.
|
|
||||||
@formatted
|
|
||||||
statement_undefined_circuit_variable {
|
|
||||||
args: (name: impl Display),
|
|
||||||
msg: format!("Attempted to assign to unknown circuit member variable `{}`", name),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the user uses a nont const value for an iteration range.
|
|
||||||
@formatted
|
|
||||||
statement_loop_index_const {
|
|
||||||
args: (),
|
|
||||||
msg: "iteration range must be const",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there is an issue with an address value account.
|
|
||||||
@formatted
|
|
||||||
address_value_account_error {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("account creation failed due to `{}`", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there is an invalid address value.
|
/// For when there is an invalid address value.
|
||||||
@formatted
|
@formatted
|
||||||
address_value_invalid_address {
|
address_value_invalid_address {
|
||||||
@ -580,229 +281,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when an a address value was expected but none was found.
|
|
||||||
@formatted
|
|
||||||
address_value_missing_address {
|
|
||||||
args: (),
|
|
||||||
msg: "expected address input not found",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a boolean operation cannot be enforced due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
boolean_value_cannot_enforce {
|
|
||||||
args: (operation: impl Display, error: impl ErrorArg),
|
|
||||||
msg: format!(
|
|
||||||
"the boolean operation `{}` failed due to the synthesis error `{}`",
|
|
||||||
operation, error,
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a invalid boolean operation is called.
|
|
||||||
@formatted
|
|
||||||
boolean_value_cannot_evaluate {
|
|
||||||
args: (operation: impl Display),
|
|
||||||
msg: format!("no implementation found for `{}`", operation),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there is an invalid boolean value.
|
|
||||||
@formatted
|
|
||||||
boolean_value_invalid_boolean {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("expected boolean input type, found `{}`", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a boolean value was expected but none was found.
|
|
||||||
@formatted
|
|
||||||
boolean_value_missing_boolean {
|
|
||||||
args: (expected: impl Display),
|
|
||||||
msg: format!("expected boolean input `{}` not found", expected),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there is an invalid char value.
|
|
||||||
@formatted
|
|
||||||
char_value_invalid_char {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("expected char element input type, found `{}`", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when negating a field value fails due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
field_value_negate_operation {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("field negation failed due to synthesis error `{}`", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a field operation cannot be enforced due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
field_value_binary_operation {
|
|
||||||
args: (operation: impl Display, error: impl ErrorArg),
|
|
||||||
msg: format!(
|
|
||||||
"the field binary operation `{}` failed due to synthesis error `{}`",
|
|
||||||
operation, error,
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there is an invalid field value.
|
|
||||||
@formatted
|
|
||||||
field_value_invalid_field {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("expected field element input type, found `{}`", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a field value was expected but none was found.
|
|
||||||
@formatted
|
|
||||||
field_value_missing_field {
|
|
||||||
args: (expected: impl Display),
|
|
||||||
msg: format!("expected field input `{}` not found", expected),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when negating a group value fails due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
group_value_negate_operation {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("group negation failed due to the synthesis error `{}`", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a group operation cannot be enforced due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
group_value_binary_operation {
|
|
||||||
args: (operation: impl Display, error: impl ErrorArg),
|
|
||||||
msg: format!(
|
|
||||||
"the group binary operation `{}` failed due to the synthesis error `{}`",
|
|
||||||
operation, error,
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there is an invalid group value.
|
|
||||||
@formatted
|
|
||||||
group_value_invalid_group {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("expected group affine point input type, found `{}`", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a group value was expected but none was found.
|
|
||||||
@formatted
|
|
||||||
group_value_missing_group {
|
|
||||||
args: (expected: impl Display),
|
|
||||||
msg: format!("expected group input `{}` not found", expected),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the synthesis of a group failed due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
group_value_synthesis_error {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("compilation failed due to group synthesis error `{}`", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the x coordinate of a group is invalid.
|
|
||||||
@formatted
|
|
||||||
group_value_x_invalid {
|
|
||||||
args: (x: impl Display),
|
|
||||||
msg: format!("invalid x coordinate `{}`", x),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the y coordinate of a group is invalid.
|
|
||||||
@formatted
|
|
||||||
group_value_y_invalid {
|
|
||||||
args: (y: impl Display),
|
|
||||||
msg: format!("invalid y coordinate `{}`", y),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the current group value is not on the current supported curve.
|
|
||||||
@formatted
|
|
||||||
group_value_not_on_curve {
|
|
||||||
args: (element: impl Display),
|
|
||||||
msg: format!("group element `{}` is not on the supported curve", element),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the x coordinate of a group could not be recovered.
|
|
||||||
@formatted
|
|
||||||
group_value_x_recover {
|
|
||||||
args: (),
|
|
||||||
msg: "could not recover group element from x coordinate",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the y coordinate of a group could not be recovered.
|
|
||||||
@formatted
|
|
||||||
group_value_y_recover {
|
|
||||||
args: (),
|
|
||||||
msg: "could not recover group element from y coordinate",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when a group generator cannot be multiplied by some number.
|
|
||||||
@formatted
|
|
||||||
group_value_n_group {
|
|
||||||
args: (number: impl Display),
|
|
||||||
msg: format!("cannot multiply group generator by \"{}\"", number),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a signed integer operation cannot be enforced due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
integer_value_signed {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("integer operation failed due to the signed integer error `{}`", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a unsigned integer operation cannot be enforced due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
integer_value_unsigned {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!(
|
|
||||||
"integer operation failed due to the unsigned integer error `{}`",
|
|
||||||
error
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a integer operation cannot be enforced due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
integer_value_synthesis {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("integer operation failed due to the synthesis error `{}`", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when negating a integer value fails due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
integer_value_negate_operation {
|
|
||||||
args: (),
|
|
||||||
msg: "integer negation can only be enforced on signed integers",
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a binary integer operation cannot be enforced due to a SnarkVM synthesis error.
|
|
||||||
@formatted
|
|
||||||
integer_value_binary_operation {
|
|
||||||
args: (operation: impl Display),
|
|
||||||
msg: format!(
|
|
||||||
"the integer binary operation `{}` can only be enforced on integers of the same type",
|
|
||||||
operation
|
|
||||||
),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when there is an integer type mismatch, one kind was expected but another was received.
|
/// For when there is an integer type mismatch, one kind was expected but another was received.
|
||||||
@formatted
|
@formatted
|
||||||
integer_value_integer_type_mismatch {
|
integer_value_integer_type_mismatch {
|
||||||
@ -811,43 +289,35 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when there is an invalid integer value.
|
|
||||||
@formatted
|
|
||||||
integer_value_invalid_integer {
|
|
||||||
args: (actual: impl Display),
|
|
||||||
msg: format!("failed to parse `{}` as expected integer type", actual),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a integer value was expected but none was found.
|
|
||||||
@formatted
|
|
||||||
integer_value_missing_integer {
|
|
||||||
args: (expected: impl Display),
|
|
||||||
msg: format!("expected integer input `{}` not found", expected),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when an a integer operation has no implementation.
|
|
||||||
@formatted
|
|
||||||
integer_value_cannot_evaluate {
|
|
||||||
args: (operation: impl Display),
|
|
||||||
msg: format!("no implementation found for `{}`", operation),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when .len() method is used on non-array values/variables.
|
/// For when .len() method is used on non-array values/variables.
|
||||||
@formatted
|
@formatted
|
||||||
lengthof_can_only_be_used_on_arrays {
|
lengthof_can_only_be_used_on_arrays {
|
||||||
args: (),
|
args: (),
|
||||||
msg: "len() can only be called on an array value".to_string(),
|
msg: "len() can only be called on an array value",
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when equality operator is used on arrays with different sizes.
|
/// For when a circuit static const access was execpted.
|
||||||
@formatted
|
@formatted
|
||||||
array_sizes_must_match_in_eq {
|
expected_circuit_static_const_access {
|
||||||
args: (lhs: impl Display, rhs: impl Display),
|
args: (),
|
||||||
msg: format!("array sizes must match for comparison; left: {}, right: {}", lhs, rhs),
|
msg: "A circuit static const access was expected",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when a user tries to assign to a circuit static member.
|
||||||
|
@formatted
|
||||||
|
illegal_static_member_assignment {
|
||||||
|
args: (member: impl Display),
|
||||||
|
msg: format!("Tried to assign to static member `{}`", member),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when arrays with unspecified size are used in main.
|
||||||
|
@formatted
|
||||||
|
input_array_size_must_be_specified {
|
||||||
|
args: (),
|
||||||
|
msg: "arrays in main function input must have known size",
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
225
errors/src/emitter/mod.rs
Normal file
225
errors/src/emitter/mod.rs
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// The Leo library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use super::LeoError;
|
||||||
|
use core::default::Default;
|
||||||
|
use core::fmt;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
/// Types that are sinks for compiler errors.
|
||||||
|
pub trait Emitter {
|
||||||
|
/// Emit the error `err`.
|
||||||
|
fn emit_err(&mut self, err: LeoError);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A trivial `Emitter` using the standard error.
|
||||||
|
pub struct StderrEmitter;
|
||||||
|
|
||||||
|
impl Emitter for StderrEmitter {
|
||||||
|
fn emit_err(&mut self, err: LeoError) {
|
||||||
|
eprintln!("{}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A buffer of `T`s.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Buffer<T>(Vec<T>);
|
||||||
|
|
||||||
|
impl<T> Default for Buffer<T> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self(Vec::new())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Buffer<T> {
|
||||||
|
/// Push `x` to the buffer.
|
||||||
|
pub fn push(&mut self, x: T) {
|
||||||
|
self.0.push(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Extract the underlying list of Ts.
|
||||||
|
pub fn into_inner(self) -> Vec<T> {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: fmt::Display> fmt::Display for Buffer<T> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
let mut iter = self.0.iter();
|
||||||
|
if let Some(x) = iter.next() {
|
||||||
|
x.fmt(f)?;
|
||||||
|
}
|
||||||
|
for x in iter {
|
||||||
|
f.write_fmt(format_args!("\n{}", x))?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A buffer of `LeoError`s.
|
||||||
|
pub type ErrBuffer = Buffer<LeoError>;
|
||||||
|
|
||||||
|
/// An `Emitter` that collects into a list.
|
||||||
|
#[derive(Default, Clone)]
|
||||||
|
pub struct BufferEmitter(Rc<RefCell<ErrBuffer>>);
|
||||||
|
|
||||||
|
impl BufferEmitter {
|
||||||
|
/// Returns a new buffered emitter.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
BufferEmitter(<_>::default())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Extracts all the errors collected in this emitter.
|
||||||
|
pub fn extract(&self) -> ErrBuffer {
|
||||||
|
self.0.take()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Emitter for BufferEmitter {
|
||||||
|
fn emit_err(&mut self, err: LeoError) {
|
||||||
|
self.0.borrow_mut().push(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Contains the actual data for `Handler`.
|
||||||
|
/// Modelled this way to afford an API using interior mutability.
|
||||||
|
struct HandlerInner {
|
||||||
|
/// Number of errors emitted thus far.
|
||||||
|
count: usize,
|
||||||
|
/// The sink through which errors will be emitted.
|
||||||
|
emitter: Box<dyn Emitter>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HandlerInner {
|
||||||
|
/// Emit the error `err`.
|
||||||
|
fn emit_err(&mut self, err: LeoError) {
|
||||||
|
self.count = self.count.saturating_add(1);
|
||||||
|
self.emitter.emit_err(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A handler deals with errors and other compiler output.
|
||||||
|
pub struct Handler {
|
||||||
|
/// The inner handler.
|
||||||
|
/// `RefCell` is used here to avoid `&mut` all over the compiler.
|
||||||
|
inner: RefCell<HandlerInner>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Handler {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new(Box::new(StderrEmitter))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Handler {
|
||||||
|
/// Construct a `Handler` using the given `emitter`.
|
||||||
|
pub fn new(emitter: Box<dyn Emitter>) -> Self {
|
||||||
|
let inner = RefCell::new(HandlerInner { count: 0, emitter });
|
||||||
|
Self { inner }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Construct a `Handler` that will append to `buf`.
|
||||||
|
pub fn new_with_buf() -> (Self, BufferEmitter) {
|
||||||
|
let buf = BufferEmitter::default();
|
||||||
|
let handler = Self::new(Box::new(buf.clone()));
|
||||||
|
(handler, buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Runs `logic` provided a handler that collects all errors into the `String`,
|
||||||
|
/// or if there were none, returns some `T`.
|
||||||
|
pub fn with<T>(logic: impl for<'a> FnOnce(&'a Handler) -> Result<T, LeoError>) -> Result<T, ErrBuffer> {
|
||||||
|
let (handler, buf) = Handler::new_with_buf();
|
||||||
|
handler.extend_if_error(logic(&handler)).map_err(|_| buf.extract())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Emit the error `err`.
|
||||||
|
pub fn emit_err(&self, err: LeoError) {
|
||||||
|
self.inner.borrow_mut().emit_err(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Emits the error `err`.
|
||||||
|
/// This will immediately abort compilation.
|
||||||
|
pub fn fatal_err(&self, err: LeoError) -> ! {
|
||||||
|
let code = err.exit_code();
|
||||||
|
self.emit_err(err);
|
||||||
|
std::process::exit(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The number of errors thus far.
|
||||||
|
pub fn err_count(&self) -> usize {
|
||||||
|
self.inner.borrow().count
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Did we have any errors thus far?
|
||||||
|
pub fn had_errors(&self) -> bool {
|
||||||
|
self.err_count() > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Extend handler with `error` given `res = Err(error)`.
|
||||||
|
#[allow(clippy::result_unit_err)]
|
||||||
|
pub fn extend_if_error<T>(&self, res: Result<T, LeoError>) -> Result<T, ()> {
|
||||||
|
match res {
|
||||||
|
Ok(_) if self.had_errors() => Err(()),
|
||||||
|
Ok(x) => Ok(x),
|
||||||
|
Err(e) => {
|
||||||
|
self.emit_err(e);
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use crate::ParserError;
|
||||||
|
use leo_span::Span;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn fresh_no_errors() {
|
||||||
|
let handler = Handler::new(Box::new(BufferEmitter::new()));
|
||||||
|
assert_eq!(handler.err_count(), 0);
|
||||||
|
assert!(!handler.had_errors());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn buffer_works() {
|
||||||
|
let count_err = |s: String| s.lines().filter(|l| l.contains("Error")).count();
|
||||||
|
|
||||||
|
let res: Result<(), _> = Handler::with(|h| {
|
||||||
|
let s = Span::default();
|
||||||
|
assert_eq!(h.err_count(), 0);
|
||||||
|
h.emit_err(ParserError::invalid_import_list(&s).into());
|
||||||
|
assert_eq!(h.err_count(), 1);
|
||||||
|
h.emit_err(ParserError::unexpected_eof(&s).into());
|
||||||
|
assert_eq!(h.err_count(), 2);
|
||||||
|
Err(ParserError::spread_in_array_init(&s).into())
|
||||||
|
});
|
||||||
|
|
||||||
|
assert_eq!(count_err(res.unwrap_err().to_string()), 3);
|
||||||
|
|
||||||
|
let res: Result<(), _> = Handler::with(|h| {
|
||||||
|
let s = Span::default();
|
||||||
|
h.emit_err(ParserError::invalid_import_list(&s).into());
|
||||||
|
h.emit_err(ParserError::unexpected_eof(&s).into());
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
|
assert_eq!(count_err(res.unwrap_err().to_string()), 2);
|
||||||
|
|
||||||
|
let () = Handler::with(|_| Ok(())).unwrap();
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -113,4 +113,12 @@ create_errors!(
|
|||||||
msg: format!("failed to read the stdlib import file `{}`", import),
|
msg: format!("failed to read the stdlib import file `{}`", import),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For when directory name matches file name in the same source folder.
|
||||||
|
@formatted
|
||||||
|
conflicting_local_imports {
|
||||||
|
args: (names: impl Debug),
|
||||||
|
msg: format!("unable to select import location, conflicting paths are found: `{:?}`", names),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -17,6 +17,9 @@
|
|||||||
#![deny(clippy::all, clippy::missing_docs_in_private_items)]
|
#![deny(clippy::all, clippy::missing_docs_in_private_items)]
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
|
||||||
|
/// Contains traits and types for channels through which errors go.
|
||||||
|
pub mod emitter;
|
||||||
|
|
||||||
/// Contains the ASG error definitions.
|
/// Contains the ASG error definitions.
|
||||||
pub mod asg;
|
pub mod asg;
|
||||||
pub use self::asg::*;
|
pub use self::asg::*;
|
||||||
@ -127,7 +130,7 @@ impl LeoError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implment exit code for each type of Error, even the ones that don't have one.
|
/// Implement exit code for each type of Error, even the ones that don't have one.
|
||||||
pub fn exit_code(&self) -> i32 {
|
pub fn exit_code(&self) -> i32 {
|
||||||
use LeoError::*;
|
use LeoError::*;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -27,14 +27,6 @@ create_errors!(
|
|||||||
exit_code_mask: 5000i32,
|
exit_code_mask: 5000i32,
|
||||||
error_code_prefix: "PAK",
|
error_code_prefix: "PAK",
|
||||||
|
|
||||||
/// For when creating the imports directory failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_create_imports_directory {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("failed creating imports directory {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the specified import does not exist.
|
/// For when the specified import does not exist.
|
||||||
@backtraced
|
@backtraced
|
||||||
import_does_not_exist {
|
import_does_not_exist {
|
||||||
@ -49,14 +41,6 @@ create_errors!(
|
|||||||
args: (error: impl ErrorArg),
|
args: (error: impl ErrorArg),
|
||||||
msg: format!("failed removing imports directory {}", error),
|
msg: format!("failed removing imports directory {}", error),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
|
||||||
|
|
||||||
/// For when creating the inputs directory failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_create_inputs_directory {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("failed creating inputs directory {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when getting a input file entry failed.
|
/// For when getting a input file entry failed.
|
||||||
@ -107,117 +91,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the input file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_input_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error input file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when reading the state file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_read_state_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot read state file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the state file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_state_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error state file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when reading the checksum file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_read_checksum_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot read checksum file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when removing the checksum file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_checksum_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot remove checksum file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the checksum file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_checksum_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO cannot read checksum file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when reading the circuit file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_read_circuit_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot read circuit file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when removing the circuit file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_circuit_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot remove circuit file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the circuit file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_circuit_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error circuit file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when creating the outputs directory failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_create_outputs_directory {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("failed creating outputs directory {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_outputs_directory {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("failed removing outputs directory {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when reading the proof file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_read_proof_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot read proof file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when removing the proof file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_proof_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot remove proof file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the proof file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_proof_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error proof file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when reading the proving key failed.
|
/// For when reading the proving key failed.
|
||||||
@backtraced
|
@backtraced
|
||||||
failed_to_read_proving_key_file {
|
failed_to_read_proving_key_file {
|
||||||
@ -226,38 +99,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when removing the proving key file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_proving_key_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot remove proving key file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the proving key file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_proving_key_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error proving key file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when reading the snapshot file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_read_snapshot_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot read snapshot file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when removing the snapshot file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_snapshot_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot remove snapshot file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when reading the verification key file failed.
|
/// For when reading the verification key file failed.
|
||||||
@backtraced
|
@backtraced
|
||||||
failed_to_read_verification_key_file {
|
failed_to_read_verification_key_file {
|
||||||
@ -266,54 +107,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when removing the verification key file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_verification_key_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("Cannot remove verification key file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the verification key file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_verification_key_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error verification key file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the gitignore file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_gitignore_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error gitignore file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when creating the manifest file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_create_manifest_file {
|
|
||||||
args: (filename: impl Display, error: impl ErrorArg),
|
|
||||||
msg: format!("failed creating manifest file `{}` {}", filename, error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when getting the manifest file metadata failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_get_manifest_metadata_file {
|
|
||||||
args: (filename: impl Display, error: impl ErrorArg),
|
|
||||||
msg: format!("failed getting manifest file metadata `{}` {}", filename, error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when opening the manifest file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_open_manifest_file {
|
|
||||||
args: (filename: impl Display, error: impl ErrorArg),
|
|
||||||
msg: format!("failed openining manifest file `{}` {}", filename, error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when parsing the manifest file failed.
|
/// For when parsing the manifest file failed.
|
||||||
@backtraced
|
@backtraced
|
||||||
failed_to_parse_manifest_file {
|
failed_to_parse_manifest_file {
|
||||||
@ -330,30 +123,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when writing the manifest file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_write_manifest_file {
|
|
||||||
args: (filename: impl Display, error: impl ErrorArg),
|
|
||||||
msg: format!("failed writing manifest file `{}` {}", filename, error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the manifest file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_manifest_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error manifest file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the readme file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_readme_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error readme file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when creating the zip file failed.
|
/// For when creating the zip file failed.
|
||||||
@backtraced
|
@backtraced
|
||||||
failed_to_create_zip_file {
|
failed_to_create_zip_file {
|
||||||
@ -386,22 +155,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when removing the zip file failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_remove_zip_file {
|
|
||||||
args: (path: impl Debug),
|
|
||||||
msg: format!("failed removing zip file from the provided file path - {:?}", path),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when zipping fails.
|
|
||||||
@backtraced
|
|
||||||
failed_to_zip {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: error,
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the zip file has an IO error.
|
/// For when the zip file has an IO error.
|
||||||
@backtraced
|
@backtraced
|
||||||
io_error_zip_file {
|
io_error_zip_file {
|
||||||
@ -410,27 +163,11 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the library file has an IO error.
|
/// For when removing the zip file failed.
|
||||||
@backtraced
|
@backtraced
|
||||||
io_error_library_file {
|
failed_to_remove_zip_file {
|
||||||
args: (error: impl ErrorArg),
|
args: (path: impl Debug),
|
||||||
msg: format!("IO error library file from the provided file path - {}", error),
|
msg: format!("failed removing zip file from the provided file path - {:?}", path),
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the main file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_main_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error main file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when creating the source directory failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_create_source_directory {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("failed creating source directory {}", error),
|
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,14 +211,6 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when reading the source directory failed.
|
|
||||||
@backtraced
|
|
||||||
failed_to_read_source_directory {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("failed reading source directory {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// For when the package failed to initalize.
|
/// For when the package failed to initalize.
|
||||||
@backtraced
|
@backtraced
|
||||||
failed_to_initialize_package {
|
failed_to_initialize_package {
|
||||||
@ -545,18 +274,50 @@ create_errors!(
|
|||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For when the lock file has an IO error.
|
|
||||||
@backtraced
|
|
||||||
io_error_lock_file {
|
|
||||||
args: (error: impl ErrorArg),
|
|
||||||
msg: format!("IO error lock file from the provided file path - {}", error),
|
|
||||||
help: None,
|
|
||||||
}
|
|
||||||
|
|
||||||
@backtraced
|
@backtraced
|
||||||
failed_to_serialize_lock_file {
|
failed_to_serialize_lock_file {
|
||||||
args: (error: impl ErrorArg),
|
args: (error: impl ErrorArg),
|
||||||
msg: format!("serialization failed: {}", error),
|
msg: format!("serialization failed: {}", error),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For when creating a directory failed.
|
||||||
|
@backtraced
|
||||||
|
failed_to_create_directory {
|
||||||
|
args: (dirname: impl Display, error: impl ErrorArg),
|
||||||
|
msg: format!("failed to create directory: {}, error: {}", dirname, error),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when removing a directory failed.
|
||||||
|
@backtraced
|
||||||
|
failed_to_remove_directory {
|
||||||
|
args: (dirname: impl Display, error: impl ErrorArg),
|
||||||
|
msg: format!("failed to remove directory: {}, error: {}", dirname, error),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when file could not be read.
|
||||||
|
@backtraced
|
||||||
|
failed_to_read_file {
|
||||||
|
args: (path: impl Display, error: impl ErrorArg),
|
||||||
|
msg: format!("failed to read file: {}, error: {}", path, error),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when file failed to remove.
|
||||||
|
@backtraced
|
||||||
|
failed_to_remove_file {
|
||||||
|
args: (path: impl Display, error: impl ErrorArg),
|
||||||
|
msg: format!("failed to remove file: {}, error: {}", path, error),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For when I/O operation failed.
|
||||||
|
@backtraced
|
||||||
|
io_error {
|
||||||
|
args: (file: impl Display, error: impl ErrorArg),
|
||||||
|
msg: format!("i/o operation failed, file: {}, error: {}", file, error),
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
@ -183,4 +183,44 @@ create_errors!(
|
|||||||
msg: "unable to parse array dimensions",
|
msg: "unable to parse array dimensions",
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For when the parser encountered a deprecated `mut self` parameter in a member function declaration.
|
||||||
|
@formatted
|
||||||
|
mut_self_parameter {
|
||||||
|
args: (),
|
||||||
|
msg: "`mut self` is no longer accepted. Use `&self` if you would like to pass in a mutable reference to `self`",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// When a member const comes after a member variable.
|
||||||
|
@formatted
|
||||||
|
member_const_after_var {
|
||||||
|
args: (),
|
||||||
|
msg: "Member variables must come after member consts.",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// When a member const comes after a member function.
|
||||||
|
@formatted
|
||||||
|
member_const_after_fun {
|
||||||
|
args: (),
|
||||||
|
msg: "Member functions must come after member consts.",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// When a member variable comes after a member function.
|
||||||
|
@formatted
|
||||||
|
member_var_after_fun {
|
||||||
|
args: (),
|
||||||
|
msg: "Member functions must come after member variables.",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// E.g., on `[u8; ()]`.
|
||||||
|
@formatted
|
||||||
|
array_tuple_dimensions_empty {
|
||||||
|
args: (),
|
||||||
|
msg: "Array dimensions specified as a tuple cannot be empty.",
|
||||||
|
help: None,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
// Copyright (C) 2019-2022 Aleo Systems Inc.
|
||||||
// This file is part of the Leo library.
|
// This file is part of the Leo library.
|
||||||
|
|
||||||
// The Leo library is free software: you can redistribute it and/or modify
|
// The Leo library is free software: you can redistribute it and/or modify
|
||||||
|
Loading…
Reference in New Issue
Block a user