const Class_Def cdef = new_class_def(env->gwion->mp, flag, tdef->xid,
cpy_type_decl(env->gwion->mp, tdef->ext),
NULL, tdef->ext->pos);
+ const bool final = GET_FLAG(base, final);
+ if(final) UNSET_FLAG(base, final);
CHECK_BB(scan0_class_def(env, cdef));
tdef->type = cdef->base.type;
cdef->base.tmpl = tdef->tmpl; // check cpy
set_tflag(tdef->type, tflag_cdef);
+ if(final) SET_FLAG(base, final);
mk_class(env, tdef->type, tdef->pos);
return GW_OK;
}
if (cdef->base.ext->array && cdef->base.ext->array->exp)
CHECK_BB(scan1_exp(env, cdef->base.ext->array->exp));
DECL_OB(const Type, parent, = scan1_get_parent(env, &cdef->base));
- if (isa(parent, env->gwion->type[et_object]) < 0)
+ if (isa(parent, env->gwion->type[et_object]) < 0 &&
+ !(tflag(cdef->base.type, tflag_cdef) || tflag(cdef->base.type, tflag_udef)))
ERR_B(pos, _("cannot extend primitive type '%s'"), parent->name)
CHECK_BB(ensure_scan1(env, parent));
if (type_ref(parent)) ERR_B(pos, _("can't use ref type in class extend"))