From 97719a3969522eb1eb1be41140afccdeb1917479 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sun, 14 Jul 2019 19:20:52 +0200 Subject: [PATCH] :art: More tests --- src/lib/engine.c | 2 +- src/parse/template.c | 5 ----- tests/new/parent.gw | 14 ++++++++++++++ tests/new/typedef_func_tmpl_err.gw | 16 ++++++++++++++++ tests/new/typedef_func_tmpl_tmpl.gw | 2 ++ tests/sh/opt.sh | 2 +- 6 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 tests/new/parent.gw create mode 100644 tests/new/typedef_func_tmpl_err.gw create mode 100644 tests/new/typedef_func_tmpl_tmpl.gw diff --git a/src/lib/engine.c b/src/lib/engine.c index 05bda69e..a3f498ad 100644 --- a/src/lib/engine.c +++ b/src/lib/engine.c @@ -100,7 +100,7 @@ ANN m_bool type_engine_init(VM* vm, const Vector plug_dirs) { memset(&gwi, 0, sizeof(struct Gwi_)); gwi.gwion = vm->gwion; gwi.loc = new_loc(vm->gwion->mp, 0); - CHECK_BB(import_core_libs(&gwi)) + GWI_BB(import_core_libs(&gwi)) vm->gwion->env->name = "[imported]"; for(m_uint i = 0; i < vector_size(plug_dirs); ++i) { m_bool (*import)(Gwi) = (m_bool(*)(Gwi))vector_at(plug_dirs, i); diff --git a/src/parse/template.c b/src/parse/template.c index 0e02fb1d..f0a07c4e 100644 --- a/src/parse/template.c +++ b/src/parse/template.c @@ -187,11 +187,6 @@ ANN Type scan_type(const Env env, const Type t, const Type_Decl* type) { if(GET_FLAG(t, builtin)) SET_FLAG(a->base.type, builtin); CHECK_BO(scan1_cdef(env, a)) - if(t->nspc->dtor) { - a->base.type->nspc->dtor = t->nspc->dtor; - SET_FLAG(a->base.type, dtor); - ADD_REF(t->nspc->dtor) - } return a->base.type; } else if(type->types) { // TODO: clean me if(isa(t, t_function) > 0 && t->e->d.func->def->base->tmpl) { diff --git a/tests/new/parent.gw b/tests/new/parent.gw new file mode 100644 index 00000000..f330a5cb --- /dev/null +++ b/tests/new/parent.gw @@ -0,0 +1,14 @@ +class B { + +} +class <~A~> C extends B { + +} +class <~A,B~> D extends <~A~>C { + class <~A~>Child { + A a; + } + <~A~>Child child; +} + +<~int~>D d; diff --git a/tests/new/typedef_func_tmpl_err.gw b/tests/new/typedef_func_tmpl_err.gw new file mode 100644 index 00000000..5088d90e --- /dev/null +++ b/tests/new/typedef_func_tmpl_err.gw @@ -0,0 +1,16 @@ +typedef void t_ptr<~A~>(); + +t_ptr ptr; + +fun void test<~A~>() { + <<< __func_ >>>; +} + +test @=> ptr; +ptr<~int~>(); + + +#!typedef <~int~>t_ptr B; +#!B B; +#!<<>>; +#!<<< B<~int~>() >>>; diff --git a/tests/new/typedef_func_tmpl_tmpl.gw b/tests/new/typedef_func_tmpl_tmpl.gw new file mode 100644 index 00000000..04a943b8 --- /dev/null +++ b/tests/new/typedef_func_tmpl_tmpl.gw @@ -0,0 +1,2 @@ +typedef void ptr_t<~A~>(myPtr ptr); +<~ <~A~> Ptr~>ptr_t t; diff --git a/tests/sh/opt.sh b/tests/sh/opt.sh index 8234e3d1..9b733534 100644 --- a/tests/sh/opt.sh +++ b/tests/sh/opt.sh @@ -58,7 +58,7 @@ run "$n" "loop" "-l0" "file" # memoization n=$((n+1)) -run "$n" "memoize" "-z2 tests/new/pure.gw" "file" +run "$n" "memoize" "-z2 tests/new/pure*.gw" "file" # (fake) module arg n=$((n+1)) -- 2.43.0