mirror of
https://github.com/AleoHQ/leo.git
synced 2025-01-02 23:04:12 +03:00
alias node type
This commit is contained in:
parent
3f3d84dcdd
commit
93509bf5c1
@ -29,7 +29,7 @@ pub struct Canonicalizer {
|
||||
// If we are in a circuit keep track of the circuit name.
|
||||
circuit_name: Option<Identifier>,
|
||||
in_circuit: bool,
|
||||
alias_lookup: Box<dyn Fn(String) -> Option<(Type, Span)>>,
|
||||
alias_lookup: Box<dyn Fn(String) -> Option<Alias>>,
|
||||
}
|
||||
|
||||
impl AstPass for Canonicalizer {
|
||||
@ -41,11 +41,11 @@ impl AstPass for Canonicalizer {
|
||||
}
|
||||
|
||||
impl Canonicalizer {
|
||||
pub fn new(aliases: IndexMap<String, (Type, Span)>) -> Self {
|
||||
pub fn new(aliases: IndexMap<String, Alias>) -> Self {
|
||||
Self {
|
||||
circuit_name: None,
|
||||
in_circuit: false,
|
||||
alias_lookup: Box::new(move |alias: String| -> Option<(Type, Span)> { aliases.get(&alias).cloned() }),
|
||||
alias_lookup: Box::new(move |alias: String| -> Option<Alias> { aliases.get(&alias).cloned() }),
|
||||
}
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ impl ReconstructingReducer for Canonicalizer {
|
||||
}
|
||||
Type::CircuitOrAlias(identifier) => {
|
||||
if let Some(alias_type) = (self.alias_lookup)(identifier.name.to_string()) {
|
||||
return self.reduce_type(type_, alias_type.0, &alias_type.1);
|
||||
return self.reduce_type(type_, alias_type.represents, &alias_type.name.span);
|
||||
}
|
||||
|
||||
Ok(Type::CircuitOrAlias(identifier))
|
||||
|
@ -125,13 +125,13 @@ where
|
||||
expected_input: Vec<FunctionInput>,
|
||||
import_statements: Vec<ImportStatement>,
|
||||
empty_imports: IndexMap<String, Program>,
|
||||
mut aliases: IndexMap<String, (Type, Span)>,
|
||||
mut aliases: IndexMap<String, Alias>,
|
||||
mut circuits: IndexMap<String, Circuit>,
|
||||
mut functions: IndexMap<String, Function>,
|
||||
mut global_consts: IndexMap<String, DefinitionStatement>,
|
||||
) -> Result<Program> {
|
||||
if !empty_imports.is_empty() {
|
||||
// TODO THROW ERROR
|
||||
return Err(AstError::injected_programs(empty_imports.len()).into());
|
||||
}
|
||||
|
||||
let mut imported_symbols: Vec<(Vec<String>, ImportSymbol, Span)> = vec![];
|
||||
@ -148,22 +148,20 @@ where
|
||||
|
||||
let mut resolved_packages: IndexMap<Vec<String>, Program> = IndexMap::new();
|
||||
for (package, span) in deduplicated_imports {
|
||||
let _pretty_package = package.join(".");
|
||||
let pretty_package = package.join(".");
|
||||
|
||||
// TODO FIX ERROR
|
||||
let resolved_package =
|
||||
match wrapped_resolver.resolve_package(&package.iter().map(|x| &**x).collect::<Vec<_>>()[..], &span)? {
|
||||
Some(x) => x,
|
||||
None => return Err(AstError::empty_string(&span).into()),
|
||||
None => return Err(AstError::unresolved_import(pretty_package, &span).into()),
|
||||
};
|
||||
|
||||
resolved_packages.insert(package.clone(), resolved_package);
|
||||
}
|
||||
|
||||
// TODO ERROR
|
||||
// TODO copyable AST.
|
||||
for (package, symbol, span) in imported_symbols.into_iter() {
|
||||
let _pretty_package = package.join(".");
|
||||
let pretty_package = package.join(".");
|
||||
|
||||
let resolved_package = resolved_packages
|
||||
.get_mut(&package)
|
||||
@ -186,7 +184,7 @@ where
|
||||
} else if let Some(global_const) = resolved_package.global_consts.get(&name) {
|
||||
global_consts.insert(name.clone(), global_const.clone());
|
||||
} else {
|
||||
return Err(AstError::empty_string(&span).into());
|
||||
return Err(AstError::unresolved_import(pretty_package, &span).into());
|
||||
}
|
||||
}
|
||||
ImportSymbol::Alias(name, alias) => {
|
||||
@ -199,7 +197,7 @@ where
|
||||
} else if let Some(global_const) = resolved_package.global_consts.get(&name) {
|
||||
global_consts.insert(alias.clone(), global_const.clone());
|
||||
} else {
|
||||
return Err(AstError::empty_string(&span).into());
|
||||
return Err(AstError::unresolved_import(pretty_package, &span).into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,17 +16,18 @@
|
||||
|
||||
use crate::{Identifier, Type};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Alias {
|
||||
pub name: Identifier,
|
||||
pub represents: Box<Type>,
|
||||
pub represents: Type,
|
||||
}
|
||||
|
||||
impl fmt::Display for Alias {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "alias {} == {}", self.name.name, self.represents)
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{} : {}", self.name.name, self.represents)
|
||||
}
|
||||
}
|
18
ast/src/aliases/mod.rs
Normal file
18
ast/src/aliases/mod.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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/>.
|
||||
|
||||
pub mod alias;
|
||||
pub use self::alias::*;
|
@ -22,6 +22,9 @@
|
||||
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
pub mod aliases;
|
||||
pub use self::aliases::*;
|
||||
|
||||
pub mod annotation;
|
||||
pub use self::annotation::*;
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
//! A Leo program consists of import, circuit, and function definitions.
|
||||
//! Each defined type consists of ast statements and expressions.
|
||||
|
||||
use crate::{Circuit, DefinitionStatement, Function, FunctionInput, ImportStatement, Type};
|
||||
|
||||
use leo_errors::Span;
|
||||
use crate::{Alias, Circuit, DefinitionStatement, Function, FunctionInput, ImportStatement};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -32,7 +30,7 @@ pub struct Program {
|
||||
pub expected_input: Vec<FunctionInput>,
|
||||
pub import_statements: Vec<ImportStatement>,
|
||||
pub imports: IndexMap<String, Program>,
|
||||
pub aliases: IndexMap<String, (Type, Span)>,
|
||||
pub aliases: IndexMap<String, Alias>,
|
||||
pub circuits: IndexMap<String, Circuit>,
|
||||
pub global_consts: IndexMap<String, DefinitionStatement>,
|
||||
pub functions: IndexMap<String, Function>,
|
||||
@ -51,8 +49,8 @@ impl fmt::Display for Program {
|
||||
writeln!(f,)?;
|
||||
}
|
||||
writeln!(f,)?;
|
||||
for alias in self.aliases.iter() {
|
||||
write!(f, "({}, {})", alias.0, alias.1 .0)?;
|
||||
for (_, alias) in self.aliases.iter() {
|
||||
alias.fmt(f)?;
|
||||
writeln!(f,)?;
|
||||
}
|
||||
writeln!(f,)?;
|
||||
|
@ -427,9 +427,15 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
}
|
||||
|
||||
let mut aliases = IndexMap::new();
|
||||
for (name, (type_, span)) in program.aliases.iter() {
|
||||
let type_ = self.reduce_type(type_, span)?;
|
||||
aliases.insert(name.clone(), (type_, span.clone()));
|
||||
for (name, alias) in program.aliases.iter() {
|
||||
let represents = self.reduce_type(&alias.represents, &alias.name.span)?;
|
||||
aliases.insert(
|
||||
name.clone(),
|
||||
Alias {
|
||||
name: alias.name.clone(),
|
||||
represents,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
let mut circuits = IndexMap::new();
|
||||
|
@ -382,7 +382,7 @@ pub trait ReconstructingReducer {
|
||||
expected_input: Vec<FunctionInput>,
|
||||
import_statements: Vec<ImportStatement>,
|
||||
imports: IndexMap<String, Program>,
|
||||
aliases: IndexMap<String, (Type, Span)>,
|
||||
aliases: IndexMap<String, Alias>,
|
||||
circuits: IndexMap<String, Circuit>,
|
||||
functions: IndexMap<String, Function>,
|
||||
global_consts: IndexMap<String, DefinitionStatement>,
|
||||
|
@ -14,9 +14,6 @@
|
||||
// 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/>.
|
||||
|
||||
pub mod alias;
|
||||
pub use alias::*;
|
||||
|
||||
pub mod integer_type;
|
||||
pub use integer_type::*;
|
||||
|
||||
|
@ -33,14 +33,6 @@ create_errors!(
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a import of the specified name is unresolved.
|
||||
@formatted
|
||||
unresolved_import {
|
||||
args: (name: impl Display),
|
||||
msg: format!("failed to resolve import: '{}'", name),
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a circuit member of the specified name is unresolved.
|
||||
@formatted
|
||||
unresolved_circuit_member {
|
||||
|
@ -15,7 +15,10 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::create_errors;
|
||||
use std::{error::Error as ErrorArg, fmt::Debug};
|
||||
use std::{
|
||||
error::Error as ErrorArg,
|
||||
fmt::{Debug, Display},
|
||||
};
|
||||
|
||||
create_errors!(
|
||||
/// AstError enum that represents all the errors for the `leo-ast` crate.
|
||||
@ -102,4 +105,21 @@ create_errors!(
|
||||
msg: "Console::Assert cannot be matched here, its handled in another case.",
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// This error is for when a user tries to use the library and programatically inject an import
|
||||
/// on the rust side.
|
||||
@backtraced
|
||||
injected_programs {
|
||||
args: (injected_import_count: impl Display),
|
||||
msg: format!("It seems the AST has {} injected imports. This is unexpected please import the library naturally", injected_import_count),
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a import of the specified name is unresolved.
|
||||
@formatted
|
||||
unresolved_import {
|
||||
args: (name: impl Display),
|
||||
msg: format!("failed to resolve import: '{}'", name),
|
||||
help: None,
|
||||
}
|
||||
);
|
||||
|
@ -27,9 +27,9 @@ create_errors!(
|
||||
/// For when the parser encountered an unexpected token.
|
||||
@formatted
|
||||
unexpected_token {
|
||||
args: (message: impl Display, help: String),
|
||||
args: (message: impl Display),
|
||||
msg: message,
|
||||
help: Some(help),
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when the parser encoutnered an invalid address literal.
|
||||
|
@ -62,8 +62,8 @@ impl ParserContext {
|
||||
global_consts.insert(name, global_const);
|
||||
}
|
||||
Token::Type => {
|
||||
let (name, type_) = self.parse_type_alias()?;
|
||||
aliases.insert(name, type_);
|
||||
let (name, alias) = self.parse_type_alias()?;
|
||||
aliases.insert(name, alias);
|
||||
}
|
||||
_ => {
|
||||
return Err(ParserError::unexpected(
|
||||
@ -526,16 +526,22 @@ impl ParserContext {
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns an [`(String, (Type, Span))`] AST node if the next tokens represent a global
|
||||
/// Returns an [`(String, Alias)`] AST node if the next tokens represent a global
|
||||
/// const definition statement and assignment.
|
||||
///
|
||||
pub fn parse_type_alias(&mut self) -> Result<(String, (Type, Span))> {
|
||||
pub fn parse_type_alias(&mut self) -> Result<(String, Alias)> {
|
||||
self.expect(Token::Type)?;
|
||||
let name = self.expect_ident()?;
|
||||
self.expect(Token::Assign)?;
|
||||
let type_ = self.parse_type()?;
|
||||
let (type_, _) = self.parse_type()?;
|
||||
self.expect(Token::Semicolon)?;
|
||||
|
||||
Ok((name.name.to_string(), type_))
|
||||
Ok((
|
||||
name.name.to_string(),
|
||||
Alias {
|
||||
represents: type_,
|
||||
name,
|
||||
},
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ pub(crate) fn tokenize(path: &str, input: StrTendril) -> Result<Vec<SpannedToken
|
||||
} else if token_len == 0 {
|
||||
return Err(ParserError::unexpected_token(
|
||||
&input[index..index + 1],
|
||||
"HELP TODO".to_string(),
|
||||
&Span::new(
|
||||
line_no,
|
||||
line_no,
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373020]: array index out of bounds: '0'\n --> compiler-test:7:24\n |\n 7 | const z: [u8; 2] = y[..1u32][..x];\n | ^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373019]: array index out of bounds: '0'\n --> compiler-test:7:24\n |\n 7 | const z: [u8; 2] = y[..1u32][..x];\n | ^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 2', received: 'array of length 1'\n --> compiler-test:4:31\n |\n 4 | const arr: [u8; (2, 2)] = [[1u8; 2]; 1]; // incorrect dimensions\n | ^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 2', received: 'array of length 1'\n --> compiler-test:4:31\n |\n 4 | const arr: [u8; (2, 2)] = [[1u8; 2]; 1]; // incorrect dimensions\n | ^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 2', received: 'array of length 1'\n --> compiler-test:5:35\n |\n 5 | [1u8]]; // incorrect dimensions\n | ^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 2', received: 'array of length 1'\n --> compiler-test:5:35\n |\n 5 | [1u8]]; // incorrect dimensions\n | ^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 2', received: 'array of length 1'\n --> compiler-test:4:31\n |\n 4 | const arr: [u8; (2, 2)] = [1u8; (2, 1)]; // incorrect dimensions\n | ^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 2', received: 'array of length 1'\n --> compiler-test:4:31\n |\n 4 | const arr: [u8; (2, 2)] = [1u8; (2, 1)]; // incorrect dimensions\n | ^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:6:30\n |\n 6 | const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:6:30\n |\n 6 | const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:5:30\n |\n 5 | const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:5:30\n |\n 5 | const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:29\n |\n 4 | const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:29\n |\n 4 | const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:34\n |\n 4 | const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:34\n |\n 4 | const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:29\n |\n 4 | const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:29\n |\n 4 | const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:34\n |\n 4 | const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:34\n |\n 4 | const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 2', received: 'array of length 3'\n --> compiler-test:4:29\n |\n 4 | const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 2', received: 'array of length 3'\n --> compiler-test:4:29\n |\n 4 | const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:32\n |\n 4 | const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:32\n |\n 4 | const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 2', received: 'array of length 3'\n --> compiler-test:4:29\n |\n 4 | const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 2', received: 'array of length 3'\n --> compiler-test:4:29\n |\n 4 | const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:32\n |\n 4 | const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)\n | ^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 4', received: 'array of length 2'\n --> compiler-test:4:32\n |\n 4 | const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)\n | ^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370000]: '\n --> compiler-test:4:23\n |\n 4 | const not_valid = '';\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> compiler-test:4:23\n |\n 4 | const not_valid = '';\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'self'\n --> compiler-test:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'self'\n --> compiler-test:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373003]: missing circuit member 'x' for initialization of circuit 'Foo'\n --> compiler-test:9:15\n |\n 9 | const a = Foo { y: 0u32 };\n | ^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373002]: missing circuit member 'x' for initialization of circuit 'Foo'\n --> compiler-test:9:15\n |\n 9 | const a = Foo { y: 0u32 };\n | ^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373003]: missing circuit member 'x' for initialization of circuit 'Foo'\n --> compiler-test:9:15\n |\n 9 | const a = Foo { y };\n | ^^^^^^^^^"
|
||||
- "Error [EASG0373002]: missing circuit member 'x' for initialization of circuit 'Foo'\n --> compiler-test:9:15\n |\n 9 | const a = Foo { y };\n | ^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373002]: illegal reference to non-existant member 'echoed' of circuit 'Foo'\n --> compiler-test:11:17\n |\n 11 | const err = a.echoed(1u32);\n | ^^^^^^^^"
|
||||
- "Error [EASG0373001]: illegal reference to non-existant member 'echoed' of circuit 'Foo'\n --> compiler-test:11:17\n |\n 11 | const err = a.echoed(1u32);\n | ^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373009]: cannot call static function 'echo' of circuit 'Foo' from target\n --> compiler-test:11:17\n |\n 11 | const err = a.echo(1u32); // echo is a static function and must be accessed using `::`\n | ^^^^^^"
|
||||
- "Error [EASG0373008]: cannot call static function 'echo' of circuit 'Foo' from target\n --> compiler-test:11:17\n |\n 11 | const err = a.echo(1u32); // echo is a static function and must be accessed using `::`\n | ^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373028]: failed to resolve variable reference 'Foo'\n --> compiler-test:10:17\n |\n 10 | const err = Foo.echo(1u32); // Invalid, echo is a static function and must be accessed using `::`\n | ^^^"
|
||||
- "Error [EASG0373027]: failed to resolve variable reference 'Foo'\n --> compiler-test:10:17\n |\n 10 | const err = Foo.echo(1u32); // Invalid, echo is a static function and must be accessed using `::`\n | ^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373002]: illegal reference to non-existant member 'echoed' of circuit 'Foo'\n --> compiler-test:10:17\n |\n 10 | const err = Foo::echoed(1u32);\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373001]: illegal reference to non-existant member 'echoed' of circuit 'Foo'\n --> compiler-test:10:17\n |\n 10 | const err = Foo::echoed(1u32);\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373002]: illegal reference to non-existant member 'y' of circuit 'Foo'\n --> compiler-test:9:17\n |\n 9 | const err = a.y;\n | ^^^"
|
||||
- "Error [EASG0373001]: illegal reference to non-existant member 'y' of circuit 'Foo'\n --> compiler-test:9:17\n |\n 9 | const err = a.y;\n | ^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373007]: attempt to assign to function 'bar'\n --> compiler-test:12:5\n |\n 12 | f.bar = 1u8;\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373006]: attempt to assign to function 'bar'\n --> compiler-test:12:5\n |\n 12 | f.bar = 1u8;\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373007]: attempt to assign to function 'bar'\n --> compiler-test:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373006]: attempt to assign to function 'bar'\n --> compiler-test:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373007]: attempt to assign to function 'bar'\n --> compiler-test:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373006]: attempt to assign to function 'bar'\n --> compiler-test:9:9\n |\n 9 | self.bar = new;\n | ^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'self'\n --> compiler-test:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'self'\n --> compiler-test:7:9\n |\n 7 | self.a = new;\n | ^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373006]: extra circuit member 'a' for initialization of circuit 'Foo' is not allowed\n --> compiler-test:8:19\n |\n 8 | let f = Foo { a: 0u8 };\n | ^"
|
||||
- "Error [EASG0373005]: extra circuit member 'a' for initialization of circuit 'Foo' is not allowed\n --> compiler-test:8:19\n |\n 8 | let f = Foo { a: 0u8 };\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'f'\n --> compiler-test:10:5\n |\n 10 | f.a = 1u8;\n | ^^^^^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'f'\n --> compiler-test:10:5\n |\n 10 | f.a = 1u8;\n | ^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373009]: cannot call static function 'bar' of circuit 'Foo' from target\n --> compiler-test:13:17\n |\n 13 | const err = foo.bar();\n | ^^^^^^^"
|
||||
- "Error [EASG0373008]: cannot call static function 'bar' of circuit 'Foo' from target\n --> compiler-test:13:17\n |\n 13 | const err = foo.bar();\n | ^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373009]: cannot call static function 'bar' of circuit 'Foo' from target\n --> compiler-test:11:17\n |\n 11 | const err = foo.bar();\n | ^^^^^^^"
|
||||
- "Error [EASG0373008]: cannot call static function 'bar' of circuit 'Foo' from target\n --> compiler-test:11:17\n |\n 11 | const err = foo.bar();\n | ^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373028]: failed to resolve variable reference 'a'\n --> compiler-test:4:23\n |\n 4 | console.log(\"{}\", a);\n | ^"
|
||||
- "Error [EASG0373027]: failed to resolve variable reference 'a'\n --> compiler-test:4:23\n |\n 4 | console.log(\"{}\", a);\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EAST0372008]: Cannot constrcut an empty string: it has the type of [char; 0] which is not possible.\n --> compiler-test:3:30\n |\n 3 | import core.unstable.blake2s.BadCircuit; // `BadCircuit` is not included in the blake2s package\n | ^^^^^^^^^^"
|
||||
- "Error [EAST0372011]: failed to resolve import: 'core.unstable.blake2s'\n --> compiler-test:3:30\n |\n 3 | import core.unstable.blake2s.BadCircuit; // `BadCircuit` is not included in the blake2s package\n | ^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EAST0372008]: Cannot constrcut an empty string: it has the type of [char; 0] which is not possible.\n --> compiler-test:3:13\n |\n 3 | import core.*; // You cannot import all dependencies from core at once\n | ^"
|
||||
- "Error [EAST0372011]: failed to resolve import: 'core'\n --> compiler-test:3:13\n |\n 3 | import core.*; // You cannot import all dependencies from core at once\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EAST0372008]: Cannot constrcut an empty string: it has the type of [char; 0] which is not possible.\n --> compiler-test:3:13\n |\n 3 | import core.bad_circuit; // `bad_circuit` is not a core package\n | ^^^^^^^^^^^"
|
||||
- "Error [EAST0372011]: failed to resolve import: 'core'\n --> compiler-test:3:13\n |\n 3 | import core.bad_circuit; // `bad_circuit` is not a core package\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EAST0372008]: Cannot constrcut an empty string: it has the type of [char; 0] which is not possible.\n --> compiler-test:3:22\n |\n 3 | import core.unstable.bad_circuit; // `bad_circuit` is not a core unstable package\n | ^^^^^^^^^^^"
|
||||
- "Error [EAST0372011]: failed to resolve import: 'core.unstable'\n --> compiler-test:3:22\n |\n 3 | import core.unstable.bad_circuit; // `bad_circuit` is not a core unstable package\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373035]: function 'main' failed to validate return path: 'cannot have asymmetrical return in if statement'\n --> compiler-test:4:5\n |\n 4 | if true {\n 5 | ...\n 6 | }\n | ^"
|
||||
- "Error [EASG0373034]: function 'main' failed to validate return path: 'cannot have asymmetrical return in if statement'\n --> compiler-test:4:5\n |\n 4 | if true {\n 5 | ...\n 6 | }\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373034]: function 'main' missing return for all paths\n --> compiler-test:3:1\n |\n 3 | function main() -> bool {\n 4 | ...\n 5 | ...\n 6 | ...\n 7 | ...\n 8 | ...\n 9 | ...\n 10 | ...\n 11 | }\n | ^"
|
||||
- "Error [EASG0373033]: function 'main' missing return for all paths\n --> compiler-test:3:1\n |\n 3 | function main() -> bool {\n 4 | ...\n 5 | ...\n 6 | ...\n 7 | ...\n 8 | ...\n 9 | ...\n 10 | ...\n 11 | }\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:12\n |\n 4 | return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]`\n | ^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:12\n |\n 4 | return [0u8; (2, 3)]; // The correct 3x2 array tuple is `[0u8; (3, 2)]`\n | ^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373026]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:12\n |\n 4 | return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]`\n | ^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'array of length 3', received: 'array of length 2'\n --> compiler-test:4:12\n |\n 4 | return [[0u8; 3]; 2]; // The correct 3x2 nested array is `[0u8; 2]; 3]`\n | ^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373028]: failed to resolve variable reference 'myGlobal'\n --> compiler-test:5:12\n |\n 5 | return myGlobal;\n | ^^^^^^^^"
|
||||
- "Error [EASG0373027]: failed to resolve variable reference 'myGlobal'\n --> compiler-test:5:12\n |\n 5 | return myGlobal;\n | ^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373024]: failed to resolve function: 'my_function'\n --> compiler-test:5:5\n |\n 5 | my_function();\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373023]: failed to resolve function: 'my_function'\n --> compiler-test:5:5\n |\n 5 | my_function();\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'basic'\n --> compiler-test:7:5\n |\n 7 | basic = 2u32;\n | ^^^^^^^^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'basic'\n --> compiler-test:7:5\n |\n 7 | basic = 2u32;\n | ^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373025]: failed to resolve type for variable definition 'unknown'\n --> compiler-test:4:17\n |\n 4 | let b = a * 2;\n | ^"
|
||||
- "Error [EASG0373024]: failed to resolve type for variable definition 'unknown'\n --> compiler-test:4:17\n |\n 4 | let b = a * 2;\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '170141183460469231731687303715884105728'\n --> compiler-test:4:21\n |\n 4 | const a: i128 = 170141183460469231731687303715884105728;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '170141183460469231731687303715884105728'\n --> compiler-test:4:21\n |\n 4 | const a: i128 = 170141183460469231731687303715884105728;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-170141183460469231731687303715884105729'\n --> compiler-test:4:21\n |\n 4 | const a: i128 = -170141183460469231731687303715884105729;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-170141183460469231731687303715884105729'\n --> compiler-test:4:21\n |\n 4 | const a: i128 = -170141183460469231731687303715884105729;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '32768'\n --> compiler-test:4:20\n |\n 4 | const a: i16 = 32768;\n | ^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '32768'\n --> compiler-test:4:20\n |\n 4 | const a: i16 = 32768;\n | ^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-32769'\n --> compiler-test:4:20\n |\n 4 | const a: i16 = -32769;\n | ^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-32769'\n --> compiler-test:4:20\n |\n 4 | const a: i16 = -32769;\n | ^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '2147483648'\n --> compiler-test:4:20\n |\n 4 | const a: i32 = 2147483648;\n | ^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '2147483648'\n --> compiler-test:4:20\n |\n 4 | const a: i32 = 2147483648;\n | ^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-2147483649'\n --> compiler-test:4:20\n |\n 4 | const a: i32 = -2147483649;\n | ^^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-2147483649'\n --> compiler-test:4:20\n |\n 4 | const a: i32 = -2147483649;\n | ^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '9223372036854775808'\n --> compiler-test:4:20\n |\n 4 | const a: i64 = 9223372036854775808;\n | ^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '9223372036854775808'\n --> compiler-test:4:20\n |\n 4 | const a: i64 = 9223372036854775808;\n | ^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-9223372036854775809'\n --> compiler-test:4:20\n |\n 4 | const a: i64 = -9223372036854775809;\n | ^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-9223372036854775809'\n --> compiler-test:4:20\n |\n 4 | const a: i64 = -9223372036854775809;\n | ^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '128'\n --> compiler-test:4:19\n |\n 4 | const a: i8 = 128;\n | ^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '128'\n --> compiler-test:4:19\n |\n 4 | const a: i8 = 128;\n | ^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-129'\n --> compiler-test:4:19\n |\n 4 | const a: i8 = -129;\n | ^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-129'\n --> compiler-test:4:19\n |\n 4 | const a: i8 = -129;\n | ^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '340282366920938463463374607431768211456'\n --> compiler-test:4:21\n |\n 4 | const a: u128 = 340282366920938463463374607431768211456;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '340282366920938463463374607431768211456'\n --> compiler-test:4:21\n |\n 4 | const a: u128 = 340282366920938463463374607431768211456;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-1'\n --> compiler-test:4:21\n |\n 4 | const a: u128 = -1;\n | ^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-1'\n --> compiler-test:4:21\n |\n 4 | const a: u128 = -1;\n | ^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '65536'\n --> compiler-test:4:20\n |\n 4 | const a: u16 = 65536;\n | ^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '65536'\n --> compiler-test:4:20\n |\n 4 | const a: u16 = 65536;\n | ^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-1'\n --> compiler-test:4:20\n |\n 4 | const a: u16 = -1;\n | ^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-1'\n --> compiler-test:4:20\n |\n 4 | const a: u16 = -1;\n | ^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '4294967296'\n --> compiler-test:4:20\n |\n 4 | const a: u32 = 4294967296;\n | ^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '4294967296'\n --> compiler-test:4:20\n |\n 4 | const a: u32 = 4294967296;\n | ^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-1'\n --> compiler-test:4:20\n |\n 4 | const a: u32 = -1;\n | ^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-1'\n --> compiler-test:4:20\n |\n 4 | const a: u32 = -1;\n | ^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '18446744073709551616'\n --> compiler-test:4:20\n |\n 4 | const a: u64 = 18446744073709551616;\n | ^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '18446744073709551616'\n --> compiler-test:4:20\n |\n 4 | const a: u64 = 18446744073709551616;\n | ^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-1'\n --> compiler-test:4:20\n |\n 4 | const a: u64 = -1;\n | ^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-1'\n --> compiler-test:4:20\n |\n 4 | const a: u64 = -1;\n | ^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '256'\n --> compiler-test:4:19\n |\n 4 | const a: u8 = 256;\n | ^^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '256'\n --> compiler-test:4:19\n |\n 4 | const a: u8 = 256;\n | ^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373031]: failed to parse int value '-1'\n --> compiler-test:4:19\n |\n 4 | const a: u8 = -1;\n | ^^"
|
||||
- "Error [EASG0373030]: failed to parse int value '-1'\n --> compiler-test:4:19\n |\n 4 | const a: u8 = -1;\n | ^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'a'\n --> compiler-test:5:5\n |\n 5 | a[0] = 0;\n | ^^^^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'a'\n --> compiler-test:5:5\n |\n 5 | a[0] = 0;\n | ^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'a'\n --> compiler-test:10:5\n |\n 10 | a.x = 0;\n | ^^^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'a'\n --> compiler-test:10:5\n |\n 10 | a.x = 0;\n | ^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373010]: cannot call mutable member function 'foo' of circuit 'Foo' from immutable context\n --> compiler-test:15:5\n |\n 15 | a.foo();\n | ^^^^^"
|
||||
- "Error [EASG0373009]: cannot call mutable member function 'foo' of circuit 'Foo' from immutable context\n --> compiler-test:15:5\n |\n 15 | a.foo();\n | ^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373006]: extra circuit member 'x' for initialization of circuit 'Foo' is not allowed\n --> compiler-test:8:19\n |\n 8 | let a = Foo { x: 1 };\n | ^"
|
||||
- "Error [EASG0373005]: extra circuit member 'x' for initialization of circuit 'Foo' is not allowed\n --> compiler-test:8:19\n |\n 8 | let a = Foo { x: 1 };\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'a'\n --> compiler-test:6:5\n |\n 6 | a = 0;\n | ^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'a'\n --> compiler-test:6:5\n |\n 6 | a = 0;\n | ^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373028]: failed to resolve variable reference 'a'\n --> compiler-test:5:5\n |\n 5 | a = false;\n | ^"
|
||||
- "Error [EASG0373027]: failed to resolve variable reference 'a'\n --> compiler-test:5:5\n |\n 5 | a = false;\n | ^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373033]: illegal assignment to immutable variable 'a'\n --> compiler-test:6:5\n |\n 6 | a = 0;\n | ^^^^^"
|
||||
- "Error [EASG0373032]: illegal assignment to immutable variable 'a'\n --> compiler-test:6:5\n |\n 6 | a = 0;\n | ^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373021]: ternary sides had different types: left u32, right bool\n --> compiler-test:4:13\n |\n 4 | let x = true ? x: true;\n | ^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373020]: ternary sides had different types: left u32, right bool\n --> compiler-test:4:13\n |\n 4 | let x = true ? x: true;\n | ^^^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373017]: a variable named \"x\" already exists in this scope\n --> compiler-test:5:3\n |\n 5 | let x = true;\n | ^^^^^^^^^^^^"
|
||||
- "Error [EASG0373016]: a variable named \"x\" already exists in this scope\n --> compiler-test:5:3\n |\n 5 | let x = true;\n | ^^^^^^^^^^^^"
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373015]: failed to create const variable(s) 'y' with non constant values.\n --> compiler-test:5:5\n |\n 5 | const y = x > 2u8? 1u8 : 2u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
- "Error [EASG0373014]: failed to create const variable(s) 'y' with non constant values.\n --> compiler-test:5:5\n |\n 5 | const y = x > 2u8? 1u8 : 2u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
|
@ -2,38 +2,38 @@
|
||||
namespace: Token
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | 'a\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | ''\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x9A'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x7'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x7g'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xz'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x80'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xc1'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xc2'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xDF'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xC0'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xe0'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x9f'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | 'abcdefg'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\t\\t'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\a'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\z'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\A'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\Z'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\1'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\9'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\*'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u{bbbbb}\\u{aaaa}'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\uz'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u1'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u123'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u{2764z'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u{276g}'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u00000000'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u01000000'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u9999999'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '😭😂😘'\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | 'a\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | ''\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x9A'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x7'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x7g'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xz'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x80'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xc1'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xc2'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xDF'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xC0'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\xe0'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x9f'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | 'abcdefg'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\t\\t'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\a'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\z'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\A'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\Z'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\1'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\9'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\*'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\x'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u{bbbbb}\\u{aaaa}'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\uz'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u1'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u123'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u{2764z'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u{276g}'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u00000000'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u01000000'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '\\u9999999'\n | ^"
|
||||
- "Error [EPAR0370000]: '\n --> test:1:1\n |\n 1 | '😭😂😘'\n | ^"
|
||||
|
@ -2,10 +2,10 @@
|
||||
namespace: Token
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"Hello world!\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\\"\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\l\"\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\uaaa\"\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\u\"\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\xFF\"\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\x\"\n | ^\n |\n = HELP TODO"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"Hello world!\n | ^"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\\"\n | ^"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\l\"\n | ^"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\uaaa\"\n | ^"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\u\"\n | ^"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\xFF\"\n | ^"
|
||||
- "Error [EPAR0370000]: \"\n --> test:1:1\n |\n 1 | \"\\x\"\n | ^"
|
||||
|
Loading…
Reference in New Issue
Block a user