diff --git a/asg/src/import.rs b/asg/src/import.rs deleted file mode 100644 index 3e95ce1e22..0000000000 --- a/asg/src/import.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -//! Helper methods for resolving imported packages. - -use std::marker::PhantomData; - -use crate::{AsgContext, Program}; -use leo_errors::{Result, Span}; - -use indexmap::IndexMap; - -pub trait ImportResolver<'a> { - fn resolve_package( - &mut self, - context: AsgContext<'a>, - package_segments: &[&str], - span: &Span, - ) -> Result>>; -} - -pub struct NullImportResolver; - -impl<'a> ImportResolver<'a> for NullImportResolver { - fn resolve_package( - &mut self, - _context: AsgContext<'a>, - _package_segments: &[&str], - _span: &Span, - ) -> Result>> { - Ok(None) - } -} - -pub struct CoreImportResolver<'a, 'b, T: ImportResolver<'b>> { - inner: &'a mut T, - lifetime: PhantomData<&'b ()>, -} - -impl<'a, 'b, T: ImportResolver<'b>> CoreImportResolver<'a, 'b, T> { - pub fn new(inner: &'a mut T) -> Self { - CoreImportResolver { - inner, - lifetime: PhantomData, - } - } -} - -impl<'a, 'b, T: ImportResolver<'b>> ImportResolver<'b> for CoreImportResolver<'a, 'b, T> { - fn resolve_package( - &mut self, - context: AsgContext<'b>, - package_segments: &[&str], - span: &Span, - ) -> Result>> { - if !package_segments.is_empty() && package_segments.get(0).unwrap() == &"core" { - Ok(crate::resolve_core_module(context, &*package_segments[1..].join("."))?) - } else { - self.inner.resolve_package(context, package_segments, span) - } - } -} - -pub struct MockedImportResolver<'a> { - pub packages: IndexMap>, -} - -impl<'a> ImportResolver<'a> for MockedImportResolver<'a> { - fn resolve_package( - &mut self, - _context: AsgContext<'a>, - package_segments: &[&str], - _span: &Span, - ) -> Result>> { - Ok(self.packages.get(&package_segments.join(".")).cloned()) - } -} diff --git a/asg/src/lib.rs b/asg/src/lib.rs index aa6cd0f8fa..ee6692dc74 100644 --- a/asg/src/lib.rs +++ b/asg/src/lib.rs @@ -35,9 +35,6 @@ pub use const_value::*; pub mod expression; pub use expression::*; -pub mod import; -pub use import::*; - mod input; pub use input::*; @@ -118,7 +115,7 @@ impl<'a> Asg<'a> { } // TODO (howardwu): Remove this. -pub fn load_asg<'a, T: ImportResolver<'a>>( +/* pub fn load_asg<'a, T: ImportResolver<'a>>( context: AsgContext<'a>, content: &str, resolver: &mut T, @@ -127,7 +124,7 @@ pub fn load_asg<'a, T: ImportResolver<'a>>( let ast = leo_parser::parse_ast("input.leo", content)?; Program::new(context, ast.as_repr()) -} +} */ pub fn new_alloc_context<'a>() -> Arena> { Arena::new() diff --git a/asg/src/prelude.rs b/asg/src/prelude.rs index 42d17a955c..1f5d2af316 100644 --- a/asg/src/prelude.rs +++ b/asg/src/prelude.rs @@ -16,13 +16,13 @@ // TODO (protryon): We should merge this with core -use crate::{AsgContext, Program}; -use leo_errors::Result; +// use crate::{AsgContext, Program}; +// use leo_errors::Result; // TODO (protryon): Make asg deep copy so we can cache resolved core modules // TODO (protryon): Figure out how to do headers without bogus returns -pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result>> { +/* pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result>> { match module { "unstable.blake2s" => { let asg = crate::load_asg( @@ -42,3 +42,4 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result< _ => Ok(None), } } + */ diff --git a/asg/src/program/mod.rs b/asg/src/program/mod.rs index a0057bdf7a..1993d686d0 100644 --- a/asg/src/program/mod.rs +++ b/asg/src/program/mod.rs @@ -68,20 +68,10 @@ impl<'a> Program<'a> { /// 4. resolve all asg nodes /// pub fn new(context: AsgContext<'a>, program: &leo_ast::Program) -> Result> { - let mut imported_functions: IndexMap> = IndexMap::new(); - let mut imported_circuits: IndexMap> = IndexMap::new(); - let mut imported_global_consts: IndexMap> = IndexMap::new(); let mut imported_modules: IndexMap = IndexMap::new(); for (name, program) in program.imports.iter() { - let program = Program::new(context, program)?; - - // TODO only take the ones specified. - imported_functions.extend(program.functions.clone()); - imported_circuits.extend(program.circuits.clone()); - imported_global_consts.extend(program.global_consts.clone()); - - imported_modules.insert(name.clone(), program); + imported_modules.insert(name.clone(), Program::new(context, program)?); } let import_scope = match context.arena.alloc(ArenaNode::Scope(Box::new(Scope { @@ -89,9 +79,9 @@ impl<'a> Program<'a> { id: context.get_id(), parent_scope: Cell::new(None), variables: RefCell::new(IndexMap::new()), - functions: RefCell::new(imported_functions), - global_consts: RefCell::new(imported_global_consts), - circuits: RefCell::new(imported_circuits), + functions: RefCell::new(IndexMap::new()), + global_consts: RefCell::new(IndexMap::new()), + circuits: RefCell::new(IndexMap::new()), function: Cell::new(None), input: Cell::new(None), }))) { @@ -113,25 +103,22 @@ impl<'a> Program<'a> { // Prepare header-like scope entries. for (name, circuit) in program.circuits.iter() { - assert_eq!(name.name, circuit.circuit_name.name); let asg_circuit = Circuit::init(scope, circuit)?; - scope.circuits.borrow_mut().insert(name.name.to_string(), asg_circuit); + scope.circuits.borrow_mut().insert(name.clone(), asg_circuit); } // Second pass for circuit members. for (name, circuit) in program.circuits.iter() { - assert_eq!(name.name, circuit.circuit_name.name); let asg_circuit = Circuit::init_member(scope, circuit)?; - scope.circuits.borrow_mut().insert(name.name.to_string(), asg_circuit); + scope.circuits.borrow_mut().insert(name.clone(), asg_circuit); } for (name, function) in program.functions.iter() { - assert_eq!(name.name, function.identifier.name); let function = Function::init(scope, function)?; - scope.functions.borrow_mut().insert(name.name.to_string(), function); + scope.functions.borrow_mut().insert(name.clone(), function); } for (name, global_const) in program.global_consts.iter() { @@ -159,12 +146,11 @@ impl<'a> Program<'a> { let mut functions = IndexMap::new(); 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(); + let asg_function = *scope.functions.borrow().get(name).unwrap(); asg_function.fill_from_ast(function)?; - let name = name.name.to_string(); + let name = name.clone(); if functions.contains_key(&name) { return Err(AsgError::duplicate_function_definition(name, &function.span).into()); @@ -175,12 +161,11 @@ impl<'a> Program<'a> { let mut circuits = IndexMap::new(); for (name, circuit) in program.circuits.iter() { - assert_eq!(name.name, circuit.circuit_name.name); - let asg_circuit = *scope.circuits.borrow().get(name.name.as_ref()).unwrap(); + let asg_circuit = *scope.circuits.borrow().get(name).unwrap(); asg_circuit.fill_from_ast(circuit)?; - circuits.insert(name.name.to_string(), asg_circuit); + circuits.insert(name.clone(), asg_circuit); } Ok(Program { @@ -195,9 +180,9 @@ impl<'a> Program<'a> { }) } - pub(crate) fn set_core_mapping(&self, mapping: &str) { + /* pub(crate) fn set_core_mapping(&self, mapping: &str) { for (_, circuit) in self.circuits.iter() { circuit.core_mapping.replace(Some(mapping.to_string())); } - } + } */ } diff --git a/asg/tests/fail/import/mod.rs b/asg/tests/fail/import/mod.rs deleted file mode 100644 index ff53f73aae..0000000000 --- a/asg/tests/fail/import/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . diff --git a/asg/tests/fail/mod.rs b/asg/tests/fail/mod.rs index 9807db3177..102b00b7dc 100644 --- a/asg/tests/fail/mod.rs +++ b/asg/tests/fail/mod.rs @@ -24,7 +24,6 @@ pub mod definition; pub mod field; pub mod function; // pub mod group; // we dont do context-specific type checking for groups -pub mod import; pub mod integers; pub mod mutability; pub mod statements; diff --git a/asg/tests/mod.rs b/asg/tests/mod.rs index 018b68b19d..667cab9983 100644 --- a/asg/tests/mod.rs +++ b/asg/tests/mod.rs @@ -24,22 +24,13 @@ mod pass; const TESTING_FILEPATH: &str = "input.leo"; fn load_asg(program_string: &str) -> Result, LeoError> { - load_asg_imports(make_test_context(), program_string, &mut NullImportResolver) + load_asg_imports(make_test_context(), program_string) } -fn load_asg_imports<'a, T: ImportResolver<'a>>( - context: AsgContext<'a>, - program_string: &str, - imports: &mut T, -) -> Result, LeoError> { +fn load_asg_imports<'a>(context: AsgContext<'a>, program_string: &str) -> Result, LeoError> { let mut ast = parse_ast(&TESTING_FILEPATH, program_string)?; ast.canonicalize()?; - Program::new(context, &ast.as_repr(), imports) -} - -fn mocked_resolver(_context: AsgContext<'_>) -> MockedImportResolver<'_> { - let packages = indexmap::IndexMap::new(); - MockedImportResolver { packages } + Program::new(context, &ast.as_repr()) } //convenience function for tests, leaks memory diff --git a/asg/tests/pass/import/alias.leo b/asg/tests/pass/import/alias.leo deleted file mode 100644 index f153b5a128..0000000000 --- a/asg/tests/pass/import/alias.leo +++ /dev/null @@ -1,5 +0,0 @@ -import test-import.foo as bar; - -function main() { - console.assert(bar() == 1u32); -} \ No newline at end of file diff --git a/asg/tests/pass/import/basic.leo b/asg/tests/pass/import/basic.leo deleted file mode 100644 index 53d243efaa..0000000000 --- a/asg/tests/pass/import/basic.leo +++ /dev/null @@ -1,5 +0,0 @@ -import test-import.foo; - -function main() { - console.assert(foo() == 1u32); -} \ No newline at end of file diff --git a/asg/tests/pass/import/imports/bar/.gitignore b/asg/tests/pass/import/imports/bar/.gitignore deleted file mode 100755 index ea1472ec1f..0000000000 --- a/asg/tests/pass/import/imports/bar/.gitignore +++ /dev/null @@ -1 +0,0 @@ -output/ diff --git a/asg/tests/pass/import/imports/bar/Leo.toml b/asg/tests/pass/import/imports/bar/Leo.toml deleted file mode 100755 index 8e22d51a95..0000000000 --- a/asg/tests/pass/import/imports/bar/Leo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[package] -name = "bar" -version = "0.1.0" diff --git a/asg/tests/pass/import/imports/bar/src/bat/bat.leo b/asg/tests/pass/import/imports/bar/src/bat/bat.leo deleted file mode 100755 index f76edfe54e..0000000000 --- a/asg/tests/pass/import/imports/bar/src/bat/bat.leo +++ /dev/null @@ -1,3 +0,0 @@ -circuit Bat { - t: u32; -} \ No newline at end of file diff --git a/asg/tests/pass/import/imports/bar/src/baz.leo b/asg/tests/pass/import/imports/bar/src/baz.leo deleted file mode 100755 index 74fa3f281f..0000000000 --- a/asg/tests/pass/import/imports/bar/src/baz.leo +++ /dev/null @@ -1,7 +0,0 @@ -circuit Baz { - z: u32; -} - -circuit Bazzar { - a: u32; -} \ No newline at end of file diff --git a/asg/tests/pass/import/imports/bar/src/lib.leo b/asg/tests/pass/import/imports/bar/src/lib.leo deleted file mode 100755 index 845b6e5fd3..0000000000 --- a/asg/tests/pass/import/imports/bar/src/lib.leo +++ /dev/null @@ -1,3 +0,0 @@ -circuit Bar { - r: u32; -} \ No newline at end of file diff --git a/asg/tests/pass/import/imports/car/.gitignore b/asg/tests/pass/import/imports/car/.gitignore deleted file mode 100755 index ea1472ec1f..0000000000 --- a/asg/tests/pass/import/imports/car/.gitignore +++ /dev/null @@ -1 +0,0 @@ -output/ diff --git a/asg/tests/pass/import/imports/car/Leo.toml b/asg/tests/pass/import/imports/car/Leo.toml deleted file mode 100755 index 15b76f1d76..0000000000 --- a/asg/tests/pass/import/imports/car/Leo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[package] -name = "car" -version = "0.1.0" diff --git a/asg/tests/pass/import/imports/car/src/lib.leo b/asg/tests/pass/import/imports/car/src/lib.leo deleted file mode 100755 index 58a10e4067..0000000000 --- a/asg/tests/pass/import/imports/car/src/lib.leo +++ /dev/null @@ -1,3 +0,0 @@ -circuit Car { - c: u32; -} \ No newline at end of file diff --git a/asg/tests/pass/import/many_import.leo b/asg/tests/pass/import/many_import.leo deleted file mode 100644 index 08ae494c4f..0000000000 --- a/asg/tests/pass/import/many_import.leo +++ /dev/null @@ -1,26 +0,0 @@ -import test-import.( // local import - Point, - foo, -); - -import bar.( // imports directory import - Bar, - baz.(Baz, Bazzar), - bat.bat.Bat, -); - -import car.Car; // imports directory import - -function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); - - const bar = Bar { r: 1u32 }; - const baz = Baz { z: 1u32 }; - const bazzar = Bazzar { a: 1u32 }; - const bat = Bat { t: 1u32 }; - - const car = Car { c: 1u32 }; - - console.assert(car.c == 1u32); -} \ No newline at end of file diff --git a/asg/tests/pass/import/many_import_star.leo b/asg/tests/pass/import/many_import_star.leo deleted file mode 100644 index 575487a929..0000000000 --- a/asg/tests/pass/import/many_import_star.leo +++ /dev/null @@ -1,19 +0,0 @@ -import test-import.*; // local import - -import bar.*; // imports directory import -import bar.baz.*; // imports directory import -import bar.bat.bat.*; // imports directory import -import car.*; // imports directory import - -function main() { - const point = Point { x: 1u32, y: 1u32 }; - const foo = foo(); - - const bar = Bar { r: 1u32 }; - const bat = Bat { t: 1u32 }; - const baz = Baz { z: 1u32 }; - - const car = Car { c: 1u32 }; - - console.assert(car.c == 1u32); -} \ No newline at end of file diff --git a/asg/tests/pass/import/mod.rs b/asg/tests/pass/import/mod.rs deleted file mode 100644 index 870e4fe9ee..0000000000 --- a/asg/tests/pass/import/mod.rs +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (C) 2019-2021 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{load_asg, load_asg_imports, make_test_context, mocked_resolver}; - -#[test] -fn test_basic() { - let context = make_test_context(); - let mut imports = mocked_resolver(&context); - imports.packages.insert( - "test-import".to_string(), - load_asg(include_str!("src/test-import.leo")).unwrap(), - ); - let program_string = include_str!("basic.leo"); - load_asg_imports(&context, program_string, &mut imports).unwrap(); -} - -#[test] -fn test_multiple() { - let context = make_test_context(); - let mut imports = mocked_resolver(&context); - imports.packages.insert( - "test-import".to_string(), - load_asg(include_str!("src/test-import.leo")).unwrap(), - ); - let program_string = include_str!("multiple.leo"); - load_asg_imports(&context, program_string, &mut imports).unwrap(); -} - -#[test] -fn test_star() { - let context = make_test_context(); - let mut imports = mocked_resolver(&context); - imports.packages.insert( - "test-import".to_string(), - load_asg(include_str!("src/test-import.leo")).unwrap(), - ); - - let program_string = include_str!("star.leo"); - load_asg_imports(&context, program_string, &mut imports).unwrap(); -} - -#[test] -fn test_alias() { - let context = make_test_context(); - let mut imports = mocked_resolver(&context); - imports.packages.insert( - "test-import".to_string(), - load_asg(include_str!("src/test-import.leo")).unwrap(), - ); - - let program_string = include_str!("alias.leo"); - load_asg_imports(&context, program_string, &mut imports).unwrap(); -} - -// naming tests -#[test] -fn test_name() { - let context = make_test_context(); - let mut imports = mocked_resolver(&context); - imports.packages.insert( - "hello-world".to_string(), - load_asg(include_str!("src/hello-world.leo")).unwrap(), - ); - imports - .packages - .insert("a0-f".to_string(), load_asg(include_str!("src/a0-f.leo")).unwrap()); - imports - .packages - .insert("a-9".to_string(), load_asg(include_str!("src/a-9.leo")).unwrap()); - - let program_string = include_str!("names.leo"); - load_asg_imports(&context, program_string, &mut imports).unwrap(); -} - -// more complex tests -#[test] -fn test_many_import() { - let context = make_test_context(); - let mut imports = mocked_resolver(&context); - imports.packages.insert( - "test-import".to_string(), - load_asg(include_str!("src/test-import.leo")).unwrap(), - ); - imports.packages.insert( - "bar".to_string(), - load_asg(include_str!("imports/bar/src/lib.leo")).unwrap(), - ); - imports.packages.insert( - "bar.baz".to_string(), - load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(), - ); - imports.packages.insert( - "bar.baz".to_string(), - load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(), - ); - imports.packages.insert( - "bar.bat.bat".to_string(), - load_asg(include_str!("imports/bar/src/bat/bat.leo")).unwrap(), - ); - imports.packages.insert( - "car".to_string(), - load_asg(include_str!("imports/car/src/lib.leo")).unwrap(), - ); - - let program_string = include_str!("many_import.leo"); - load_asg_imports(&context, program_string, &mut imports).unwrap(); -} - -#[test] -fn test_many_import_star() { - let context = make_test_context(); - let mut imports = mocked_resolver(&context); - imports.packages.insert( - "test-import".to_string(), - load_asg(include_str!("src/test-import.leo")).unwrap(), - ); - imports.packages.insert( - "bar".to_string(), - load_asg(include_str!("imports/bar/src/lib.leo")).unwrap(), - ); - imports.packages.insert( - "bar.baz".to_string(), - load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(), - ); - imports.packages.insert( - "bar.baz".to_string(), - load_asg(include_str!("imports/bar/src/baz.leo")).unwrap(), - ); - imports.packages.insert( - "bar.bat.bat".to_string(), - load_asg(include_str!("imports/bar/src/bat/bat.leo")).unwrap(), - ); - imports.packages.insert( - "car".to_string(), - load_asg(include_str!("imports/car/src/lib.leo")).unwrap(), - ); - - let program_string = include_str!("many_import_star.leo"); - load_asg_imports(&context, program_string, &mut imports).unwrap(); -} diff --git a/asg/tests/pass/import/multiple.leo b/asg/tests/pass/import/multiple.leo deleted file mode 100644 index 4bd181c02d..0000000000 --- a/asg/tests/pass/import/multiple.leo +++ /dev/null @@ -1,10 +0,0 @@ -import test-import.( - Point, - foo -); - -function main() { - const a = Point { x: 1u32, y: 0u32 }; - - console.assert(a.x == 1u32); -} \ No newline at end of file diff --git a/asg/tests/pass/import/names.leo b/asg/tests/pass/import/names.leo deleted file mode 100644 index d3ce50829a..0000000000 --- a/asg/tests/pass/import/names.leo +++ /dev/null @@ -1,5 +0,0 @@ -import a0-f.foo; -import a-9.bar; -import hello-world.hello; - -function main() {} \ No newline at end of file diff --git a/asg/tests/pass/import/src/a-9.leo b/asg/tests/pass/import/src/a-9.leo deleted file mode 100644 index 8cd9f87f14..0000000000 --- a/asg/tests/pass/import/src/a-9.leo +++ /dev/null @@ -1 +0,0 @@ -function bar() {} \ No newline at end of file diff --git a/asg/tests/pass/import/src/a0-f.leo b/asg/tests/pass/import/src/a0-f.leo deleted file mode 100644 index c99ad3b713..0000000000 --- a/asg/tests/pass/import/src/a0-f.leo +++ /dev/null @@ -1 +0,0 @@ -function foo() {} \ No newline at end of file diff --git a/asg/tests/pass/import/src/hello-world.leo b/asg/tests/pass/import/src/hello-world.leo deleted file mode 100644 index 2d96e74c4c..0000000000 --- a/asg/tests/pass/import/src/hello-world.leo +++ /dev/null @@ -1 +0,0 @@ -function hello() {} \ No newline at end of file diff --git a/asg/tests/pass/import/src/test-import.leo b/asg/tests/pass/import/src/test-import.leo deleted file mode 100644 index e75fdd2fb1..0000000000 --- a/asg/tests/pass/import/src/test-import.leo +++ /dev/null @@ -1,8 +0,0 @@ -circuit Point { - x: u32; - y: u32; -} - -function foo() -> u32 { - return 1u32; -} \ No newline at end of file diff --git a/asg/tests/pass/import/star.leo b/asg/tests/pass/import/star.leo deleted file mode 100644 index 69d0791627..0000000000 --- a/asg/tests/pass/import/star.leo +++ /dev/null @@ -1,7 +0,0 @@ -import test-import.*; - -function main() { - const a = Point { x: 1u32, y: 0u32 }; - - console.assert(foo() == 1u32); -} \ No newline at end of file diff --git a/asg/tests/pass/mod.rs b/asg/tests/pass/mod.rs index 6fdc1aa301..531b04cf0b 100644 --- a/asg/tests/pass/mod.rs +++ b/asg/tests/pass/mod.rs @@ -24,7 +24,6 @@ pub mod definition; pub mod field; pub mod function; pub mod group; -pub mod import; pub mod input_files; pub mod integers; pub mod mutability; diff --git a/ast/src/program.rs b/ast/src/program.rs index 603d93f8d6..b79f6dbb7d 100644 --- a/ast/src/program.rs +++ b/ast/src/program.rs @@ -17,7 +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, Identifier, ImportStatement}; +use crate::{Circuit, DefinitionStatement, Function, FunctionInput, ImportStatement}; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; @@ -30,9 +30,9 @@ pub struct Program { pub expected_input: Vec, pub import_statements: Vec, pub imports: IndexMap, - pub circuits: IndexMap, + pub circuits: IndexMap, pub global_consts: IndexMap, - pub functions: IndexMap, + pub functions: IndexMap, } impl AsRef for Program { diff --git a/ast/src/reducer/importer.rs b/ast/src/reducer/importer.rs index 01cfa591df..0b4f6f684e 100644 --- a/ast/src/reducer/importer.rs +++ b/ast/src/reducer/importer.rs @@ -24,9 +24,6 @@ where T: ImportResolver, { import_resolver: T, - functions_to_import: Vec<(String, Option)>, - circuits_to_import: Vec<(String, Option)>, - global_consts_to_import: Vec<(String, Option)>, } impl Importer @@ -34,12 +31,7 @@ where T: ImportResolver, { pub fn new(import_resolver: T) -> Self { - Self { - import_resolver, - functions_to_import: Vec::new(), - circuits_to_import: Vec::new(), - global_consts_to_import: Vec::new(), - } + Self { import_resolver } } } @@ -103,7 +95,7 @@ fn resolve_import_package_access( PackageAccess::Multiple(packages) => { package_segments.push(packages.name.name.to_string()); for subaccess in packages.accesses.iter() { - resolve_import_package_access(output, package_segments.clone(), &subaccess); + resolve_import_package_access(output, package_segments.clone(), subaccess); } } } @@ -125,12 +117,12 @@ where expected_input: Vec, import_statements: Vec, empty_imports: IndexMap, - circuits: IndexMap, - functions: IndexMap, - global_consts: IndexMap, + mut circuits: IndexMap, + mut functions: IndexMap, + mut global_consts: IndexMap, ) -> Result { if !empty_imports.is_empty() { - // TODO THROW ERR + // TODO THROW ERROR } let mut imported_symbols: Vec<(Vec, ImportSymbol, Span)> = vec![]; @@ -149,6 +141,7 @@ where for (package, span) in deduplicated_imports { let _pretty_package = package.join("."); + // TODO FIX ERROR let resolved_package = match wrapped_resolver.resolve_package(&package.iter().map(|x| &**x).collect::>()[..], &span)? { Some(x) => x, @@ -158,35 +151,43 @@ where resolved_packages.insert(package.clone(), resolved_package); } - // TODO Errors + // TODO ERROR // TODO copyable AST. - // TODO should imports be renamed in imported program? for (package, symbol, span) in imported_symbols.into_iter() { let _pretty_package = package.join("."); let resolved_package = resolved_packages .get_mut(&package) .expect("could not find preloaded package"); + match symbol { - ImportSymbol::Alias(name, alias) => { - let lookup_ident = Identifier::new(name.clone().into()); - if let Some((ident, function)) = resolved_package.functions.remove_entry(&lookup_ident) { - let mut alias_identifier = ident.clone(); - alias_identifier.name = alias.into(); - resolved_package.functions.insert(alias_identifier, function.clone()); - } else if let Some((ident, circuit)) = resolved_package.circuits.remove_entry(&lookup_ident) { - let mut alias_identifier = ident.clone(); - alias_identifier.name = alias.into(); - resolved_package.circuits.insert(alias_identifier, circuit.clone()); - } else if let Some(global_const) = resolved_package.global_consts.remove(&name) { - resolved_package - .global_consts - .insert(alias.clone(), global_const.clone()); + ImportSymbol::All => { + functions.extend(resolved_package.functions.clone().into_iter()); + circuits.extend(resolved_package.circuits.clone().into_iter()); + global_consts.extend(resolved_package.global_consts.clone().into_iter()); + } + ImportSymbol::Direct(name) => { + if let Some(function) = resolved_package.functions.get(&name) { + functions.insert(name.clone(), function.clone()); + } else if let Some(circuit) = resolved_package.circuits.get(&name) { + circuits.insert(name.clone(), circuit.clone()); + } 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()); + } + } + ImportSymbol::Alias(name, alias) => { + if let Some(function) = resolved_package.functions.get(&name) { + functions.insert(alias.clone(), function.clone()); + } else if let Some(circuit) = resolved_package.circuits.get(&name) { + circuits.insert(alias.clone(), circuit.clone()); + } 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()); } } - _ => {} } } diff --git a/ast/src/reducer/reconstructing_director.rs b/ast/src/reducer/reconstructing_director.rs index c757958dd7..dca1d30829 100644 --- a/ast/src/reducer/reconstructing_director.rs +++ b/ast/src/reducer/reconstructing_director.rs @@ -428,14 +428,14 @@ impl ReconstructingDirector { let mut circuits = IndexMap::new(); self.reducer.swap_in_circuit(); - for (identifier, circuit) in program.circuits.iter() { - circuits.insert(self.reduce_identifier(identifier)?, self.reduce_circuit(circuit)?); + for (name, circuit) in program.circuits.iter() { + circuits.insert(name.clone(), self.reduce_circuit(circuit)?); } self.reducer.swap_in_circuit(); let mut functions = IndexMap::new(); - for (identifier, function) in program.functions.iter() { - functions.insert(self.reduce_identifier(identifier)?, self.reduce_function(function)?); + for (name, function) in program.functions.iter() { + functions.insert(name.clone(), self.reduce_function(function)?); } let mut global_consts = IndexMap::new(); diff --git a/ast/src/reducer/reconstructing_reducer.rs b/ast/src/reducer/reconstructing_reducer.rs index 4ffcf77908..abd8867d87 100644 --- a/ast/src/reducer/reconstructing_reducer.rs +++ b/ast/src/reducer/reconstructing_reducer.rs @@ -374,6 +374,7 @@ pub trait ReconstructingReducer { }) } + #[allow(clippy::too_many_arguments)] // Program fn reduce_program( &mut self, @@ -381,8 +382,8 @@ pub trait ReconstructingReducer { expected_input: Vec, import_statements: Vec, imports: IndexMap, - circuits: IndexMap, - functions: IndexMap, + circuits: IndexMap, + functions: IndexMap, global_consts: IndexMap, ) -> Result { Ok(Program { diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index d862b28b94..7921832937 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -242,6 +242,10 @@ impl<'a, F: PrimeField, G: GroupType> Compiler<'a, F, G> { // Preform import resolution. ast.importer(leo_imports::ImportParser::new(self.main_file_path.clone()))?; + if self.ast_snapshot_options.imports_resolved { + ast.to_json_file(self.output_directory.clone(), "imports_resolved.json")?; + } + // Preform canonicalization of AST always. ast.canonicalize()?; diff --git a/compiler/src/option.rs b/compiler/src/option.rs index 0dc5ccca51..fda6852ce2 100644 --- a/compiler/src/option.rs +++ b/compiler/src/option.rs @@ -38,6 +38,7 @@ impl Default for CompilerOptions { #[derive(Clone)] pub struct AstSnapshotOptions { pub initial: bool, + pub imports_resolved: bool, pub canonicalized: bool, pub type_inferenced: bool, } @@ -46,6 +47,7 @@ impl Default for AstSnapshotOptions { fn default() -> Self { Self { initial: false, + imports_resolved: false, canonicalized: false, type_inferenced: false, } diff --git a/compiler/src/test.rs b/compiler/src/test.rs index 244fa58961..89a7fdb251 100644 --- a/compiler/src/test.rs +++ b/compiler/src/test.rs @@ -88,6 +88,7 @@ struct CompileOutput { pub circuit: SummarizedCircuit, pub output: Vec, pub initial_ast: String, + pub imports_resolved_ast: String, pub canonicalized_ast: String, pub type_inferenced_ast: String, } @@ -113,6 +114,7 @@ impl Namespace for CompileNamespace { &test.content, Some(AstSnapshotOptions { initial: true, + imports_resolved: true, canonicalized: true, type_inferenced: true, }), @@ -209,19 +211,25 @@ impl Namespace for CompileNamespace { let initial_ast: String = hash( Ast::from_json_file("/tmp/output/initial_ast.json".into()) - .unwrap_or_else(|_| Ast::new(Program::new("Error reading initial theorem.".to_string()))) + .unwrap_or_else(|_| Ast::new(Program::new("Error reading initial snapshot.".to_string()))) + .to_json_string() + .unwrap_or_else(|_| "Error converting ast to string.".to_string()), + ); + let imports_resolved_ast: String = hash( + Ast::from_json_file("/tmp/output/imports_resolved_ast.json".into()) + .unwrap_or_else(|_| Ast::new(Program::new("Error reading imports resolved snapshot.".to_string()))) .to_json_string() .unwrap_or_else(|_| "Error converting ast to string.".to_string()), ); let canonicalized_ast: String = hash( Ast::from_json_file("/tmp/output/canonicalization_ast.json".into()) - .unwrap_or_else(|_| Ast::new(Program::new("Error reading canonicalized theorem.".to_string()))) + .unwrap_or_else(|_| Ast::new(Program::new("Error reading canonicalized snapshot.".to_string()))) .to_json_string() .unwrap_or_else(|_| "Error converting ast to string.".to_string()), ); let type_inferenced_ast = hash( Ast::from_json_file("/tmp/output/type_inferenced_ast.json".into()) - .unwrap_or_else(|_| Ast::new(Program::new("Error reading type inferenced theorem.".to_string()))) + .unwrap_or_else(|_| Ast::new(Program::new("Error reading type inferenced snapshot.".to_string()))) .to_json_string() .unwrap_or_else(|_| "Error converting ast to string.".to_string()), ); @@ -234,6 +242,7 @@ impl Namespace for CompileNamespace { circuit: last_circuit.unwrap(), output: output_items, initial_ast, + imports_resolved_ast, canonicalized_ast, type_inferenced_ast, }; diff --git a/imports/src/parser/parse_package.rs b/imports/src/parser/parse_package.rs index c53eac5335..cb6d476911 100644 --- a/imports/src/parser/parse_package.rs +++ b/imports/src/parser/parse_package.rs @@ -15,7 +15,7 @@ // along with the Leo library. If not, see . use crate::ImportParser; -use leo_ast::{Identifier, ImportResolver, Program}; +use leo_ast::Program; use leo_errors::{ImportError, Result, Span}; use std::{fs, fs::DirEntry, path::PathBuf}; diff --git a/leo/commands/build.rs b/leo/commands/build.rs index 214f56a6f3..dfc0747626 100644 --- a/leo/commands/build.rs +++ b/leo/commands/build.rs @@ -47,6 +47,8 @@ pub struct BuildOptions { pub enable_all_ast_snapshots: bool, #[structopt(long, help = "Writes AST snapshot of the initial parse.")] pub enable_initial_ast_snapshot: bool, + #[structopt(long, help = "Writes AST snapshot after the import resolution phase.")] + pub enable_imports_resolved_ast_snapshot: bool, #[structopt(long, help = "Writes AST snapshot after the canonicalization phase.")] pub enable_canonicalized_ast_snapshot: bool, #[structopt(long, help = "Writes AST snapshot after the type inference phase.")] @@ -61,6 +63,7 @@ impl Default for BuildOptions { disable_all_optimizations: true, enable_all_ast_snapshots: false, enable_initial_ast_snapshot: false, + enable_imports_resolved_ast_snapshot: false, enable_canonicalized_ast_snapshot: false, enable_type_inferenced_ast_snapshot: false, } @@ -88,12 +91,14 @@ impl From for AstSnapshotOptions { if options.enable_all_ast_snapshots { AstSnapshotOptions { initial: true, + imports_resolved: true, canonicalized: true, type_inferenced: true, } } else { AstSnapshotOptions { initial: options.enable_initial_ast_snapshot, + imports_resolved: options.enable_imports_resolved_ast_snapshot, canonicalized: options.enable_canonicalized_ast_snapshot, type_inferenced: options.enable_type_inferenced_ast_snapshot, } diff --git a/parser/src/parser/file.rs b/parser/src/parser/file.rs index 420734a8b5..2939105521 100644 --- a/parser/src/parser/file.rs +++ b/parser/src/parser/file.rs @@ -402,14 +402,14 @@ impl ParserContext { /// Returns an [`(Identifier, Circuit)`] tuple of AST nodes if the next tokens represent a /// circuit name and definition statement. /// - pub fn parse_circuit(&mut self) -> Result<(Identifier, Circuit)> { + pub fn parse_circuit(&mut self) -> Result<(String, Circuit)> { self.expect(Token::Circuit)?; let name = self.expect_ident()?; self.expect(Token::LeftCurly)?; let members = self.parse_circuit_declaration()?; Ok(( - name.clone(), + name.name.to_string(), Circuit { circuit_name: name, members, @@ -466,7 +466,7 @@ impl ParserContext { /// Returns an [`(Identifier, Function)`] AST node if the next tokens represent a function name /// and function definition. /// - pub fn parse_function_declaration(&mut self) -> Result<(Identifier, Function)> { + pub fn parse_function_declaration(&mut self) -> Result<(String, Function)> { let mut annotations = Vec::new(); while self.peek_token().as_ref() == &Token::At { annotations.push(self.parse_annotation()?); @@ -490,7 +490,7 @@ impl ParserContext { }; let block = self.parse_block()?; Ok(( - name.clone(), + name.name.to_string(), Function { annotations, identifier: name, diff --git a/parser/tests/serialization/expected_leo_ast.json b/parser/tests/serialization/expected_leo_ast.json index b252808c03..07040a0226 100644 --- a/parser/tests/serialization/expected_leo_ast.json +++ b/parser/tests/serialization/expected_leo_ast.json @@ -1,15 +1,18 @@ { "name": "", "expected_input": [], - "imports": [], + "import_statements": [], + "imports": {}, "circuits": {}, "global_consts": {}, "functions": { - "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function main() {\\\"}\"}": { + "main": { "annotations": [], - "identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function main() {\\\"}\"}", + "identifier": "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"C:\\\\\\\\Users\\\\\\\\jonat\\\\\\\\AppData\\\\\\\\Roaming\\\\\\\\work\\\\\\\\tester\\\\\\\\src/main.leo\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}", "input": [], - "output": null, + "output": { + "IntegerType": "U8" + }, "block": { "statements": [ { @@ -18,30 +21,32 @@ "Binary": { "left": { "Value": { - "Implicit": [ + "Integer": [ + "U8", "1", { "line_start": 2, "line_stop": 2, "col_start": 12, - "col_stop": 13, - "path": "test", - "content": " return 1 + 1" + "col_stop": 15, + "path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo", + "content": " return 1u8 + 1u8;" } ] } }, "right": { "Value": { - "Implicit": [ + "Integer": [ + "U8", "1", { "line_start": 2, "line_stop": 2, - "col_start": 16, - "col_stop": 17, - "path": "test", - "content": " return 1 + 1" + "col_start": 18, + "col_stop": 21, + "path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo", + "content": " return 1u8 + 1u8;" } ] } @@ -51,9 +56,9 @@ "line_start": 2, "line_stop": 2, "col_start": 12, - "col_stop": 17, - "path": "test", - "content": " return 1 + 1" + "col_stop": 21, + "path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo", + "content": " return 1u8 + 1u8;" } } }, @@ -61,9 +66,9 @@ "line_start": 2, "line_stop": 2, "col_start": 5, - "col_stop": 17, - "path": "test", - "content": " return 1 + 1" + "col_stop": 21, + "path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo", + "content": " return 1u8 + 1u8;" } } } @@ -71,10 +76,10 @@ "span": { "line_start": 1, "line_stop": 3, - "col_start": 17, + "col_start": 23, "col_stop": 2, - "path": "test", - "content": "function main() {\n...\n}" + "path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo", + "content": "function main() -> u8 {\n ...\n}" } }, "span": { @@ -82,8 +87,8 @@ "line_stop": 3, "col_start": 1, "col_stop": 2, - "path": "test", - "content": "function main() {\n...\n}" + "path": "C:\\Users\\jonat\\AppData\\Roaming\\work\\tester\\src/main.leo", + "content": "function main() -> u8 {\n ...\n}" } } } diff --git a/parser/tests/serialization/main.leo b/parser/tests/serialization/main.leo index b12eb1ae6b..58977dabba 100644 --- a/parser/tests/serialization/main.leo +++ b/parser/tests/serialization/main.leo @@ -1,3 +1,3 @@ function main() { - return 1 + 1; + return 1u8 + 1u8; } diff --git a/tests/expectations/parser/parser/circuits/big_self.leo.out b/tests/expectations/parser/parser/circuits/big_self.leo.out index 7ab99429ca..afb7adab52 100644 --- a/tests/expectations/parser/parser/circuits/big_self.leo.out +++ b/tests/expectations/parser/parser/circuits/big_self.leo.out @@ -4,9 +4,10 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: - "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + X: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: - CircuitFunction: diff --git a/tests/expectations/parser/parser/circuits/empty.leo.out b/tests/expectations/parser/parser/circuits/empty.leo.out index c49cb7535e..d882acbd9b 100644 --- a/tests/expectations/parser/parser/circuits/empty.leo.out +++ b/tests/expectations/parser/parser/circuits/empty.leo.out @@ -4,9 +4,10 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: - "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + X: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: [] global_consts: {} diff --git a/tests/expectations/parser/parser/circuits/field_and_functions.leo.out b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out index 2001535836..44be3eb2fe 100644 --- a/tests/expectations/parser/parser/circuits/field_and_functions.leo.out +++ b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out @@ -4,9 +4,10 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: - "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + X: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: - CircuitVariable: diff --git a/tests/expectations/parser/parser/circuits/fields.leo.out b/tests/expectations/parser/parser/circuits/fields.leo.out index 544e12e553..178dc03624 100644 --- a/tests/expectations/parser/parser/circuits/fields.leo.out +++ b/tests/expectations/parser/parser/circuits/fields.leo.out @@ -4,9 +4,10 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: - "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + X: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: - CircuitVariable: diff --git a/tests/expectations/parser/parser/circuits/functions.leo.out b/tests/expectations/parser/parser/circuits/functions.leo.out index 456134649f..ce8af605cb 100644 --- a/tests/expectations/parser/parser/circuits/functions.leo.out +++ b/tests/expectations/parser/parser/circuits/functions.leo.out @@ -4,9 +4,10 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: - "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + X: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: - CircuitFunction: diff --git a/tests/expectations/parser/parser/circuits/mut_self.leo.out b/tests/expectations/parser/parser/circuits/mut_self.leo.out index 5aac598fe5..9c67bad48b 100644 --- a/tests/expectations/parser/parser/circuits/mut_self.leo.out +++ b/tests/expectations/parser/parser/circuits/mut_self.leo.out @@ -4,9 +4,10 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: - "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + X: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: - CircuitFunction: diff --git a/tests/expectations/parser/parser/circuits/self.leo.out b/tests/expectations/parser/parser/circuits/self.leo.out index 728f595922..304d73d14b 100644 --- a/tests/expectations/parser/parser/circuits/self.leo.out +++ b/tests/expectations/parser/parser/circuits/self.leo.out @@ -4,9 +4,10 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: - "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + X: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: - CircuitFunction: diff --git a/tests/expectations/parser/parser/functions/annotated.leo.out b/tests/expectations/parser/parser/functions/annotated.leo.out index 36507df8ff..97255f594e 100644 --- a/tests/expectations/parser/parser/functions/annotated.leo.out +++ b/tests/expectations/parser/parser/functions/annotated.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + x: annotations: - span: line_start: 3 diff --git a/tests/expectations/parser/parser/functions/annotated_param.leo.out b/tests/expectations/parser/parser/functions/annotated_param.leo.out index a2654b5268..0d40a1825c 100644 --- a/tests/expectations/parser/parser/functions/annotated_param.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_param.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + x: annotations: - span: line_start: 3 diff --git a/tests/expectations/parser/parser/functions/annotated_twice.leo.out b/tests/expectations/parser/parser/functions/annotated_twice.leo.out index 2d67d2236c..a4b04a991f 100644 --- a/tests/expectations/parser/parser/functions/annotated_twice.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_twice.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + x: annotations: - span: line_start: 3 diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index 1a7d0c68dd..9bb5fdb94a 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -4,76 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": - annotations: [] - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" - input: - - Variable: - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" - const_: false - mutable: true - type_: - IntegerType: U32 - span: - line_start: 3 - line_stop: 3 - col_start: 12 - col_stop: 13 - path: "" - content: "function x(x: u32, const y: i32) {" - - Variable: - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" - const_: true - mutable: false - type_: - IntegerType: I32 - span: - line_start: 3 - line_stop: 3 - col_start: 26 - col_stop: 27 - path: "" - content: "function x(x: u32, const y: i32) {" - output: ~ - block: - statements: - - Return: - expression: - TupleInit: - elements: [] - span: - line_start: 4 - line_stop: 4 - col_start: 12 - col_stop: 14 - path: "" - content: " return ();" - span: - line_start: 4 - line_stop: 4 - col_start: 5 - col_stop: 14 - path: "" - content: " return ();" - span: - line_start: 3 - line_stop: 5 - col_start: 34 - col_stop: 2 - path: "" - content: "function x(x: u32, const y: i32) {\n ...\n}" - span: - line_start: 3 - line_stop: 5 - col_start: 1 - col_stop: 2 - path: "" - content: "function x(x: u32, const y: i32) {\n ...\n}" - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" input: diff --git a/tests/expectations/parser/parser/functions/const_self_bad.leo.out b/tests/expectations/parser/parser/functions/const_self_bad.leo.out index 0bce0f5a14..d29bb580f6 100644 --- a/tests/expectations/parser/parser/functions/const_self_bad.leo.out +++ b/tests/expectations/parser/parser/functions/const_self_bad.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}" input: diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index 74f3b12e79..a302be27b5 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" input: [] diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index 9e6e0e1b79..b4f32bd133 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}" input: [] diff --git a/tests/expectations/parser/parser/functions/param_array.leo.out b/tests/expectations/parser/parser/functions/param_array.leo.out index 367878395b..541f6f67e8 100644 --- a/tests/expectations/parser/parser/functions/param_array.leo.out +++ b/tests/expectations/parser/parser/functions/param_array.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}" input: diff --git a/tests/expectations/parser/parser/functions/param_circuit.leo.out b/tests/expectations/parser/parser/functions/param_circuit.leo.out index 45bb7dcde7..e17383cc52 100644 --- a/tests/expectations/parser/parser/functions/param_circuit.leo.out +++ b/tests/expectations/parser/parser/functions/param_circuit.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}" input: diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index ef7a74d3de..b8d0f10361 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}" input: diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index d1ea6ac6c4..00e1da53d2 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" input: diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 194d6069d2..0f5582b8f4 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" input: diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index 9d8f155ffa..345a59b3cf 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}" input: [] diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index cd07553041..b02081a327 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -4,11 +4,12 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: [] + import_statements: [] + imports: {} circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": + x: annotations: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}" input: [] diff --git a/tests/expectations/parser/parser/import/alias.leo.out b/tests/expectations/parser/parser/import/alias.leo.out index 548fd7c84c..3d21b106c2 100644 --- a/tests/expectations/parser/parser/import/alias.leo.out +++ b/tests/expectations/parser/parser/import/alias.leo.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: + import_statements: - package_or_packages: Package: name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a.b as bar;\\\"}\"}" @@ -33,6 +33,7 @@ outputs: col_stop: 18 path: "" content: import a.b as bar; + imports: {} circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/basic.leo.out b/tests/expectations/parser/parser/import/basic.leo.out index 17a6ffdce3..434c379bb1 100644 --- a/tests/expectations/parser/parser/import/basic.leo.out +++ b/tests/expectations/parser/parser/import/basic.leo.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: + import_statements: - package_or_packages: Package: name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a.b;\\\"}\"}" @@ -33,6 +33,7 @@ outputs: col_stop: 11 path: "" content: import a.b; + imports: {} circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/many_import.leo.out b/tests/expectations/parser/parser/import/many_import.leo.out index fe11e6dc50..7701269e56 100644 --- a/tests/expectations/parser/parser/import/many_import.leo.out +++ b/tests/expectations/parser/parser/import/many_import.leo.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: + import_statements: - package_or_packages: Packages: name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.( // local import\\\"}\"}" @@ -131,6 +131,7 @@ outputs: col_stop: 16 path: "" content: "import bar.( // imports directory import\n ...\n ...\n bat.bat.Bat," + imports: {} circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/many_import_star.leo.out b/tests/expectations/parser/parser/import/many_import_star.leo.out index 1e129a584b..31db60cd37 100644 --- a/tests/expectations/parser/parser/import/many_import_star.leo.out +++ b/tests/expectations/parser/parser/import/many_import_star.leo.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: + import_statements: - package_or_packages: Package: name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.*; // local import\\\"}\"}" @@ -165,6 +165,7 @@ outputs: col_stop: 13 path: "" content: import car.*; // imports directory import + imports: {} circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/names.leo.out b/tests/expectations/parser/parser/import/names.leo.out index 1c38d71a94..b43022cf78 100644 --- a/tests/expectations/parser/parser/import/names.leo.out +++ b/tests/expectations/parser/parser/import/names.leo.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: + import_statements: - package_or_packages: Package: name: "{\"name\":\"a0-f\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import a0-f.foo;\\\"}\"}" @@ -89,6 +89,7 @@ outputs: col_stop: 25 path: "" content: import hello-world.hello; + imports: {} circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/names_underscore.leo.out b/tests/expectations/parser/parser/import/names_underscore.leo.out index c9f7799293..0c9dfbbbdd 100644 --- a/tests/expectations/parser/parser/import/names_underscore.leo.out +++ b/tests/expectations/parser/parser/import/names_underscore.leo.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: + import_statements: - package_or_packages: Package: name: "{\"name\":\"hello_world\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import hello_world.foo;\\\"}\"}" @@ -33,6 +33,7 @@ outputs: col_stop: 23 path: "" content: import hello_world.foo; + imports: {} circuits: {} global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/star.leo.out b/tests/expectations/parser/parser/import/star.leo.out index b2cce28fdc..bc2fc484dc 100644 --- a/tests/expectations/parser/parser/import/star.leo.out +++ b/tests/expectations/parser/parser/import/star.leo.out @@ -4,7 +4,7 @@ expectation: Pass outputs: - name: "" expected_input: [] - imports: + import_statements: - package_or_packages: Package: name: "{\"name\":\"test-import\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import test-import.*;\\\"}\"}" @@ -31,6 +31,7 @@ outputs: col_stop: 21 path: "" content: import test-import.*; + imports: {} circuits: {} global_consts: {} functions: {}