diff --git a/compiler/passes/src/type_checking/check_program.rs b/compiler/passes/src/type_checking/check_program.rs index 7a25efcd1d..ee8df16af3 100644 --- a/compiler/passes/src/type_checking/check_program.rs +++ b/compiler/passes/src/type_checking/check_program.rs @@ -113,12 +113,13 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { fn visit_struct_stub(&mut self, input: &'a Struct) { // Allow records only. - if !input.is_record { - self.emit_err(TypeCheckerError::stubs_can_only_have_records_and_transitions( - "non-record struct", - input.span, - )); - } + // TODO: Keep this or not? + // if !input.is_record { + // self.emit_err(TypeCheckerError::stubs_can_only_have_records_and_transitions( + // "non-record struct", + // input.span, + // )); + // } self.visit_struct(input); } diff --git a/leo/cli/cli.rs b/leo/cli/cli.rs index 64d80837f0..c94e00c3db 100644 --- a/leo/cli/cli.rs +++ b/leo/cli/cli.rs @@ -19,7 +19,6 @@ use leo_errors::Result; use clap::Parser; use colored::Colorize; -use leo_span::symbol::create_session_if_not_set_then; use std::{path::PathBuf, process::exit}; /// CLI Arguments entry point - includes global parameters and subcommands @@ -135,8 +134,10 @@ pub fn run_with_args(cli: CLI) -> Result<()> { } } + #[test] pub fn build_test() -> Result<()> { + use leo_span::symbol::create_session_if_not_set_then; const BUILD_DIRECTORY: &str = "utils/tmp/project"; let cli = CLI { @@ -152,7 +153,7 @@ pub fn build_test() -> Result<()> { } #[test] pub fn build_super_simple_test() -> Result<()> { - dbg!(std::env::current_dir().expect("TODO: panic message")); + use leo_span::symbol::create_session_if_not_set_then; const BUILD_DIRECTORY: &str = "utils/tmp/super_simple"; let cli = CLI { diff --git a/utils/disassembler/src/lib.rs b/utils/disassembler/src/lib.rs index d3b68820e2..0c00d6351b 100644 --- a/utils/disassembler/src/lib.rs +++ b/utils/disassembler/src/lib.rs @@ -14,15 +14,15 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . +use std::str::FromStr; use snarkvm::{ - prelude::{Itertools, Network}, - synthesizer::program::{CommandTrait, InstructionTrait, ProgramCore}, + prelude::{Itertools, Network, Testnet3}, + synthesizer::program::{CommandTrait, InstructionTrait, Program, ProgramCore}, }; +type CurrentNetwork = Testnet3; use leo_ast::{FunctionStub, Identifier, ProgramId, Struct, Stub}; -fn main() {} - pub fn disassemble, Command: CommandTrait>( program: ProgramCore, ) -> Stub { @@ -53,6 +53,13 @@ pub fn disassemble, Command: Comman } } +pub fn disassemble_from_str( + program: String, +) -> Stub { + let program = Program::::from_str(&program); + disassemble(program.expect("Failed to parse program")) // TODO: Handle error +} + #[cfg(test)] mod tests { use super::*; diff --git a/utils/retriever/src/lib.rs b/utils/retriever/src/lib.rs index b73fc3908e..6dd86abbe0 100644 --- a/utils/retriever/src/lib.rs +++ b/utils/retriever/src/lib.rs @@ -18,7 +18,7 @@ use disassembler::disassemble_from_str; use indexmap::{IndexMap, IndexSet}; use leo_ast::Stub; use leo_passes::{common::DiGraph, DiGraphError}; -use leo_span::{symbol::create_session_if_not_set_then, Symbol}; +use leo_span::Symbol; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; use std::{ @@ -322,6 +322,7 @@ fn fetch_from_network(program: String, network: Network) -> String { #[cfg(test)] mod tests { use super::*; + use leo_span::symbol::create_session_if_not_set_then; #[test] fn basic_test() {