From f7f3aa7d7b5df1fef2509b78a9292a405e72a1a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 25 Apr 2022 21:43:38 +0200 Subject: [PATCH] :bug: Global types must extends global types --- src/parse/scan0.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.43.0