From 12c0eed0a31bb490fc34ce83fd7e99a55846132a Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 17 Jan 2024 09:48:37 +0800 Subject: [PATCH] core: Fix compilation of tests --- nac3core/src/codegen/test.rs | 7 ++++--- nac3core/src/toplevel/test.rs | 10 +++++----- nac3core/src/typecheck/type_inferencer/test.rs | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/nac3core/src/codegen/test.rs b/nac3core/src/codegen/test.rs index c3a8c719..2f6d2249 100644 --- a/nac3core/src/codegen/test.rs +++ b/nac3core/src/codegen/test.rs @@ -5,7 +5,8 @@ use crate::{ }, symbol_resolver::{SymbolResolver, ValueEnum}, toplevel::{ - composer::TopLevelComposer, DefinitionId, FunInstance, TopLevelContext, TopLevelDef, + composer::{ComposerConfig, TopLevelComposer}, DefinitionId, FunInstance, TopLevelContext, + TopLevelDef, }, typecheck::{ type_inferencer::{FunctionData, Inferencer, PrimitiveStore}, @@ -91,7 +92,7 @@ fn test_primitives() { "}; let statements = parse_program(source, Default::default()).unwrap(); - let composer: TopLevelComposer = Default::default(); + let composer = TopLevelComposer::new(Vec::new(), ComposerConfig::default(), 32).0; let mut unifier = composer.unifier.clone(); let primitives = composer.primitives_ty; let top_level = Arc::new(composer.make_top_level_context()); @@ -248,7 +249,7 @@ fn test_simple_call() { "}; let statements_2 = parse_program(source_2, Default::default()).unwrap(); - let composer: TopLevelComposer = Default::default(); + let composer = TopLevelComposer::new(Vec::new(), ComposerConfig::default(), 32).0; let mut unifier = composer.unifier.clone(); let primitives = composer.primitives_ty; let top_level = Arc::new(composer.make_top_level_context()); diff --git a/nac3core/src/toplevel/test.rs b/nac3core/src/toplevel/test.rs index 19dc2165..ed38a037 100644 --- a/nac3core/src/toplevel/test.rs +++ b/nac3core/src/toplevel/test.rs @@ -111,7 +111,7 @@ impl SymbolResolver for Resolver { "register" )] fn test_simple_register(source: Vec<&str>) { - let mut composer: TopLevelComposer = Default::default(); + let mut composer = TopLevelComposer::new(Vec::new(), ComposerConfig::default(), 64).0; for s in source { let ast = parse_program(s, Default::default()).unwrap(); @@ -131,7 +131,7 @@ fn test_simple_register(source: Vec<&str>) { "register" )] fn test_simple_register_without_constructor(source: &str) { - let mut composer: TopLevelComposer = Default::default(); + let mut composer = TopLevelComposer::new(Vec::new(), ComposerConfig::default(), 64).0; let ast = parse_program(source, Default::default()).unwrap(); let ast = ast[0].clone(); composer.register_top_level(ast, None, "".into(), true).unwrap(); @@ -165,7 +165,7 @@ fn test_simple_register_without_constructor(source: &str) { "function compose" )] fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&str>) { - let mut composer: TopLevelComposer = Default::default(); + let mut composer = TopLevelComposer::new(Vec::new(), ComposerConfig::default(), 64).0; let internal_resolver = Arc::new(ResolverInternal { id_to_def: Default::default(), @@ -513,7 +513,7 @@ fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&s )] fn test_analyze(source: Vec<&str>, res: Vec<&str>) { let print = false; - let mut composer: TopLevelComposer = Default::default(); + let mut composer = TopLevelComposer::new(Vec::new(), ComposerConfig::default(), 64).0; let internal_resolver = make_internal_resolver_with_tvar( vec![ @@ -690,7 +690,7 @@ fn test_analyze(source: Vec<&str>, res: Vec<&str>) { )] fn test_inference(source: Vec<&str>, res: Vec<&str>) { let print = true; - let mut composer: TopLevelComposer = Default::default(); + let mut composer = TopLevelComposer::new(Vec::new(), ComposerConfig::default(), 64).0; let internal_resolver = make_internal_resolver_with_tvar( vec![ diff --git a/nac3core/src/typecheck/type_inferencer/test.rs b/nac3core/src/typecheck/type_inferencer/test.rs index f3ac2d08..8de69db9 100644 --- a/nac3core/src/typecheck/type_inferencer/test.rs +++ b/nac3core/src/typecheck/type_inferencer/test.rs @@ -147,6 +147,7 @@ impl TestEnvironment { uint32, uint64, option, + size_t: 64, }; unifier.put_primitive_store(&primitives); set_primitives_magic_methods(&primitives, &mut unifier); @@ -295,6 +296,7 @@ impl TestEnvironment { uint32, uint64, option, + size_t: 64, }; unifier.put_primitive_store(&primitives);