fix scope shadowing, and importing global consts

This commit is contained in:
gluaxspeed 2021-09-06 03:53:02 -07:00
parent a1f3108512
commit cfb8720af7
54 changed files with 540 additions and 99 deletions

View File

@ -132,6 +132,11 @@ impl<'a> FromAst<'a, leo_ast::Identifier> for &'a Expression<'a> {
} else {
return Err(AsgError::illegal_input_variable_reference(&value.span).into());
}
} else if let Some(gc) = scope.resolve_global_const(&value.name) {
gc.variables
.iter()
.find(|&&v| v.borrow().name.name == value.name)
.unwrap()
} else {
match scope.resolve_variable(&value.name) {
Some(v) => v,

View File

@ -89,6 +89,14 @@ impl<'a> Function<'a> {
)
.into());
}
/* else if let Some(_) = scope.resolve_global_const(input_variable.identifier.name.as_ref()) {
// TODO ERROR FOR INPUT BEING NAMED AFTER GLOBAL CONST.
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(),
@ -141,9 +149,13 @@ 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());
} */
if self.scope.resolve_global_const(name).is_some() {
return Err(AsgError::function_input_cannot_shadow_global_const(
name,
&argument.get().borrow().name.span,
)
.into());
}
self.scope.variables.borrow_mut().insert(name.clone(), argument.get());
}

View File

@ -130,6 +130,27 @@ fn resolve_import_package_access(
}
}
fn check_top_level_namespaces<'a>(
name: &str,
span: &Span,
aliases: &IndexMap<String, &'a Alias<'a>>,
functions: &IndexMap<String, &'a Function<'a>>,
circuits: &IndexMap<String, &'a Circuit<'a>>,
global_consts: &IndexMap<String, &'a DefinitionStatement<'a>>,
) -> Result<()> {
if aliases.contains_key(name) {
Err(AsgError::duplicate_alias_definition(name, span).into())
} else if global_consts.contains_key(name) {
Err(AsgError::duplicate_global_const_definition(name, span).into())
} else if functions.contains_key(name) {
Err(AsgError::duplicate_function_definition(name, span).into())
} else if circuits.contains_key(name) {
Err(AsgError::duplicate_circuit_definition(name, span).into())
} else {
Ok(())
}
}
impl<'a> Program<'a> {
/// Returns a new Leo program ASG from the given Leo program AST and its imports.
///
@ -242,23 +263,6 @@ impl<'a> Program<'a> {
scope.aliases.borrow_mut().insert(name.name.to_string(), asg_alias);
}
for (names, global_const) in program.global_consts.iter() {
let gc = <&Statement<'a>>::from_ast(scope, global_const, None)?;
if let Statement::Definition(def) = gc {
let name = names
.iter()
.enumerate()
.map(|(i, name)| {
assert_eq!(name.name, def.variables.get(i).unwrap().borrow().name.name);
name.name.to_string()
})
.collect::<Vec<String>>()
.join(",");
scope.global_consts.borrow_mut().insert(name, def);
}
}
for (name, circuit) in program.circuits.iter() {
assert_eq!(name.name, circuit.circuit_name.name);
let asg_circuit = Circuit::init(scope, circuit)?;
@ -281,25 +285,28 @@ impl<'a> Program<'a> {
scope.functions.borrow_mut().insert(name.name.to_string(), function);
}
for (names, global_const) in program.global_consts.iter() {
let gc = <&Statement<'a>>::from_ast(scope, global_const, None)?;
if let Statement::Definition(def) = gc {
let name = names
.iter()
.enumerate()
.map(|(i, name)| {
assert_eq!(name.name, def.variables.get(i).unwrap().borrow().name.name);
name.name.to_string()
})
.collect::<Vec<String>>()
.join(",");
scope.global_consts.borrow_mut().insert(name, def);
}
}
// Load concrete definitions.
let mut aliases = IndexMap::new();
let mut global_consts = IndexMap::new();
let mut functions = IndexMap::new();
let mut circuits = IndexMap::new();
/* let check_global_shadowing = |name: String, span: &Span| -> Result<()> {
if aliases.contains_key(&name) {
return Err(AsgError::duplicate_alias_definition(name, span).into());
} else if global_consts.contains_key(&name) {
return Err(AsgError::duplicate_global_const_definition(name, span).into());
} else if functions.contains_key(&name) {
return Err(AsgError::duplicate_function_definition(name, span).into());
} else if circuits.contains_key(&name) {
return Err(AsgError::duplicate_circuit_definition(name, span).into());
} else {
Ok(())
}
}; */
let mut global_consts = IndexMap::new();
for (name, alias) in program.aliases.iter() {
assert_eq!(name.name, alias.name.name);
@ -307,28 +314,11 @@ impl<'a> Program<'a> {
let name = name.name.to_string();
if aliases.contains_key(&name) {
return Err(AsgError::duplicate_alias_definition(name, &alias.span).into());
}
check_top_level_namespaces(&name, &alias.span, &aliases, &functions, &circuits, &global_consts)?;
aliases.insert(name, asg_alias);
}
for (names, global_const) in program.global_consts.iter() {
for (identifier, variable) in names.iter().zip(global_const.variable_names.iter()) {
assert_eq!(identifier.name, variable.identifier.name);
let name = identifier.name.to_string();
let asg_global_const = *scope.global_consts.borrow().get(&name).unwrap();
if global_consts.contains_key(&name) {
return Err(AsgError::duplicate_global_const_definition(name, &global_const.span).into());
}
global_consts.insert(name.clone(), asg_global_const);
}
}
for (name, function) in program.functions.iter() {
assert_eq!(name.name, function.identifier.name);
let asg_function = *scope.functions.borrow().get(name.name.as_ref()).unwrap();
@ -337,9 +327,7 @@ impl<'a> Program<'a> {
let name = name.name.to_string();
if functions.contains_key(&name) {
return Err(AsgError::duplicate_function_definition(name, &function.span).into());
}
check_top_level_namespaces(&name, &function.span, &aliases, &functions, &circuits, &global_consts)?;
functions.insert(name, asg_function);
}
@ -350,7 +338,39 @@ impl<'a> Program<'a> {
asg_circuit.fill_from_ast(circuit)?;
circuits.insert(name.name.to_string(), asg_circuit);
let name = name.name.to_string();
check_top_level_namespaces(
&name,
&circuit.circuit_name.span,
&aliases,
&functions,
&circuits,
&global_consts,
)?;
circuits.insert(name, asg_circuit);
}
for (names, global_const) in program.global_consts.iter() {
let name = names
.iter()
.map(|name| name.name.to_string())
.collect::<Vec<String>>()
.join(",");
let asg_global_const = *scope.global_consts.borrow().get(&name).unwrap();
check_top_level_namespaces(
&name,
&global_const.span,
&aliases,
&functions,
&circuits,
&global_consts,
)?;
global_consts.insert(name.clone(), asg_global_const);
}
Ok(Program {

View File

@ -151,6 +151,22 @@ impl<'a> Scope<'a> {
}
}
///
/// Returns a reference to the global const definition statement corresponding to the name.
///
/// If the current scope did not have this name present, then the parent scope is checked.
/// If there is no parent scope, then `None` is returned.
///
pub fn resolve_global_const(&self, name: &str) -> Option<&'a DefinitionStatement<'a>> {
if let Some(resolved) = self.global_consts.borrow().get(name) {
Some(*resolved)
} else if let Some(resolved) = self.parent_scope.get() {
resolved.resolve_global_const(name)
} else {
None
}
}
///
/// Returns a new scope given a parent scope.
///

View File

@ -110,10 +110,18 @@ 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());
} */
let name = variable.identifier.name.as_ref();
if scope.resolve_global_const(name).is_some() {
return Err(
AsgError::function_variable_cannot_shadow_global_const(name, &variable.identifier.span).into(),
);
} else if scope.resolve_variable(name).is_some() {
return Err(AsgError::function_variable_cannot_shadow_other_function_variable(
name,
&variable.identifier.span,
)
.into());
}
variables.push(&*scope.context.alloc_variable(RefCell::new(InnerVariable {
id: scope.context.get_id(),

View File

@ -0,0 +1,57 @@
// 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::{DefinitionStatement, Identifier};
use indexmap::IndexMap;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[allow(clippy::ptr_arg)]
pub fn serialize<S: Serializer>(
global_consts: &IndexMap<Vec<Identifier>, DefinitionStatement>,
serializer: S,
) -> Result<S::Ok, S::Error> {
let joined: IndexMap<String, DefinitionStatement> = global_consts
.into_iter()
.map(|(idents, program)| {
(
idents.iter().map(|i| i.name.to_string()).collect::<Vec<_>>().join(","),
program.clone(),
)
})
.collect();
joined.serialize(serializer)
}
pub fn deserialize<'de, D: Deserializer<'de>>(
deserializer: D,
) -> Result<IndexMap<Vec<Identifier>, DefinitionStatement>, D::Error> {
Ok(IndexMap::<String, DefinitionStatement>::deserialize(deserializer)?
.into_iter()
.map(|(name, program)| {
(
name.split(',')
.map(|ident_name| Identifier {
name: ident_name.into(),
span: Default::default(),
})
.collect::<Vec<Identifier>>(),
program,
)
})
.collect())
}

View File

@ -20,6 +20,8 @@ pub use array_dimensions::*;
pub mod const_self_keyword;
pub use const_self_keyword::*;
pub mod global_consts_json;
pub mod identifier;
pub use identifier::*;

View File

@ -33,6 +33,7 @@ pub struct Program {
pub imports: IndexMap<Vec<String>, Program>,
pub aliases: IndexMap<Identifier, Alias>,
pub circuits: IndexMap<Identifier, Circuit>,
#[serde(with = "crate::common::global_consts_json")]
pub global_consts: IndexMap<Vec<Identifier>, DefinitionStatement>,
pub functions: IndexMap<Identifier, Function>,
}

View File

@ -444,11 +444,27 @@ create_errors!(
help: None,
}
/// For when a named identifier is being shadowed.
/// For when a function input shadows a global const.
@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),
function_input_cannot_shadow_global_const {
args: (name: impl Display),
msg: format!("a function input cannot be named `{}` as a global const with that name already exists in this scope", name),
help: None,
}
/// For when a variable definition shadows a global const.
@formatted
function_variable_cannot_shadow_global_const {
args: (name: impl Display),
msg: format!("a variable cannot be named `{}` as a global const with that name already exists in this scope", name),
help: None,
}
/// For when a variable definition shadows a function input.
@formatted
function_variable_cannot_shadow_other_function_variable {
args: (name: impl Display),
msg: format!("a variable cannot be named `{}` as a function input or variable with that name already exists in this scope", name),
help: None,
}
);

View File

@ -0,0 +1,17 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
type Int = u32;
circuit Int {
x: u8;
}
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
type int = u32;
function int() {}
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
type int = u32;
const int = 8u8;
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,16 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
circuit Int {
x: u8;
}
type Int = u32;
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,16 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
circuit Foo {
x: u8;
}
function Foo() {}
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,16 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
circuit Foo {
x: u8;
}
const Foo = 8u8;
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
function int() {}
type int = u32;
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,16 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
function Foo() {}
circuit Foo {
x: u8;
}
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
function foo() {}
const foo = 8u8;
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,13 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
const hi = 1u32;
function tester(hi: u8) {}
function main (y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,13 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
function tester(hi: u8) {
const hi = 1u8;
}
function main (y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,13 @@
/*
namespace: Compile
expectation: Fail
input_file: input/dummy.in
*/
function tester(hi: u8) {
const hi = 2u8;
}
function main (y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
const int = 8u8;
type int = u32;
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,16 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
const Foo = 8u8;
circuit Foo {
x: u8;
}
function main(y: bool) -> bool {
return y;
}

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
input_file:
- inputs/dummy.in
*/
const two = 2u8;
function two() {}
function main(y: bool) -> bool {
return y;
}

View File

@ -19,7 +19,7 @@ const complex_group = (_, 1)group;
const field_test: field = 2;
const use_another_const = basic + 1;
const foo = Foo { width: 10, height: 20 };
const uno = uno();
const one = uno();
const character = 'a';
const hello = "Hello, World!";
@ -49,7 +49,7 @@ function main(a: u32) -> bool {
&& use_another_const == 9u32 // use another const test
&& foo.width == 10u32 // circuit test
&& foo.height == 20u32
&& uno == 1u32 // function test
&& one == 1u32 // function test
&& character == 'a' // char test
&& hello == "Hello, World!";
}

View File

@ -0,0 +1,6 @@
[main]
y: bool = true;
x: bool = false;
[registers]
r0: bool = true;

View File

@ -11,6 +11,7 @@ function main(y: bool) -> bool {
const a = Point { x: 1u32, y: 0u32 };
const hello_alias: char5 = "hello";
const hello = "hello";
const eight = 8u8;
return( (foo() == 1u32) && hello_alias == hello) == y;
return( (foo() == 1u32) && hello_alias == hello && EIGHT == eight) == y;
}

View File

@ -8,3 +8,5 @@ function foo() -> u32 {
}
type char5 = [char; 5];
const EIGHT = 8u8;

View File

@ -5,7 +5,7 @@ input_file: inputs/true_true.in
*/
function main(a: (bool, bool)) -> (bool, bool) {
const a = (true, false);
const b = (true, false);
return (a.0, a.1);
return (b.0, b.1);
}

View File

@ -5,7 +5,7 @@ input_file: inputs/true_true.in
*/
function main(a: (bool, bool)) -> (bool, bool) {
let a = (a.0 ? false : true, a.1 ? false : true);
let b = (a.0 ? false : true, a.1 ? false : true);
return (a.0, a.1);
return (b.0, b.1);
}

View File

@ -5,7 +5,7 @@ input_file: inputs/true_true.in
*/
function main(a: (bool, bool)) -> (bool, bool) {
let (a, b) = (a.0 ? false : true, a.1 ? false : true);
let (b, c) = (a.0 ? false : true, a.1 ? false : true);
return (b, a);
return (c, b);
}

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373044]: a alias named \"Int\" already exists in this scope\n --> compiler-test:6:9\n |\n 6 | circuit Int {\n | ^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373044]: a alias named \"int\" already exists in this scope\n --> compiler-test:5:1\n |\n 5 | function int() {}\n | ^^^^^^^^^^^^^^^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373044]: a alias named \"int\" already exists in this scope\n --> compiler-test:5:1\n |\n 5 | const int = 8u8;\n | ^^^^^^^^^^^^^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373044]: a alias named \"Int\" already exists in this scope\n --> compiler-test:3:9\n |\n 3 | circuit Int {\n | ^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373015]: a function named \"Foo\" already exists in this scope\n --> compiler-test:3:9\n |\n 3 | circuit Foo {\n | ^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373045]: a circuit named \"Foo\" already exists in this scope\n --> compiler-test:7:1\n |\n 7 | const Foo = 8u8;\n | ^^^^^^^^^^^^^^^"

View File

@ -2,4 +2,4 @@
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 | ^"
- "Error [EASG0373046]: 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 | ^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373044]: a alias named \"int\" already exists in this scope\n --> compiler-test:3:1\n |\n 3 | function int() {}\n | ^^^^^^^^^^^^^^^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373015]: a function named \"Foo\" already exists in this scope\n --> compiler-test:5:9\n |\n 5 | circuit Foo {\n | ^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373015]: a function named \"foo\" already exists in this scope\n --> compiler-test:5:1\n |\n 5 | const foo = 8u8;\n | ^^^^^^^^^^^^^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373048]: a function input cannot be named `hi` as a global const with that name already exists in this scope\n --> compiler-test:5:17\n |\n 5 | function tester(hi: u8) {}\n | ^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373050]: a variable cannot be named `hi` as a function input or variable with that name already exists in this scope\n --> compiler-test:4:11\n |\n 4 | const hi = 1u8;\n | ^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373050]: a variable cannot be named `hi` as a function input or variable with that name already exists in this scope\n --> compiler-test:4:11\n |\n 4 | const hi = 2u8;\n | ^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373044]: a alias named \"int\" already exists in this scope\n --> compiler-test:3:1\n |\n 3 | const int = 8u8;\n | ^^^^^^^^^^^^^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373045]: a circuit named \"Foo\" already exists in this scope\n --> compiler-test:3:1\n |\n 3 | const Foo = 8u8;\n | ^^^^^^^^^^^^^^^"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373015]: a function named \"two\" already exists in this scope\n --> compiler-test:3:1\n |\n 3 | const two = 2u8;\n | ^^^^^^^^^^^^^^^"

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "false"
initial_ast: b4e5073c07791c4726b69f3e60ec66ccebefb7a3811f4a3576fc4042f8c80114
imports_resolved_ast: b4e5073c07791c4726b69f3e60ec66ccebefb7a3811f4a3576fc4042f8c80114
canonicalized_ast: 03a4e0ffc6deea9c6500a9d91eb683a780e8f5961801bea1aab26c14e4543325
type_inferenced_ast: 66d0a55ff2ab6931d5806dcbb2ff23f9dbc41a883f19a45af8a41d3be84e136d
initial_ast: d53a0267c4afe271c6488aeda9910433e3a947d96530ea1286eba511e6e8f17e
imports_resolved_ast: d53a0267c4afe271c6488aeda9910433e3a947d96530ea1286eba511e6e8f17e
canonicalized_ast: 86bc6722c866a18e2b4d022e67c82dfa0f20f1b4d86d2869f6267010ef45c0c6
type_inferenced_ast: 57202f3b3a4808ce13cce466b6e7a6b153c1950e6af6fcbe68bf04a4d95476f1

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 6e689aa459b9ea2fa0c18c9dc0f2512db9d430f5c7101cb3104a275711d60210
imports_resolved_ast: c4260b58a631ee77b0492ba1354182b2c95d260dcf01a62e2a0797eb5f268478
canonicalized_ast: 7e2eaf52ce5c79242b44357609ab667df411190bf7a11228d240c314f0ce0502
type_inferenced_ast: be897b5b17a946c2595afcc8a802df5fa4e013ba3acb4159a0123d7cf1941544
initial_ast: d2d8f4a8a59423b81f6f31d335762b57cf771ade0241acc6d61614d1fabfc618
imports_resolved_ast: 95c9a6a9d333cdaff558735babd0d9a200d29fe752cb3a80288a69abecdc872d
canonicalized_ast: a2ef4029e1d95374b6b7f6b9e601acb6e4ee7481f7387fd0724149c548e46399
type_inferenced_ast: b7d5149d5beae517ba02c0af1a23183ec28e3f763252be89baed9ba96a3e2786

View File

@ -17,6 +17,6 @@ outputs:
type: bool
value: "true"
initial_ast: ae6826642faa492e34507695dbd11e5b44c319aecb0b1e78b29ce03ae446d907
imports_resolved_ast: e08b138c63ede9de6e090e6b7fbcfbbc27a1ae49b032a6cffcafaa8f76410839
canonicalized_ast: e08b138c63ede9de6e090e6b7fbcfbbc27a1ae49b032a6cffcafaa8f76410839
type_inferenced_ast: b311680f4429cc16661f774b0547936be148a3dd9f478013adefe575629b88fa
imports_resolved_ast: 718ca8903a55a3b9208aea6c80d8969a5413a0499266c887b68dfea620f689e9
canonicalized_ast: 718ca8903a55a3b9208aea6c80d8969a5413a0499266c887b68dfea620f689e9
type_inferenced_ast: 9470aa103176806fd2d40b69224ec249e086fd5c70d56ebe22922e6cf39156e5

View File

@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373016]: a variable named \"x\" already exists in this scope\n --> compiler-test:5:3\n |\n 5 | let x = true;\n | ^^^^^^^^^^^^"
- "Error [EASG0373050]: a variable cannot be named `x` as a function input or variable with that name already exists in this scope\n --> compiler-test:5:7\n |\n 5 | let x = true;\n | ^"

View File

@ -19,7 +19,7 @@ outputs:
c:
type: bool
value: "false"
initial_ast: 51cc6c9ff08fa4320783cf8b6683f784a6325a0e371c7d93049c30eb9d04cf72
imports_resolved_ast: 51cc6c9ff08fa4320783cf8b6683f784a6325a0e371c7d93049c30eb9d04cf72
canonicalized_ast: 51cc6c9ff08fa4320783cf8b6683f784a6325a0e371c7d93049c30eb9d04cf72
type_inferenced_ast: a1e55a4a926b0d9c8d0f611136c7f9ba8ed5c6156a85d1d04adc9faaadf1a611
initial_ast: 10550feaa2c5235500abf424e222f1f8383225ae3b6906c1cd76835e83286817
imports_resolved_ast: 10550feaa2c5235500abf424e222f1f8383225ae3b6906c1cd76835e83286817
canonicalized_ast: 10550feaa2c5235500abf424e222f1f8383225ae3b6906c1cd76835e83286817
type_inferenced_ast: db07b90097bb2605e23365d07d039b7845e9c7e7313a7ecaa01116dae93912ad

View File

@ -19,7 +19,7 @@ outputs:
c:
type: bool
value: "false"
initial_ast: 6692e9d94d784dd3cd11dbf48ac13b0b54f61d83ba0d85bf038e9bf84590851f
imports_resolved_ast: 6692e9d94d784dd3cd11dbf48ac13b0b54f61d83ba0d85bf038e9bf84590851f
canonicalized_ast: 6692e9d94d784dd3cd11dbf48ac13b0b54f61d83ba0d85bf038e9bf84590851f
type_inferenced_ast: 0d8c2b2b77762cfb957d5d6247366317b8fbe4ac7cb985df1b4d3511accf13b8
initial_ast: be3a0206397e9b0f95c696b4d7174ee81262e805fc787b3516b1b1a277892a4d
imports_resolved_ast: be3a0206397e9b0f95c696b4d7174ee81262e805fc787b3516b1b1a277892a4d
canonicalized_ast: be3a0206397e9b0f95c696b4d7174ee81262e805fc787b3516b1b1a277892a4d
type_inferenced_ast: 672df08a8f52ff75d5cdba1f4ebc070baba70a981351819d2205b3e8de76bfc7

View File

@ -19,7 +19,7 @@ outputs:
c:
type: bool
value: "true"
initial_ast: 531df9191a6ee867da7a9c5aa5120a9ab93eec5d4d29bdc78aa965fce0f52c8d
imports_resolved_ast: 531df9191a6ee867da7a9c5aa5120a9ab93eec5d4d29bdc78aa965fce0f52c8d
canonicalized_ast: 531df9191a6ee867da7a9c5aa5120a9ab93eec5d4d29bdc78aa965fce0f52c8d
type_inferenced_ast: b841d6651b93193e0bbd24df8b667bd16066ee77481dd3b8b0187c37968ca1c1
initial_ast: ea7f6cc8c9fe0deda02c3fde1f33dd71c33b6938c832af0f220fb681f56f9354
imports_resolved_ast: ea7f6cc8c9fe0deda02c3fde1f33dd71c33b6938c832af0f220fb681f56f9354
canonicalized_ast: ea7f6cc8c9fe0deda02c3fde1f33dd71c33b6938c832af0f220fb681f56f9354
type_inferenced_ast: 72d9dedc48ac69de544b2f35b1f0e675f4053f562fc708b30eebcfdc6ac59dc9