forked from M-Labs/nac3
core: Fix compilation of tests
This commit is contained in:
parent
c679474f5c
commit
12c0eed0a3
|
@ -5,7 +5,8 @@ use crate::{
|
||||||
},
|
},
|
||||||
symbol_resolver::{SymbolResolver, ValueEnum},
|
symbol_resolver::{SymbolResolver, ValueEnum},
|
||||||
toplevel::{
|
toplevel::{
|
||||||
composer::TopLevelComposer, DefinitionId, FunInstance, TopLevelContext, TopLevelDef,
|
composer::{ComposerConfig, TopLevelComposer}, DefinitionId, FunInstance, TopLevelContext,
|
||||||
|
TopLevelDef,
|
||||||
},
|
},
|
||||||
typecheck::{
|
typecheck::{
|
||||||
type_inferencer::{FunctionData, Inferencer, PrimitiveStore},
|
type_inferencer::{FunctionData, Inferencer, PrimitiveStore},
|
||||||
|
@ -91,7 +92,7 @@ fn test_primitives() {
|
||||||
"};
|
"};
|
||||||
let statements = parse_program(source, Default::default()).unwrap();
|
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 mut unifier = composer.unifier.clone();
|
||||||
let primitives = composer.primitives_ty;
|
let primitives = composer.primitives_ty;
|
||||||
let top_level = Arc::new(composer.make_top_level_context());
|
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 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 mut unifier = composer.unifier.clone();
|
||||||
let primitives = composer.primitives_ty;
|
let primitives = composer.primitives_ty;
|
||||||
let top_level = Arc::new(composer.make_top_level_context());
|
let top_level = Arc::new(composer.make_top_level_context());
|
||||||
|
|
|
@ -111,7 +111,7 @@ impl SymbolResolver for Resolver {
|
||||||
"register"
|
"register"
|
||||||
)]
|
)]
|
||||||
fn test_simple_register(source: Vec<&str>) {
|
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 {
|
for s in source {
|
||||||
let ast = parse_program(s, Default::default()).unwrap();
|
let ast = parse_program(s, Default::default()).unwrap();
|
||||||
|
@ -131,7 +131,7 @@ fn test_simple_register(source: Vec<&str>) {
|
||||||
"register"
|
"register"
|
||||||
)]
|
)]
|
||||||
fn test_simple_register_without_constructor(source: &str) {
|
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 = parse_program(source, Default::default()).unwrap();
|
||||||
let ast = ast[0].clone();
|
let ast = ast[0].clone();
|
||||||
composer.register_top_level(ast, None, "".into(), true).unwrap();
|
composer.register_top_level(ast, None, "".into(), true).unwrap();
|
||||||
|
@ -165,7 +165,7 @@ fn test_simple_register_without_constructor(source: &str) {
|
||||||
"function compose"
|
"function compose"
|
||||||
)]
|
)]
|
||||||
fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&str>) {
|
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 {
|
let internal_resolver = Arc::new(ResolverInternal {
|
||||||
id_to_def: Default::default(),
|
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>) {
|
fn test_analyze(source: Vec<&str>, res: Vec<&str>) {
|
||||||
let print = false;
|
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(
|
let internal_resolver = make_internal_resolver_with_tvar(
|
||||||
vec![
|
vec![
|
||||||
|
@ -690,7 +690,7 @@ fn test_analyze(source: Vec<&str>, res: Vec<&str>) {
|
||||||
)]
|
)]
|
||||||
fn test_inference(source: Vec<&str>, res: Vec<&str>) {
|
fn test_inference(source: Vec<&str>, res: Vec<&str>) {
|
||||||
let print = true;
|
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(
|
let internal_resolver = make_internal_resolver_with_tvar(
|
||||||
vec![
|
vec![
|
||||||
|
|
|
@ -147,6 +147,7 @@ impl TestEnvironment {
|
||||||
uint32,
|
uint32,
|
||||||
uint64,
|
uint64,
|
||||||
option,
|
option,
|
||||||
|
size_t: 64,
|
||||||
};
|
};
|
||||||
unifier.put_primitive_store(&primitives);
|
unifier.put_primitive_store(&primitives);
|
||||||
set_primitives_magic_methods(&primitives, &mut unifier);
|
set_primitives_magic_methods(&primitives, &mut unifier);
|
||||||
|
@ -295,6 +296,7 @@ impl TestEnvironment {
|
||||||
uint32,
|
uint32,
|
||||||
uint64,
|
uint64,
|
||||||
option,
|
option,
|
||||||
|
size_t: 64,
|
||||||
};
|
};
|
||||||
|
|
||||||
unifier.put_primitive_store(&primitives);
|
unifier.put_primitive_store(&primitives);
|
||||||
|
|
Loading…
Reference in New Issue