32 lines
475 B
Plaintext
32 lines
475 B
Plaintext
/* should parse & type check. */
|
|
|
|
type T
|
|
{
|
|
int x;
|
|
int y;
|
|
int get_x();
|
|
}
|
|
|
|
class BaseCls() : T impl T
|
|
{
|
|
init int x;
|
|
init int y;
|
|
int get_x() { x; }
|
|
export T : x, y, get_x;
|
|
}
|
|
|
|
mixin mx() : T at T impl T with int x
|
|
{
|
|
init int z;
|
|
super(x = 3);
|
|
export T : z as x, y as y, get_x as get_x;
|
|
}
|
|
|
|
subclass DerivedCls = mx(BaseCls);
|
|
|
|
int main() {
|
|
T t = new DerivedCls : T (y = 4, z = 5);
|
|
|
|
t.get_x() + t.x + t.y; // should evaluate to 12
|
|
}
|