zig/test/cases/incomplete_struct_param_tld.zig
Jimmi Holst Christensen 8139c5a516
New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00

31 lines
410 B
Zig

const assert = @import("std").debug.assert;
const A = struct {
b: B,
};
const B = struct {
c: C,
};
const C = struct {
x: i32,
fn d(c: *const C) i32 {
return c.x;
}
};
fn foo(a: A) i32 {
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);
}