From: fennecdjay Date: Tue, 9 Jul 2019 17:30:19 +0000 (+0200) Subject: Revert ":art: More fixes and tests" X-Git-Tag: nightly~2348^2~14 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=395ab6efb051a65216f0454315f5574d3894139d;p=gwion.git Revert ":art: More fixes and tests" This reverts commit 6b5edd67af9eac6749e66ce4bfc7b9223040d69a. --- diff --git a/src/arg.gcda b/src/arg.gcda index bf449aee..3dcc1be1 100644 Binary files a/src/arg.gcda and b/src/arg.gcda differ diff --git a/src/arg.gcno b/src/arg.gcno index 38f07084..4b9a987e 100644 Binary files a/src/arg.gcno and b/src/arg.gcno differ diff --git a/src/compile.gcda b/src/compile.gcda index 6b4cdd62..d7311546 100644 Binary files a/src/compile.gcda and b/src/compile.gcda differ diff --git a/src/compile.gcno b/src/compile.gcno index d69f6e16..411f8355 100644 Binary files a/src/compile.gcno and b/src/compile.gcno differ diff --git a/src/gwion.gcda b/src/gwion.gcda index 1a44e2f8..d0363d62 100644 Binary files a/src/gwion.gcda and b/src/gwion.gcda differ diff --git a/src/gwion.gcno b/src/gwion.gcno index db0a66d4..6c8e11e1 100644 Binary files a/src/gwion.gcno and b/src/gwion.gcno differ diff --git a/src/gwiondata.gcda b/src/gwiondata.gcda index 74199b69..8a977517 100644 Binary files a/src/gwiondata.gcda and b/src/gwiondata.gcda differ diff --git a/src/gwiondata.gcno b/src/gwiondata.gcno index 83192df2..5f90c6e3 100644 Binary files a/src/gwiondata.gcno and b/src/gwiondata.gcno differ diff --git a/src/lib/func.c b/src/lib/func.c index 657d336d..4d8cc62b 100644 --- a/src/lib/func.c +++ b/src/lib/func.c @@ -67,20 +67,20 @@ struct FptrInfo { ANN static m_bool fptr_tmpl_push(const Env env, struct FptrInfo *info) { if(!info->rhs->def->base->tmpl) return GW_OK; +// some kind of template_match ? ID_List t0 = info->lhs->def->base->tmpl->list, t1 = info->rhs->def->base->tmpl->list; - nspc_push_type(env->gwion->mp, env->curr); +nspc_push_type(env->gwion->mp, env->curr); while(t0) { - if(!t1) { - nspc_pop_type(env->gwion->mp, env->curr); - return GW_ERROR; - } - nspc_add_type(env->curr, t0->xid, t_undefined); - nspc_add_type(env->curr, t1->xid, t_undefined); +// CHECK_OB(t1) +nspc_add_type(env->curr, t0->xid, t_undefined);// +nspc_add_type(env->curr, t1->xid, t_undefined);// t0 = t0->next; t1 = t1->next; } - return GW_OK; +// CHECK_BB(template_push_types(env, info->lhs->def->base->tmpl)) +// return template_push_types(env, info->rhs->def->base->tmpl); +return GW_OK;// } @@ -146,8 +146,10 @@ ANN static Type fptr_type(const Env env, struct FptrInfo *info) { if(fptr_rettype(env, info) > 0 && fptr_arity(info) && fptr_args(env, base) > 0) type = info->lhs->value_ref->type; - if(info->rhs->def->base->tmpl) + if(info->rhs->def->base->tmpl) { +// nspc_pop_type(env->gwion->mp, env->curr); nspc_pop_type(env->gwion->mp, env->curr); + } } } return type; diff --git a/src/main.gcda b/src/main.gcda index 5fce5e27..1bd518d8 100644 Binary files a/src/main.gcda and b/src/main.gcda differ diff --git a/src/main.gcno b/src/main.gcno index d737dff5..6293d574 100644 Binary files a/src/main.gcno and b/src/main.gcno differ diff --git a/src/parse/check.c b/src/parse/check.c index f20143ab..a3e565eb 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -367,7 +367,9 @@ ANN2(1,2) static Func find_func_match_actual(const Env env, Func func, const Exp CHECK_OO(func->next); return find_func_match_actual(env, func->next, args, implicit, specific); } - if(e1->type == t_undefined || (GET_FLAG(func, template) && is_fptr(func->value_ref->type))) { + if(e1->type == t_undefined || +(GET_FLAG(func, template) && isa(actual_type(func->value_ref->type), t_fptr) > 0) +) { if(func->value_ref->owner_class) CHECK_BO(template_push_types(env, func->value_ref->owner_class->e->def->base.tmpl)) e1->type = known_type(env, e1->td); @@ -379,6 +381,7 @@ ANN2(1,2) static Func find_func_match_actual(const Env env, Func func, const Exp e = e->next; e1 = e1->next; } +printf("end %p %p\n", e1, func); if(!e1) return func; } while((func = func->next)); @@ -466,10 +469,11 @@ ANN static Func _find_template_match(const Env env, const Value v, const Exp_Cal m_func = find_func_match(env, fbase->func, exp->args); nspc_pop_type(env->gwion->mp, env->curr); if(!value && m_func) { - if(!m_func->def->base->ret_type) - CHECK_BO(traverse_func_def(env, m_func->def)) +printf("m_func %p\n", m_func); +if(!m_func->def->base->ret_type) +CHECK_BO(traverse_func_def(env, m_func->def)) map_set(&v->owner->info->type->map, (vtype)sym, (vtype)actual_type(m_func->value_ref->type)); - } +} } free_stmt(env->gwion->mp, stmt); } @@ -583,11 +587,15 @@ ANN static Type check_exp_call_template(const Env env, const Exp_Call *exp) { const Exp call = exp->func; const Exp args = exp->args; m_uint args_number = 0; +puts("here =="); DECL_OO(const Value, value, = nspc_lookup_value1(call->type->e->owner, insert_symbol(call->type->name))) +puts("after here =="); const m_uint type_number = get_type_number(value->d.func_ref->def->base->tmpl->list); +printf("%s func\n", __func__) ; Type_List tl[type_number]; ID_List list = value->d.func_ref->def->base->tmpl->list; while(list) { +printf("%s func\n", __func__) ; Arg_List arg = value->d.func_ref->def->base->args; Exp template_arg = args; while(arg && template_arg) { @@ -612,7 +620,7 @@ ANN static Type check_exp_call_template(const Env env, const Exp_Call *exp) { DECL_OO(const Func,func, = get_template_func(env, exp, value)) if(!func->def->base->ret_type) // template fptr CHECK_BO(traverse_func_def(env, func->def)) - return func->def->base->ret_type; + return func->def->base->ret_type; } ANN static m_bool check_exp_call1_check(const Env env, const Exp exp) { @@ -707,7 +715,11 @@ ANN static Type check_exp_call(const Env env, Exp_Call* exp) { CHECK_OO((exp->m_func = ret)) return ret->def->base->ret_type; } - return check_exp_call1(env, exp); + + const Type t = check_exp_call1(env, exp); +printf("here exp_call %p\n", t); +return t; +// return check_exp_call1(env, exp); } ANN static Type check_exp_unary(const Env env, const Exp_Unary* unary) { diff --git a/src/parse/scan1.c b/src/parse/scan1.c index ded15f44..2856ea9e 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -245,8 +245,8 @@ ANN static m_bool scan1_args(const Env env, Arg_List list) { ANN m_bool scan1_stmt_fptr(const Env env, const Stmt_Fptr stmt) { if(!stmt->type) CHECK_BB(scan0_stmt_fptr(env, stmt)) - if(stmt->base->tmpl) - return GW_OK; + if(stmt->base->tmpl)// + return GW_OK;// CHECK_OB((stmt->base->ret_type = known_type(env, stmt->base->td))) return stmt->base->args ? scan1_args(env, stmt->base->args) : GW_OK; } diff --git a/src/parse/scan2.c b/src/parse/scan2.c index 5b5fa989..2d0af075 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -93,7 +93,8 @@ ANN m_bool scan2_stmt_fptr(const Env env, const Stmt_Fptr ptr) { ptr->type->e->d.func = ptr->base->func; def->base->tmpl = ptr->base->tmpl; SET_FLAG(ptr->value, func | ae_flag_checked); - if(!ptr->base->tmpl && ptr->base->args) +if(!ptr->base->tmpl)// + if(ptr->base->args) CHECK_BB(scan2_args(env, def)) if(env->class_def) { if(GET_FLAG(ptr->base->td, global)) { diff --git a/src/plug.gcda b/src/plug.gcda index 8b664567..aa78ce69 100644 Binary files a/src/plug.gcda and b/src/plug.gcda differ diff --git a/src/plug.gcno b/src/plug.gcno index dc419866..de8f8a67 100644 Binary files a/src/plug.gcno and b/src/plug.gcno differ diff --git a/src/soundinfo.gcda b/src/soundinfo.gcda index ade055bc..66d3f7d2 100644 Binary files a/src/soundinfo.gcda and b/src/soundinfo.gcda differ diff --git a/src/soundinfo.gcno b/src/soundinfo.gcno index 56f21448..6c38817e 100644 Binary files a/src/soundinfo.gcno and b/src/soundinfo.gcno differ diff --git a/tests/import/driver.so b/tests/import/driver.so new file mode 100755 index 00000000..f286bf3b Binary files /dev/null and b/tests/import/driver.so differ diff --git a/tests/import/test.log b/tests/import/test.log index 8557b3a4..b584940e 100644 --- a/tests/import/test.log +++ b/tests/import/test.log @@ -11398,45 +11398,3 @@ global_func.gw ==22565== Memcheck, a memory error detector ==4349== ==4349== For counts of detected and suppressed errors, rerun with: -v ==4349== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) -/dev/null ==13821== Memcheck, a memory error detector -==13821== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. -==13821== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info -==13821== Command: ./../../gwion -p. -d dummy /dev/null -==13821== Parent PID: 13795 -==13821== -==13821== -==13821== HEAP SUMMARY: -==13821== in use at exit: 928 bytes in 10 blocks -==13821== total heap usage: 974 allocs, 964 frees, 7,596,796 bytes allocated -==13821== -==13821== LEAK SUMMARY: -==13821== definitely lost: 928 bytes in 10 blocks -==13821== indirectly lost: 0 bytes in 0 blocks -==13821== possibly lost: 0 bytes in 0 blocks -==13821== still reachable: 0 bytes in 0 blocks -==13821== suppressed: 0 bytes in 0 blocks -==13821== Rerun with --leak-check=full to see details of leaked memory -==13821== -==13821== For counts of detected and suppressed errors, rerun with: -v -==13821== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) -/dev/null ==14729== Memcheck, a memory error detector -==14729== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. -==14729== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info -==14729== Command: ./../../gwion -p. -d dummy /dev/null -==14729== Parent PID: 13795 -==14729== -==14729== -==14729== HEAP SUMMARY: -==14729== in use at exit: 576 bytes in 9 blocks -==14729== total heap usage: 956 allocs, 947 frees, 7,590,612 bytes allocated -==14729== -==14729== LEAK SUMMARY: -==14729== definitely lost: 576 bytes in 9 blocks -==14729== indirectly lost: 0 bytes in 0 blocks -==14729== possibly lost: 0 bytes in 0 blocks -==14729== still reachable: 0 bytes in 0 blocks -==14729== suppressed: 0 bytes in 0 blocks -==14729== Rerun with --leak-check=full to see details of leaked memory -==14729== -==14729== For counts of detected and suppressed errors, rerun with: -v -==14729== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/tests/tree/array_cast.gw b/tests/tree/array_cast.gw deleted file mode 100644 index 1b7c437c..00000000 --- a/tests/tree/array_cast.gw +++ /dev/null @@ -1,2 +0,0 @@ -typedef int[2] _int; -new _int $ _int; diff --git a/tests/tree/did_you_mean_type.gw b/tests/tree/did_you_mean_type.gw deleted file mode 100644 index 73b04597..00000000 --- a/tests/tree/did_you_mean_type.gw +++ /dev/null @@ -1,4 +0,0 @@ -class C { - <<>>; - int a; -} diff --git a/tests/tree/push_func.gw b/tests/tree/push_func.gw deleted file mode 100644 index 2f7957f6..00000000 --- a/tests/tree/push_func.gw +++ /dev/null @@ -1 +0,0 @@ -me.exit; diff --git a/tests/tree/reddit.gw b/tests/tree/reddit.gw deleted file mode 100644 index 9b4fd259..00000000 --- a/tests/tree/reddit.gw +++ /dev/null @@ -1,8 +0,0 @@ - -#! basic math printed out (note the space after '<<<' and before '>>>' -<<< 1 + 2 >>>; - -#! define and operator -operator $@+-*%~<>^&!= void (int i, int j) { <<< i, " ", j >>>; } - -1 $@+-*%~<>^&!= 2; diff --git a/tests/tree/template_fptr.gw b/tests/tree/template_fptr.gw deleted file mode 100644 index 3a130d9f..00000000 --- a/tests/tree/template_fptr.gw +++ /dev/null @@ -1,11 +0,0 @@ -typedef int ptr_t<~A~>(A); -ptr_t ptr; -<<>>; - -fun int test<~A~>(A a) { <<< a >>>; } -test @=> ptr; -<<< ptr >>>; -#!3; -#!3 => test; -ptr<~int~>(2); -ptr<~float~>(2.3);