From: Jérémie Astor Date: Mon, 25 Apr 2022 19:43:38 +0000 (+0200) Subject: :bug: Global types must extends global types X-Git-Tag: nightly~275^2~44 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=f7f3aa7d7b5df1fef2509b78a9292a405e72a1a6;p=gwion.git :bug: Global types must extends global types --- diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 72609356..32c186ec 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -351,6 +351,13 @@ ANN static Type scan0_class_def_init(const Env env, const Class_Def cdef) { CHECK_BO(scan0_defined(env, cdef->base.xid, cdef->pos)); const Type parent = cdef_parent(env, cdef); if (parent == (Type)GW_ERROR) return NULL; + if(GET_FLAG(cdef, global) && !type_global(env, parent)) { + gwerr_basic(_("parent type is not global"), NULL, NULL, env->name, cdef->base.ext ? cdef->base.ext->pos : cdef->base.pos, 0); + const Value v = parent->info->value; + gwerr_warn("declared here", NULL, NULL, v->from->filename, v->from->loc); + env->context->error = true; + return NULL; + } //if(parent) type_addref(parent); if (cdef->traits) CHECK_BO(find_traits(env, cdef->traits, cdef->pos)); const Type t = scan0_type(env, s_name(cdef->base.xid), parent);