From: fennecdjay Date: Sun, 20 Oct 2019 14:49:42 +0000 (+0200) Subject: :art: Set ref flag on auto abstract types X-Git-Tag: nightly~2121 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=84a1d5b1fef77b4de12deb5ae96413153f5554d0;p=gwion.git :art: Set ref flag on auto abstract types --- diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 7c96c839..50c2f1f5 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -82,8 +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)) - ERR_B(exp_self(decl)->pos, _("Type '%s' is abstract, declare as ref. (use @)"), t->name) + } else if(GET_FLAG(t, abstract) && !GET_FLAG(decl->td, ref)) { + if(decl->td->xid && decl->td->xid->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(env->class_def) type_contains(env->class_def, t); const Value v = var->value = former ?: new_value(env->gwion->mp, t, s_name(var->xid)); diff --git a/tests/tree/auto_ref.gw b/tests/tree/auto_ref.gw new file mode 100644 index 00000000..cd46a74b --- /dev/null +++ b/tests/tree/auto_ref.gw @@ -0,0 +1 @@ +me @=> auto a;