Skip to content

Commit 9a858fe

Browse files
Resolve type of empty struct .{}
1 parent 957eb87 commit 9a858fe

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
@@ -2894,7 +2894,7 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, options: ResolveOptions) error
28942894
.struct_init_dot_two_comma,
28952895
.struct_init_dot,
28962896
.struct_init_dot_comma,
2897-
=> {},
2897+
=> return Type.fromIP(analyser, .empty_struct_type, .empty_aggregate),
28982898

28992899
.root,
29002900
.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)