2017-03-26 00:39:18 -07:00
|
|
|
const assert = @import("std").debug.assert;
|
|
|
|
|
|
|
|
const A = struct {
|
|
|
|
b: B,
|
|
|
|
};
|
|
|
|
|
|
|
|
const B = struct {
|
|
|
|
c: C,
|
|
|
|
};
|
|
|
|
|
|
|
|
const C = struct {
|
|
|
|
x: i32,
|
|
|
|
|
2018-01-25 01:10:11 -08:00
|
|
|
fn d(c: &const C) i32 {
|
2017-03-26 00:39:18 -07:00
|
|
|
return c.x;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-01-25 01:10:11 -08:00
|
|
|
fn foo(a: &const A) i32 {
|
2017-03-26 00:39:18 -07:00
|
|
|
return a.b.c.d();
|
|
|
|
}
|
|
|
|
|
|
|
|
test "incomplete struct param top level declaration" {
|
|
|
|
const a = A {
|
|
|
|
.b = B {
|
|
|
|
.c = C {
|
|
|
|
.x = 13,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
assert(foo(a) == 13);
|
|
|
|
}
|