2017-03-26 08:39:18 +01:00
|
|
|
const assert = @import("std").debug.assert;
|
|
|
|
|
2018-10-15 14:51:15 +01:00
|
|
|
const A = struct.{
|
2017-03-26 08:39:18 +01:00
|
|
|
b: B,
|
|
|
|
};
|
|
|
|
|
2018-10-15 14:51:15 +01:00
|
|
|
const B = struct.{
|
2017-03-26 08:39:18 +01:00
|
|
|
c: C,
|
|
|
|
};
|
|
|
|
|
2018-10-15 14:51:15 +01:00
|
|
|
const C = struct.{
|
2017-03-26 08:39:18 +01:00
|
|
|
x: i32,
|
|
|
|
|
2018-05-31 15:56:59 +01:00
|
|
|
fn d(c: *const C) i32 {
|
2017-03-26 08:39:18 +01:00
|
|
|
return c.x;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-10-15 23:23:47 +01:00
|
|
|
fn foo(a: A) i32 {
|
2017-03-26 08:39:18 +01:00
|
|
|
return a.b.c.d();
|
|
|
|
}
|
|
|
|
|
|
|
|
test "incomplete struct param top level declaration" {
|
2018-10-15 14:51:15 +01:00
|
|
|
const a = A.{
|
|
|
|
.b = B.{
|
|
|
|
.c = C.{ .x = 13 },
|
2017-03-26 08:39:18 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
assert(foo(a) == 13);
|
|
|
|
}
|