}
ANN static m_bool cond_type(const Env env, const Exp e) {
+ if(e->next)
+ ERR_B(e->pos, "conditional must be a single expression")
const Type t = e->type;
if(isa(t, t_int) > 0)
return GW_OK;
CHECK_OB(parent)
if(parent == t_undefined)
return GW_OK;
+ Type t = parent;
+ while(t) {
+ if(cdef->base.type == t)
+ ERR_B(pos, "recursive (%s <= %s) class declaration.", cdef->base.type->name, t->name);
+ t = t->parent;
+ }
if(parent == cdef->base.type)
ERR_B(pos, "class '%s' cannot extend itself", cdef->base.type->name);
if(isa(cdef->base.type->parent, t_object) < 0)
--- /dev/null
+// [contains] recursive
+class C {}
+class D extends C {}
+class E extends F {}
+class F extends E {}
+class G extends C {}
+
+C c;
+D d;
+E e;
+F f;
+G g;
+<<<f $ D>>>;
+<<< [ f, g ] >>>;
+<<<maybe ? f : D>>>;
+<<<c, " ", d, " ", e, " ", g>>>;