mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-28 02:33:18 +03:00
aliases tests, and some bug fixes, errors
This commit is contained in:
parent
2ecb10730e
commit
d100db7396
@ -82,6 +82,14 @@ impl<'a> Function<'a> {
|
||||
qualifier = FunctionQualifier::MutSelfRef;
|
||||
}
|
||||
FunctionInput::Variable(input_variable) => {
|
||||
if arguments.contains_key(input_variable.identifier.name.as_ref()) {
|
||||
return Err(AsgError::duplicate_function_input_definition(
|
||||
input_variable.identifier.name.as_ref(),
|
||||
&input_variable.identifier.span,
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
||||
let variable = scope.context.alloc_variable(RefCell::new(crate::InnerVariable {
|
||||
id: scope.context.get_id(),
|
||||
name: input_variable.identifier.clone(),
|
||||
@ -133,6 +141,10 @@ impl<'a> Function<'a> {
|
||||
.insert("self".to_string(), self_variable);
|
||||
}
|
||||
for (name, argument) in self.arguments.iter() {
|
||||
/* if self.scope.resolve_alias(name).is_some() {
|
||||
return Err(AsgError::cannot_shadow_name("function input", name, "alias", &argument.get().borrow().name.span).into());
|
||||
} */
|
||||
|
||||
self.scope.variables.borrow_mut().insert(name.clone(), argument.get());
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ pub use function::*;
|
||||
|
||||
use crate::{node::FromAst, ArenaNode, AsgContext, DefinitionStatement, Input, Scope, Statement};
|
||||
use leo_ast::{PackageAccess, PackageOrPackages};
|
||||
use leo_errors::{AsgError, AstError, Result, Span};
|
||||
use leo_errors::{AsgError, Result, Span};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
@ -185,7 +185,7 @@ impl<'a> Program<'a> {
|
||||
} else if let Some(global_const) = resolved_package.global_consts.get(&name) {
|
||||
imported_global_consts.insert(name.clone(), *global_const);
|
||||
} else {
|
||||
return Err(AstError::unresolved_import(pretty_package, &span).into());
|
||||
return Err(AsgError::unresolved_import(pretty_package, &span).into());
|
||||
}
|
||||
}
|
||||
ImportSymbol::Alias(name, alias) => {
|
||||
@ -198,7 +198,7 @@ impl<'a> Program<'a> {
|
||||
} else if let Some(global_const) = resolved_package.global_consts.get(&name) {
|
||||
imported_global_consts.insert(alias.clone(), *global_const);
|
||||
} else {
|
||||
return Err(AstError::unresolved_import(pretty_package, &span).into());
|
||||
return Err(AsgError::unresolved_import(pretty_package, &span).into());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -234,6 +234,14 @@ impl<'a> Program<'a> {
|
||||
});
|
||||
|
||||
// Prepare header-like scope entries.
|
||||
// Have to do aliases first.
|
||||
for (name, alias) in program.aliases.iter() {
|
||||
assert_eq!(name.name, alias.name.name);
|
||||
|
||||
let asg_alias = Alias::init(scope, alias)?;
|
||||
scope.aliases.borrow_mut().insert(name.name.to_string(), asg_alias);
|
||||
}
|
||||
|
||||
for (name, circuit) in program.circuits.iter() {
|
||||
assert_eq!(name.name, circuit.circuit_name.name);
|
||||
let asg_circuit = Circuit::init(scope, circuit)?;
|
||||
@ -249,13 +257,6 @@ impl<'a> Program<'a> {
|
||||
scope.circuits.borrow_mut().insert(name.name.to_string(), asg_circuit);
|
||||
}
|
||||
|
||||
for (name, alias) in program.aliases.iter() {
|
||||
assert_eq!(name.name, alias.name.name);
|
||||
|
||||
let asg_alias = Alias::init(scope, alias)?;
|
||||
scope.aliases.borrow_mut().insert(name.name.to_string(), asg_alias);
|
||||
}
|
||||
|
||||
for (name, function) in program.functions.iter() {
|
||||
assert_eq!(name.name, function.identifier.name);
|
||||
let function = Function::init(scope, function)?;
|
||||
@ -283,8 +284,7 @@ impl<'a> Program<'a> {
|
||||
let name = name.name.to_string();
|
||||
|
||||
if aliases.contains_key(&name) {
|
||||
// TODO new error for duplicate aliases
|
||||
return Err(AsgError::duplicate_function_definition(name, &alias.span).into());
|
||||
return Err(AsgError::duplicate_alias_definition(name, &alias.span).into());
|
||||
}
|
||||
|
||||
aliases.insert(name, asg_alias);
|
||||
|
@ -110,6 +110,11 @@ impl<'a> FromAst<'a, leo_ast::DefinitionStatement> for &'a Statement<'a> {
|
||||
}
|
||||
|
||||
for (variable, type_) in statement.variable_names.iter().zip(output_types.into_iter()) {
|
||||
/* let name = variable.identifier.name.as_ref();
|
||||
if scope.resolve_alias(name).is_some() {
|
||||
return Err(AsgError::cannot_shadow_name("function input", name, "alias", &variable.identifier.span).into());
|
||||
} */
|
||||
|
||||
variables.push(&*scope.context.alloc_variable(RefCell::new(InnerVariable {
|
||||
id: scope.context.get_id(),
|
||||
name: variable.identifier.clone(),
|
||||
|
@ -175,7 +175,7 @@ create_errors!(
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a user defines function with the same name twice.
|
||||
/// For when a user defines a function with the same name twice.
|
||||
@formatted
|
||||
duplicate_function_definition {
|
||||
args: (name: impl Display),
|
||||
@ -403,4 +403,44 @@ create_errors!(
|
||||
msg: "received a Self statement, which should never happen.",
|
||||
help: Some("Something went wrong during canonicalization, or you ran the ASG on an uncanonicalized AST.".to_string()),
|
||||
}
|
||||
|
||||
/// 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 user defines an alias with the same name twice.
|
||||
@formatted
|
||||
duplicate_alias_definition {
|
||||
args: (name: impl Display),
|
||||
msg: format!("a alias named \"{}\" already exists in this scope", name),
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a user defines a function input with the same name twice.
|
||||
@formatted
|
||||
duplicate_function_input_definition {
|
||||
args: (name: impl Display),
|
||||
msg: format!("a function input named \"{}\" already exists in this scope", name),
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a user defines a global const with the same name twice.
|
||||
@formatted
|
||||
duplicate_global_const_definition {
|
||||
args: (name: impl Display),
|
||||
msg: format!("a global const named \"{}\" already exists in this scope", name),
|
||||
help: None,
|
||||
}
|
||||
|
||||
/// For when a named identifier is being shadowed.
|
||||
@formatted
|
||||
cannot_shadow_name {
|
||||
args: (type_: impl Display, name: impl Display, location: impl Display),
|
||||
msg: format!("a {} cannot be named `{}` as a {} with that name already exists in this scope", type_, name, location),
|
||||
help: None,
|
||||
}
|
||||
);
|
||||
|
@ -47,6 +47,7 @@ pub trait Runner {
|
||||
}
|
||||
|
||||
pub fn run_tests<T: Runner>(runner: &T, expectation_category: &str) {
|
||||
std::env::remove_var("LEO_BACKTRACE"); // always remove backtrace so it doesn't clog output files
|
||||
std::env::set_var("LEO_TESTFRAMEWORK", "true");
|
||||
let mut pass_categories = 0;
|
||||
let mut pass_tests = 0;
|
||||
|
17
tests/compiler/aliases/arith.leo
Normal file
17
tests/compiler/aliases/arith.leo
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/basic.in
|
||||
*/
|
||||
|
||||
type int = u32;
|
||||
|
||||
function main(x: u32, y: bool) -> bool {
|
||||
let a: int = x;
|
||||
let b: int = 2;
|
||||
let c: int = a + b;
|
||||
|
||||
return a == 1u32 && b == 2u32
|
||||
&& c == 3u32 && y;
|
||||
}
|
19
tests/compiler/aliases/basic.leo
Normal file
19
tests/compiler/aliases/basic.leo
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/basic.in
|
||||
*/
|
||||
|
||||
type int = u32;
|
||||
type number = int;
|
||||
|
||||
function main(x: u32, y: bool) -> bool {
|
||||
let a: int = x;
|
||||
let b: number = 2u32;
|
||||
let c: number = 3;
|
||||
let d: u32 = a + b + c;
|
||||
|
||||
return a == 1u32 && b == 2u32
|
||||
&& c == 3u32 && d == 6u32 && y;
|
||||
}
|
25
tests/compiler/aliases/circuit.leo
Normal file
25
tests/compiler/aliases/circuit.leo
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/basic.in
|
||||
*/
|
||||
|
||||
type int = u32;
|
||||
|
||||
circuit Foo {
|
||||
a: u32;
|
||||
}
|
||||
|
||||
circuit Bar {
|
||||
a: int;
|
||||
}
|
||||
|
||||
function main(x: u32, y: bool) -> bool {
|
||||
let a: int = x;
|
||||
let f: Foo = Foo { a };
|
||||
let b: Bar = Bar { a };
|
||||
|
||||
return a == 1u32 && f.a == 1u32
|
||||
&& b.a == 1u32 && y;
|
||||
}
|
11
tests/compiler/aliases/duplicate_name_fail.leo
Normal file
11
tests/compiler/aliases/duplicate_name_fail.leo
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
type int = u32;
|
||||
type int = u8;
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
return y;
|
||||
}
|
23
tests/compiler/aliases/fn_return.leo
Normal file
23
tests/compiler/aliases/fn_return.leo
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/dummy.in
|
||||
*/
|
||||
|
||||
type int = u32;
|
||||
|
||||
function return_int_triary() -> (int, int, int) {
|
||||
return (1, 2, 3);
|
||||
}
|
||||
|
||||
function return_int_array() -> [int; 3] {
|
||||
return [0u32; 3];
|
||||
}
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
let a: (int, int, int) = return_int_triary();
|
||||
let b: [int; 3] = return_int_array();
|
||||
|
||||
return y;
|
||||
}
|
6
tests/compiler/aliases/inputs/basic.in
Normal file
6
tests/compiler/aliases/inputs/basic.in
Normal file
@ -0,0 +1,6 @@
|
||||
[main]
|
||||
x: u32 = 1;
|
||||
y: bool = true;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
5
tests/compiler/aliases/inputs/dummy.in
Normal file
5
tests/compiler/aliases/inputs/dummy.in
Normal file
@ -0,0 +1,5 @@
|
||||
[main]
|
||||
y: bool = true;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
6
tests/compiler/aliases/inputs/wrong_type_assign_fail.in
Normal file
6
tests/compiler/aliases/inputs/wrong_type_assign_fail.in
Normal file
@ -0,0 +1,6 @@
|
||||
[main]
|
||||
x: u8 = 1;
|
||||
y: bool = true;
|
||||
|
||||
[registers]
|
||||
r0: bool = false;
|
12
tests/compiler/aliases/shadowing_arg.leo
Normal file
12
tests/compiler/aliases/shadowing_arg.leo
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/basic.in
|
||||
*/
|
||||
|
||||
type x = u32;
|
||||
|
||||
function main(x: x, y: bool) -> bool {
|
||||
return y;
|
||||
}
|
14
tests/compiler/aliases/shadowing_var_allowed.leo
Normal file
14
tests/compiler/aliases/shadowing_var_allowed.leo
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
input_file:
|
||||
- inputs/dummy.in
|
||||
*/
|
||||
|
||||
type int = u32;
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
let int: int = 1u32;
|
||||
|
||||
return y;
|
||||
}
|
14
tests/compiler/aliases/wrong_type_assign_fail.leo
Normal file
14
tests/compiler/aliases/wrong_type_assign_fail.leo
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
input_file:
|
||||
- inputs/wrong_type_fail.in
|
||||
*/
|
||||
|
||||
type int = u32;
|
||||
|
||||
function main(x: u8, y: bool) -> bool {
|
||||
let a: int = x;
|
||||
|
||||
return a == 1u32 && y;
|
||||
}
|
@ -37,7 +37,7 @@ function main(
|
||||
in30: char,
|
||||
in31: char,
|
||||
in32: char,
|
||||
in32: char,
|
||||
in33: char,
|
||||
) -> ([char; 33], bool) {
|
||||
let str = [
|
||||
in1,
|
||||
@ -72,7 +72,7 @@ function main(
|
||||
in30,
|
||||
in31,
|
||||
in32,
|
||||
in32,
|
||||
in33,
|
||||
];
|
||||
console.log("{}", str);
|
||||
return (str, in1 == '\x00');
|
||||
|
9
tests/compiler/function/duplicate_parameter_fail.leo
Normal file
9
tests/compiler/function/duplicate_parameter_fail.leo
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
input_file: input/dummy.in
|
||||
*/
|
||||
|
||||
function main(a: u32, a: u32) {
|
||||
console.log("{}", 1u8);
|
||||
}
|
@ -9,6 +9,8 @@ import circuits.*;
|
||||
|
||||
function main(y: bool) -> bool {
|
||||
const a = Point { x: 1u32, y: 0u32 };
|
||||
const hello_alias: char5 = "hello";
|
||||
const hello = "hello";
|
||||
|
||||
return (foo() == 1u32) == y;
|
||||
return( (foo() == 1u32) && hello_alias == hello) == y;
|
||||
}
|
||||
|
@ -6,3 +6,5 @@ circuit Point {
|
||||
function foo() -> u32 {
|
||||
return 1u32;
|
||||
}
|
||||
|
||||
type char5 = [char; 5];
|
||||
|
22
tests/expectations/compiler/compiler/aliases/arith.leo.out
Normal file
22
tests/expectations/compiler/compiler/aliases/arith.leo.out
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- circuit:
|
||||
num_public_variables: 0
|
||||
num_private_variables: 130
|
||||
num_constraints: 131
|
||||
at: 543fa6d0af950bf301b03e1d060f09a396c2dc452933a3f54a9ef177bfda6180
|
||||
bt: a46e57da3c684733a4f1736d56fe7952266ba68b2a23eebcb4ef933f4ebb41ff
|
||||
ct: fd808ddd42dbcc9eb18899f0eb8a2bc1ee8e03f983ecec6daa77e2c2d9910d1e
|
||||
output:
|
||||
- input_file: inputs/basic.in
|
||||
output:
|
||||
registers:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: a4a3b4b30742544a6dae3d76794504173c1cc64f217bd3feda033ce51512a670
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: a4a3b4b30742544a6dae3d76794504173c1cc64f217bd3feda033ce51512a670
|
||||
type_inferenced_ast: 508686ddeb2f8fad60d9ad58639b5a761e6c5f5b61e105803eb8a98d8065a2ad
|
22
tests/expectations/compiler/compiler/aliases/basic.leo.out
Normal file
22
tests/expectations/compiler/compiler/aliases/basic.leo.out
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- circuit:
|
||||
num_public_variables: 0
|
||||
num_private_variables: 163
|
||||
num_constraints: 165
|
||||
at: 2e4efaa1289da67c2193ecea16201f9597166a181e5d852d41661ad4b9f67844
|
||||
bt: bf213d7a070672f468bd4696a2165494ea56abce861fa4448817d94420ce6f78
|
||||
ct: e674d668d6c90bd7c273e33096d7eea5a052a6e14b2b43bad69c3e1c969faf72
|
||||
output:
|
||||
- input_file: inputs/basic.in
|
||||
output:
|
||||
registers:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: d83b33119db295fa2ed7795c8e17d4073cabba5e90e9438cd53f3a9a77585f19
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: d83b33119db295fa2ed7795c8e17d4073cabba5e90e9438cd53f3a9a77585f19
|
||||
type_inferenced_ast: 77be8ec74bc15f2a45e8bf29e7973bc0c721008fe5508dcc6d02b91aae3d84ee
|
22
tests/expectations/compiler/compiler/aliases/circuit.leo.out
Normal file
22
tests/expectations/compiler/compiler/aliases/circuit.leo.out
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- circuit:
|
||||
num_public_variables: 0
|
||||
num_private_variables: 129
|
||||
num_constraints: 129
|
||||
at: 3d05e65d63384d40f8e9badce0037b78ce2e18846d9edefaa9bc7a76af2a9e60
|
||||
bt: 25af4128cd670015f61576b1a59afa3873cd5584fd5422b1ce629091ca9b7ce0
|
||||
ct: f7fe29e5eac37611ff97ae6d2506967d9b946424522a1b6ac203fec85df7e787
|
||||
output:
|
||||
- input_file: inputs/basic.in
|
||||
output:
|
||||
registers:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: d9b0b6772317f0e2d1042dba26c19b4eb71a7e902c643cbeb0a4f62630f0f1bc
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: d9b0b6772317f0e2d1042dba26c19b4eb71a7e902c643cbeb0a4f62630f0f1bc
|
||||
type_inferenced_ast: e384fbed9e161b04c6c9e85f45788e5047385f289ef89d20fdacee00a8fb3e5c
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373044]: a alias named \"int\" already exists in this scope\n --> compiler-test:4:6\n |\n 4 | type int = u8;\n | ^^^"
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- circuit:
|
||||
num_public_variables: 0
|
||||
num_private_variables: 1
|
||||
num_constraints: 1
|
||||
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
|
||||
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
|
||||
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
|
||||
output:
|
||||
- input_file: inputs/dummy.in
|
||||
output:
|
||||
registers:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: 7feac3e33e75789d3b532a7cc857f324cd7abed380d578791803b3162edcfdec
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: 7feac3e33e75789d3b532a7cc857f324cd7abed380d578791803b3162edcfdec
|
||||
type_inferenced_ast: bc54ad21e90ab297b40ff570dfc379cbca61fdc9e20bd6899f4b964f726954b0
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- circuit:
|
||||
num_public_variables: 0
|
||||
num_private_variables: 33
|
||||
num_constraints: 33
|
||||
at: a06eb411f53130890e49a9f69bddb47294f83d0589b68c415747223b23dee7ed
|
||||
bt: d3062f2cf90527cdc167b4e2c3ac10f1a8d51edcefa4991ac3d62fee0d3553cc
|
||||
ct: ba3a1dbda7521fc175cc7ea8b04f1d61a74268d3a43a5e30c3ee86ae6ff797d0
|
||||
output:
|
||||
- input_file: inputs/basic.in
|
||||
output:
|
||||
registers:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: 671704ed30a8c68ebffe2a58ff4799f626badf975d2d0dded3b06f5264e5c0db
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: 671704ed30a8c68ebffe2a58ff4799f626badf975d2d0dded3b06f5264e5c0db
|
||||
type_inferenced_ast: eb525f7c227207a1037b96838d2f0cf597968c14117b3fae30564f3cd5a3a27b
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373047]: a function input cannot be named `x` as a alias with that name already exists in this scope\n --> compiler-test:5:15\n |\n 5 | function main(x: u32, y: bool) -> bool {\n | ^"
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Pass
|
||||
outputs:
|
||||
- circuit:
|
||||
num_public_variables: 0
|
||||
num_private_variables: 1
|
||||
num_constraints: 1
|
||||
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
|
||||
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
|
||||
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
|
||||
output:
|
||||
- input_file: inputs/dummy.in
|
||||
output:
|
||||
registers:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: cd2e85ff29ee11d30e73dbba0a612223a8a26dff125069ad7ac05697fd4c9829
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: cd2e85ff29ee11d30e73dbba0a612223a8a26dff125069ad7ac05697fd4c9829
|
||||
type_inferenced_ast: 1e73226b2cbbd5c7a36ffe70b778e0e544976d2e09a1f0ba3f2b486d1b604d58
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373047]: a function input cannot be named `int` as a alias with that name already exists in this scope\n --> compiler-test:6:9\n |\n 6 | let int: int = 1u32;\n | ^^^"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373025]: unexpected type, expected: 'u32', received: 'u8'\n --> compiler-test:6:18\n |\n 6 | let a: int = x;\n | ^"
|
@ -4,22 +4,22 @@ expectation: Pass
|
||||
outputs:
|
||||
- circuit:
|
||||
num_public_variables: 0
|
||||
num_private_variables: 35
|
||||
num_private_variables: 36
|
||||
num_constraints: 3
|
||||
at: 27242eeb2faf33996c0329ac2ec3b337434f78d392ff29465d3508084de6c721
|
||||
bt: 4727127f178bb02895a615bf38a4aa3c5cb9d2b076eca15ebe6fea741b48ce98
|
||||
ct: cae904ba23a045f4438177f10211a50ae29eee49d08211c731aee88353dc0cfb
|
||||
at: 25579220a31118007fe071d3083ad5a5503f7dc6bd4d51abf15f1a7778a99c86
|
||||
bt: 8f5bf097224289e45b78e01a711900a993240585fe13744f9ab71a9c5c4d9111
|
||||
ct: df019f90846f94966d481bfb6d579bee9c47d281176e210ccd973210afc957a1
|
||||
output:
|
||||
- input_file: inputs/nonprinting.in
|
||||
output:
|
||||
registers:
|
||||
r0:
|
||||
type: "[char; 33]"
|
||||
value: "\"\\u{0}\\u{1}\\u{2}\\u{3}\\u{4}\\u{5}\\u{6}\\u{7}\\u{8}\\t\\n\\u{b}\\u{c}\\r\\u{e}\\u{f}\\u{10}\\u{11}\\u{12}\\u{13}\\u{14}\\u{15}\\u{16}\\u{17}\\u{18}\\u{19}\\u{1a}\\u{1b}\\u{1c}\\u{1d}\\u{1e}\\u{1f}\\u{1f}\""
|
||||
value: "\"\\u{0}\\u{1}\\u{2}\\u{3}\\u{4}\\u{5}\\u{6}\\u{7}\\u{8}\\t\\n\\u{b}\\u{c}\\r\\u{e}\\u{f}\\u{10}\\u{11}\\u{12}\\u{13}\\u{14}\\u{15}\\u{16}\\u{17}\\u{18}\\u{19}\\u{1a}\\u{1b}\\u{1c}\\u{1d}\\u{1e}\\u{1f} \""
|
||||
r1:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: 495d681d55225a08bd4b653d8513e6d83ecbd3b6830a5afc57d1731c8102433e
|
||||
initial_ast: da8550065db88bba8f0a982612194f6122ec97025c4af5d3007d3a4d42519cb9
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: 495d681d55225a08bd4b653d8513e6d83ecbd3b6830a5afc57d1731c8102433e
|
||||
type_inferenced_ast: 26de2b1a581fe9c56558a75cae3625a82b7908cfc1dc51d7396c90c321596206
|
||||
canonicalized_ast: da8550065db88bba8f0a982612194f6122ec97025c4af5d3007d3a4d42519cb9
|
||||
type_inferenced_ast: b3ea99e7660209825c5bb1abcba8c1835cf96b79c8707e616513122ab10ac0d5
|
||||
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "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 | ^^^^^^^^^^"
|
||||
- "Error [EASG0373043]: 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 | ^^^^^^^^^^"
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EASG0373045]: a function input named \"a\" already exists in this scope\n --> compiler-test:3:23\n |\n 3 | function main(a: u32, a: u32) {\n | ^"
|
@ -16,7 +16,7 @@ outputs:
|
||||
r0:
|
||||
type: bool
|
||||
value: "true"
|
||||
initial_ast: 89007dc431d7d169622ce46ddafe848d423bc04a0158d9a5ab8ec91ef1fc91e7
|
||||
initial_ast: 6e689aa459b9ea2fa0c18c9dc0f2512db9d430f5c7101cb3104a275711d60210
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: 7384d651e9a2b61f48e0aa9143f801eabcb1c09dbe6b8292ecabaa96a3271a25
|
||||
type_inferenced_ast: 32218fcf1f943604e2e26e8a30a226fff5f0a735dd1d1ec93a561eb71043896c
|
||||
canonicalized_ast: 7e2eaf52ce5c79242b44357609ab667df411190bf7a11228d240c314f0ce0502
|
||||
type_inferenced_ast: be897b5b17a946c2595afcc8a802df5fa4e013ba3acb4159a0123d7cf1941544
|
||||
|
@ -18,5 +18,5 @@ outputs:
|
||||
value: "true"
|
||||
initial_ast: ae6826642faa492e34507695dbd11e5b44c319aecb0b1e78b29ce03ae446d907
|
||||
imports_resolved_ast: 4ca172d902f797a1d225223900fbf3f01a68c44ad5a0cf402e719f9e5961988b
|
||||
canonicalized_ast: 45d1e1fd08312c31a811bf5301757dc43c709291b9b894bf8dc9f9279ed74dc2
|
||||
type_inferenced_ast: 1a4b2a2dba0020bca514deb10fc833225199b6f216c903035cd3d53a810395d3
|
||||
canonicalized_ast: e08b138c63ede9de6e090e6b7fbcfbbc27a1ae49b032a6cffcafaa8f76410839
|
||||
type_inferenced_ast: b311680f4429cc16661f774b0547936be148a3dd9f478013adefe575629b88fa
|
||||
|
Loading…
Reference in New Issue
Block a user