From 3cbfd977fcc71276fd776a3a5713aa914b73af6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 7 Dec 2020 22:01:16 +0100 Subject: [PATCH] :art: Allow abstract ctor --- src/parse/scan1.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 -- 2.43.0