Skip to content

Commit 432db35

Browse files
Resolve type of empty struct .{}
1 parent 9ef916c commit 432db35

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/analysis.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,7 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, options: ResolveOptions) error
27802780
.struct_init_dot_two_comma,
27812781
.struct_init_dot,
27822782
.struct_init_dot_comma,
2783-
=> {},
2783+
=> return Type.fromIP(analyser, .empty_struct_type, .empty_aggregate),
27842784

27852785
.root,
27862786
.test_decl,

tests/analysis/container.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const empty_struct = .{};
2+
// ^^^^^^^^^^^^ (@TypeOf(.{}))(.{})
3+
14
const Foo = struct {
25
foo: i32 = 0,
36
const bar: i64 = 0;

0 commit comments

Comments
 (0)