From: fennecdjay Date: Mon, 4 Nov 2019 14:50:14 +0000 (+0100) Subject: :art: Update X-Git-Tag: nightly~2116^2~5 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=5098d705309b1d7010f62c87bfc00d0a45666188;p=gwion.git :art: Update --- diff --git a/src/import/udef.c b/src/import/udef.c index 24412fb1..81ee8827 100644 --- a/src/import/udef.c +++ b/src/import/udef.c @@ -32,8 +32,7 @@ ANN Exp make_exp(const Gwi gwi, const m_str type, const m_str name) { ANN2(1) m_int gwi_union_ini(const Gwi gwi, const m_str type, const m_str name) { CHECK_BB(ck_ini(gwi, ck_udef)) if(name) - CHECK_OB((gwi->ck->sym = str2sym(gwi, name))) -// gwi->ck->name = name; + CHECK_OB((gwi->ck->xid = str2sym(gwi, name))) gwi->ck->name = type; if(type) CHECK_BB(check_typename_def(gwi, gwi->ck)) @@ -74,7 +73,12 @@ ANN Type gwi_union_end(const Gwi gwi, const ae_flag flag) { udef->flag = flag; udef->xid = gwi->ck->xid; udef->type_xid = gwi->ck->sym; +// udef->xid = gwi->ck->sym; +// udef->type_xid = gwi->ck->xid; +printf("%p\n", gwi->ck->xid); if(gwi->ck->tmpl) { +if(udef->xid) +printf("xid %s\n", s_name(udef->xid)); if(udef->xid) GWI_ERR_O(_("Template union type can't declare instance at declaration")); udef->tmpl = new_tmpl(gwi->gwion->mp, gwi->ck->tmpl, -1); @@ -92,4 +96,5 @@ ANN void ck_clean_udef(MemPool mp, ImportCK* ck) { free_decl_list(mp, ck->list); if(ck->tmpl) free_id_list(mp, ck->tmpl); +// do we miss ck->td ? } diff --git a/tests/import/checker.c b/tests/import/checker.c index 33d19b2d..72756d92 100644 --- a/tests/import/checker.c +++ b/tests/import/checker.c @@ -13,6 +13,6 @@ #include "gwi.h" GWION_IMPORT(checker) { - CHECK_BB(tmpl_valid(gwi, "", "test")) GWI_BB(gwi_func_arg(gwi, "int", "i[][]")) GWI_BB(gwi_func_arg(gwi, "int", "me")) GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) diff --git a/tests/import/func_fail3.c b/tests/import/func_fail3.c index ed79d1bc..56ff79a6 100644 --- a/tests/import/func_fail3.c +++ b/tests/import/func_fail3.c @@ -13,7 +13,7 @@ #include "instr.h" GWION_IMPORT(too_many_args) { - GWI_BB(gwi_func_ini(gwi, "int", "test")) + GWI_BB(gwi_func_ini(gwi, "Ptr<~int~>", "test<~A~>")) GWI_BB(gwi_func_ini(gwi, "int", "test")) GWI_BB(gwi_func_arg(gwi, "int", "i[][]")) GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) diff --git a/tests/import/union_tmpl_fail3.c b/tests/import/union_tmpl_fail3.c new file mode 100644 index 00000000..12d25306 --- /dev/null +++ b/tests/import/union_tmpl_fail3.c @@ -0,0 +1,21 @@ +#include "gwion_util.h" +#include "gwion_ast.h" +#include "oo.h" +#include "vm.h" +#include "env.h" +#include "type.h" +#include "object.h" +#include "instr.h" +#include "gwion.h" +#include "value.h" +#include "operator.h" +#include "import.h" + +GWION_IMPORT(union_test) { + GWI_BB(gwi_union_ini(gwi, "U<~A~>", "Test")) + GWI_BB(gwi_union_add(gwi,"float", "f")) + GWI_BB(gwi_union_add(gwi,"int", "i")) + GWI_BB(gwi_union_add(gwi,"A", "a")) + GWI_OB(gwi_union_end(gwi, 0)) + return GW_OK; +}