mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
AstGen: make @compileError operand implicitly comptime
This matches the language reference.
This commit is contained in:
parent
1310ef7577
commit
92f1a29c40
@ -177,7 +177,7 @@ fn printLiteral(out: anytype, val: anytype, indent: u8) !void {
|
||||
.Float,
|
||||
.Null,
|
||||
=> try out.print("{any}", .{val}),
|
||||
else => @compileError(comptime std.fmt.comptimePrint("`{s}` are not yet supported as build options", .{@tagName(@typeInfo(T))})),
|
||||
else => @compileError(std.fmt.comptimePrint("`{s}` are not yet supported as build options", .{@tagName(@typeInfo(T))})),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ pub fn format(
|
||||
switch (missing_count) {
|
||||
0 => unreachable,
|
||||
1 => @compileError("unused argument in '" ++ fmt ++ "'"),
|
||||
else => @compileError((comptime comptimePrint("{d}", .{missing_count})) ++ " unused arguments in '" ++ fmt ++ "'"),
|
||||
else => @compileError(comptimePrint("{d}", .{missing_count}) ++ " unused arguments in '" ++ fmt ++ "'"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -765,7 +765,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
|
||||
}
|
||||
const expected_args_tuple_len = fn_args_fields.len - 1;
|
||||
if (extra_args.len != expected_args_tuple_len) {
|
||||
@compileError("The provided function expects " ++ (comptime std.fmt.comptimePrint("{d}", .{expected_args_tuple_len})) ++ " extra arguments, but the provided tuple contains " ++ (comptime std.fmt.comptimePrint("{d}", .{extra_args.len})));
|
||||
@compileError("The provided function expects " ++ std.fmt.comptimePrint("{d}", .{expected_args_tuple_len}) ++ " extra arguments, but the provided tuple contains " ++ std.fmt.comptimePrint("{d}", .{extra_args.len}));
|
||||
}
|
||||
|
||||
// Setup the tuple that will actually be used with @call (we'll need to insert
|
||||
|
||||
@ -8455,8 +8455,12 @@ fn simpleUnOp(
|
||||
operand_node: Ast.Node.Index,
|
||||
tag: Zir.Inst.Tag,
|
||||
) InnerError!Zir.Inst.Ref {
|
||||
const prev_force_comptime = gz.force_comptime;
|
||||
defer gz.force_comptime = prev_force_comptime;
|
||||
|
||||
switch (tag) {
|
||||
.tag_name, .error_name, .ptr_to_int => try emitDbgNode(gz, node),
|
||||
.compile_error => gz.force_comptime = true,
|
||||
else => {},
|
||||
}
|
||||
const operand = try expr(gz, scope, operand_ri, operand_node);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user