Skip to content

Commit e487184

Browse files
committed
Supports lowering the empty tuple without a result type
1 parent 2c85b06 commit e487184

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Sema/LowerZon.zig

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,21 @@ fn lowerExprAnonResTy(self: *LowerZon, node: Zoir.Node.Index) CompileError!Inter
103103
const result = try self.sema.addStrLit(ip_str, val.len);
104104
return result.toInterned().?;
105105
},
106-
.empty_literal, .array_literal, .struct_literal => @panic("unimplemented"),
106+
.empty_literal => {
107+
const ty = try ip.getTupleType(
108+
gpa,
109+
self.sema.pt.tid,
110+
.{
111+
.types = &.{},
112+
.values = &.{},
113+
},
114+
);
115+
return self.sema.pt.intern(.{ .aggregate = .{
116+
.ty = ty,
117+
.storage = .{ .elems = &.{} },
118+
} });
119+
},
120+
.array_literal, .struct_literal => @panic("unimplemented"),
107121
}
108122
}
109123

0 commit comments

Comments
 (0)