authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-06-03 15:24:58+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-06-03 15:24:58+03:00
log019537cb2a447fc28365685e71d323092e1830b0
tree0a82f3a9b151ed2072f94383690e4eec4f561527
parent8f45e81c840c79097850bb87bbee1303e6d87dd4

Sema: `@sizeOf` function should give an error


2 files changed, 11 insertions(+), 3 deletions(-)

src/Sema.zig+1-1
......@@ -11547,7 +11547,7 @@ fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1154711547 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
1154811548 const ty = try sema.resolveType(block, operand_src, inst_data.operand);
1154911549 switch (ty.zigTypeTag()) {
11550 .Fn => unreachable,
11550 .Fn,
1155111551 .NoReturn,
1155211552 .Undefined,
1155311553 .Null,
src/type.zig+10-2
......@@ -2035,7 +2035,11 @@ pub const Type = extern union {
20352035 try writer.writeAll("fn(");
20362036 for (fn_info.param_types) |param_ty, i| {
20372037 if (i != 0) try writer.writeAll(", ");
2038 try print(param_ty, writer, mod);
2038 if (param_ty.tag() == .generic_poison) {
2039 try writer.writeAll("anytype");
2040 } else {
2041 try print(param_ty, writer, mod);
2042 }
20392043 }
20402044 if (fn_info.is_var_args) {
20412045 if (fn_info.param_types.len != 0) {
......@@ -2052,7 +2056,11 @@ pub const Type = extern union {
20522056 if (fn_info.alignment != 0) {
20532057 try writer.print("align({d}) ", .{fn_info.alignment});
20542058 }
2055 try print(fn_info.return_type, writer, mod);
2059 if (fn_info.return_type.tag() == .generic_poison) {
2060 try writer.writeAll("anytype");
2061 } else {
2062 try print(fn_info.return_type, writer, mod);
2063 }
20562064 },
20572065
20582066 .error_union => {