+ prepare("initargs, inheritance");
+ { SOD_DECL(T2Sub, t, KWARGS(K(c, 1) K(z, 2)));
+ if (t->t2.x == 1) STEP(0);
+ DONE(1);
+ }
+ prepare("initargs, ordering");
+ { SOD_DECL(T2Sub, t, KWARGS(K(a, 1) K(b, 2)));
+ if (t->t2.x == 1) STEP(0);
+ DONE(1);
+ }
+ prepare("initargs, reprioritizing");
+ { SOD_DECL(T2Sub, t, KWARGS(K(x, 1) K(c, 2)));
+ if (t->t2.x == 1) STEP(0);
+ DONE(1);
+ }
+}
+
+/*----- Keyword argument propagation --------------------------------------*/
+
+[link = SodObject, nick = base]
+class T3Base: SodObject {
+ void m0(?int x) { STEP(x); }
+ void m1(?) { }
+}
+
+[link = T3Base, nick = mid]
+class T3Mid: T3Base {
+ void base.m0(?int y) { STEP(y); CALL_NEXT_METHOD; }
+ void base.m1(?) { STEP(4); CALL_NEXT_METHOD; }
+}
+
+[link = T3Mid, nick = sub]
+class T3Sub: T3Mid {
+ void base.m0(?int z) { STEP(z); CALL_NEXT_METHOD; }
+ void base.m1(?int z) { STEP(z); CALL_NEXT_METHOD; }
+}
+
+code c: tests {
+ prepare("kwargs");
+ { SOD_DECL(T3Sub, t, NO_KWARGS);
+ T3Base_m0(t, KWARGS(K(z, 0) K(y, 1) K(x, 2)));
+ T3Base_m1(t, KWARGS(K(z, 3)));
+ DONE(5);
+ }
+}
+
+/*----- Metaclass initialization ------------------------------------------*/
+
+[link = SodClass, nick = mycls]
+class MyClass: SodClass {
+ int x = -1, y, z = 2;
+}
+
+[nick = myobj, metaclass = MyClass]
+class MyObject: SodObject {
+ class mycls.x = 0, mycls.y = 1;
+}
+
+code c: tests {
+ prepare("metaclass, init");
+ STEP(MyObject__cls_obj->mycls.x);
+ STEP(MyObject__cls_obj->mycls.y);
+ STEP(MyObject__cls_obj->mycls.z);
+ DONE(3);
+}
+
+/*----- Static instances --------------------------------------------------*/
+
+[link = SodObject, nick = st]
+class StaticObject: SodObject {
+ int x, y = 2, z = 3;
+ [readonly = t] void step() { STEP(me->st.x); }
+}
+
+[extern = t] instance StaticObject mystatic: st.x = 0, st.z = 69;
+[const = nil] instance StaticObject otherstatic: st.x = 3, st.y = 42;
+
+code c: tests {
+ prepare("static instance");
+ StaticObject_step(mystatic);
+ if (mystatic->st.y == 2) STEP(1);
+ if (mystatic->st.z == 69) STEP(2);
+ StaticObject_step(otherstatic);
+ if (otherstatic->st.y == 42) STEP(4);
+ if (otherstatic->st.z == 3) STEP(5);
+ DONE(6);