From: fennecdjay Date: Thu, 8 Dec 2022 13:33:37 +0000 (+0100) Subject: :art: proper constructor checking wrt super X-Git-Tag: nightly~207^2~55 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e3b797d550c2313b754b63640a5d9c7990206dda;p=gwion.git :art: proper constructor checking wrt super --- diff --git a/src/parse/check.c b/src/parse/check.c index fe356397..d6844c69 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1817,10 +1817,17 @@ ANN m_bool check_fdef(const Env env, const Func_Def fdef) { ANN static m_bool check_ctor(const Env env, const Func func) { if(!func->def->builtin && !GET_FLAG(func, const)) { - const Value v = nspc_lookup_value0(env->class_def->info->parent->nspc, insert_symbol("new")); - if(v && !GET_FLAG(v, abstract)) - ERR_B(func->def->base->pos, "missing call to parent constructor"); + const Type_Decl *td = env->class_def->info->cdef->base.ext; + const m_uint depth = !td || !td->array + ? 1 : td->array->exp->d.prim.d.num; + if(depth) { // check if size is 0 + const Type parent = env->class_def->info->parent; + const Value v = nspc_lookup_value0(parent->nspc, insert_symbol("new")); + if(v && !GET_FLAG(v->d.func_ref->def->base, abstract)) + ERR_B(func->def->base->pos, "missing call to parent constructor"); + } } + return GW_OK; }