-Subproject commit 7fa0a948f67335204cab7b72e4837b99699c2d32
+Subproject commit 3cdb9feede115e9c1728ebc93d6de7d08f0e7891
// if (eff && !check_effect_overload(eff, func))
// ERR_N(impl->pos, _("`{+Y}%s{0}` has effects not present in `{+G}%s{0}`\n"),
// s_name(impl->e->d.prim.d.var), func->name);
- Value v = nspc_lookup_value0(opi.nspc, impl->e->d.prim.d.var);
+ const Value v = nspc_lookup_value0(opi.nspc, impl->e->d.prim.d.var);
if (v) {
const m_uint scope = env_push(env, NULL, opi.nspc);
_lhs.next = &_rhs;
self->d.exp_call.tmpl = NULL;
self->exp_type = ae_exp_call;
CHECK_BN(traverse_exp(env, self));
+ const Type tbase = func->type->info->value->from->owner_class;
+ if(!tflag(base->type, tflag_union) && tbase != base->type)
+ ERR_N(base->pos, "'%s' has no matching constructor", base->type->name);
return self->type;
}
if (GET_FLAG(t, abstract) &&
ANN static m_bool recursive_type_base(const Env env, const Type t);
ANN static bool recursive_type(const Env env, const Type t, const Type tgt);
ANN static bool recursive_value(const Env env, const Type t, const Value v) {
-//if(!v->from->owner_class)exit(13);
const Type tgt = array_base(v->type);
if(type_is_recurs(t, tgt)) {
env_err(env, v->from->loc, _("recursive type"));
if (cflag(cdef, cflag_struct) || class_def_has_body(env, cdef->body))
set_tflag(t, tflag_ctor);
}
+ if(t->info->parent->nspc && nspc_lookup_value0(t->info->parent->nspc, insert_symbol("new")) && !nspc_lookup_value0(t->nspc, insert_symbol("new"))) {
+ env_err(env, cdef->pos, "must define 'new' operator");
+ env_warn(env, t->info->parent->info->value->from->loc, "defined here");
+ return GW_ERROR;
+ }
if (!GET_FLAG(cdef, abstract)) CHECK_BB(check_abstract(env, cdef));
if (cdef->traits) {
ID_List list = cdef->traits;
if(!strcmp(s_name(fdef->base->xid), "new")) {
if(!env->class_def)
ERR_B(fdef->base->pos, _("{G+}new{0} operator must be set inside {C+}class{0}"));
+ SET_FLAG(env->class_def, abstract);
if(!fdef->base->ret_type)
// fdef->base->ret_type = env->class_def;
fdef->base->ret_type = env->gwion->type[et_auto];
--- /dev/null
+#! [contains] must define 'new' operator
+class C {
+ operator new() {}
+}
+class D extends C {}
+<<< "lol" >>>;
--- /dev/null
+class baseClass {}
+
+class childClass extends baseClass {
+ "test" => var string param;
+}
+
+class testClass {
+ var static baseClass classHolder;
+}
+
+var testClass tc;
+
+var childClass cc => tc.classHolder;
+<<< cc.param >>>;