From: Jérémie Astor Date: Mon, 7 Dec 2020 21:01:16 +0000 (+0100) Subject: :art: Allow abstract ctor X-Git-Tag: nightly~1116 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3cbfd977fcc71276fd776a3a5713aa914b73af6d;p=gwion.git :art: Allow abstract ctor --- diff --git a/src/parse/scan1.c b/src/parse/scan1.c index dfc8b355..b1a213ea 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -82,10 +82,12 @@ ANN static m_bool scan1_decl(const Env env, const Exp_Decl* decl) { CHECK_BB(scan1_exp(env, var->array->exp)) t = array_type(env, decl->type, var->array->depth); } else if(GET_FLAG(t, abstract) && !GET_FLAG(decl->td, ref)) { - if(decl->td->xid == insert_symbol("auto")) - SET_FLAG(decl->td, ref); - else - ERR_B(exp_self(decl)->pos, _("Type '%s' is abstract, declare as ref. (use @)"), t->name) + if(!(t == env->class_def && env->scope->depth)) { + if(decl->td->xid == insert_symbol("auto")) + SET_FLAG(decl->td, ref); + else + ERR_B(exp_self(decl)->pos, _("Type '%s' is abstract, declare as ref. (use @)"), t->name) + } } const Value v = var->value = var->value ?: new_value(env->gwion->mp, t, s_name(var->xid)); // rewrite logic