authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-10-05 20:58:23+02:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-10-05 21:19:30+02:00
log51d9db856978610c24b3fed50a9550455a2eb64b
tree90c73872df36318779a8e23682d2d7b774ad5e19
parent654e0b6679f3436bacbf685223d6ab68f707a62f

fix(text): hyphenate "comptime" adjectives


29 files changed, 157 insertions(+), 157 deletions(-)

lib/std/enums.zig+1-1
...@@ -696,7 +696,7 @@ pub fn IndexedArray(comptime I: type, comptime V: type, comptime Ext: fn (type)...@@ -696,7 +696,7 @@ pub fn IndexedArray(comptime I: type, comptime V: type, comptime Ext: fn (type)
696}696}
697697
698/// Verifies that a type is a valid Indexer, providing a helpful698/// Verifies that a type is a valid Indexer, providing a helpful
699/// compile error if not. An Indexer maps a comptime known set699/// compile error if not. An Indexer maps a comptime-known set
700/// of keys to a dense set of zero-based indices.700/// of keys to a dense set of zero-based indices.
701/// The indexer interface must look like this:701/// The indexer interface must look like this:
702/// ```702/// ```
lib/std/fmt.zig+1-1
...@@ -29,7 +29,7 @@ pub const FormatOptions = struct {...@@ -29,7 +29,7 @@ pub const FormatOptions = struct {
29/// If `writer` returns an error, the error is returned from `format` and29/// If `writer` returns an error, the error is returned from `format` and
30/// `writer` is not called again.30/// `writer` is not called again.
31///31///
32/// The format string must be comptime known and may contain placeholders following32/// The format string must be comptime-known and may contain placeholders following
33/// this format:33/// this format:
34/// `{[argument][specifier]:[fill][alignment][width].[precision]}`34/// `{[argument][specifier]:[fill][alignment][width].[precision]}`
35///35///
src/Module.zig+1-1
...@@ -4584,7 +4584,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {...@@ -4584,7 +4584,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {
4584 const decl_linksection: ?[*:0]const u8 = blk: {4584 const decl_linksection: ?[*:0]const u8 = blk: {
4585 const linksection_ref = decl.zirLinksectionRef();4585 const linksection_ref = decl.zirLinksectionRef();
4586 if (linksection_ref == .none) break :blk null;4586 if (linksection_ref == .none) break :blk null;
4587 const bytes = try sema.resolveConstString(&block_scope, section_src, linksection_ref, "linksection must be comptime known");4587 const bytes = try sema.resolveConstString(&block_scope, section_src, linksection_ref, "linksection must be comptime-known");
4588 if (mem.indexOfScalar(u8, bytes, 0) != null) {4588 if (mem.indexOfScalar(u8, bytes, 0) != null) {
4589 return sema.fail(&block_scope, section_src, "linksection cannot contain null bytes", .{});4589 return sema.fail(&block_scope, section_src, "linksection cannot contain null bytes", .{});
4590 } else if (bytes.len == 0) {4590 } else if (bytes.len == 0) {
src/Sema.zig+110-110
...@@ -50,7 +50,7 @@ comptime_break_inst: Zir.Inst.Index = undefined,...@@ -50,7 +50,7 @@ comptime_break_inst: Zir.Inst.Index = undefined,
50src: LazySrcLoc = .{ .token_offset = 0 },50src: LazySrcLoc = .{ .token_offset = 0 },
51decl_val_table: std.AutoHashMapUnmanaged(Decl.Index, Air.Inst.Ref) = .{},51decl_val_table: std.AutoHashMapUnmanaged(Decl.Index, Air.Inst.Ref) = .{},
52/// When doing a generic function instantiation, this array collects a52/// When doing a generic function instantiation, this array collects a
53/// `Value` object for each parameter that is comptime known and thus elided53/// `Value` object for each parameter that is comptime-known and thus elided
54/// from the generated function. This memory is allocated by a parent `Sema` and54/// from the generated function. This memory is allocated by a parent `Sema` and
55/// owned by the values arena of the Sema owner_decl.55/// owned by the values arena of the Sema owner_decl.
56comptime_args: []TypedValue = &.{},56comptime_args: []TypedValue = &.{},
...@@ -1351,7 +1351,7 @@ fn analyzeBodyInner(...@@ -1351,7 +1351,7 @@ fn analyzeBodyInner(
1351 const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index);1351 const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index);
1352 const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len];1352 const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len];
1353 const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];1353 const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];
1354 const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime known");1354 const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime-known");
1355 const inline_body = if (cond.val.toBool()) then_body else else_body;1355 const inline_body = if (cond.val.toBool()) then_body else else_body;
13561356
1357 try sema.maybeErrorUnwrapCondbr(block, inline_body, extra.data.condition, cond_src);1357 try sema.maybeErrorUnwrapCondbr(block, inline_body, extra.data.condition, cond_src);
...@@ -1369,7 +1369,7 @@ fn analyzeBodyInner(...@@ -1369,7 +1369,7 @@ fn analyzeBodyInner(
1369 const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index);1369 const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index);
1370 const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len];1370 const then_body = sema.code.extra[extra.end..][0..extra.data.then_body_len];
1371 const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];1371 const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];
1372 const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime known");1372 const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime-known");
1373 const inline_body = if (cond.val.toBool()) then_body else else_body;1373 const inline_body = if (cond.val.toBool()) then_body else else_body;
1374 const old_runtime_index = block.runtime_index;1374 const old_runtime_index = block.runtime_index;
1375 defer block.runtime_index = old_runtime_index;1375 defer block.runtime_index = old_runtime_index;
...@@ -1391,7 +1391,7 @@ fn analyzeBodyInner(...@@ -1391,7 +1391,7 @@ fn analyzeBodyInner(
1391 const err_union = try sema.resolveInst(extra.data.operand);1391 const err_union = try sema.resolveInst(extra.data.operand);
1392 const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union);1392 const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union);
1393 assert(is_non_err != .none);1393 assert(is_non_err != .none);
1394 const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime known");1394 const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime-known");
1395 if (is_non_err_tv.val.toBool()) {1395 if (is_non_err_tv.val.toBool()) {
1396 const err_union_ty = sema.typeOf(err_union);1396 const err_union_ty = sema.typeOf(err_union);
1397 break :blk try sema.analyzeErrUnionPayload(block, src, err_union_ty, err_union, operand_src, false);1397 break :blk try sema.analyzeErrUnionPayload(block, src, err_union_ty, err_union, operand_src, false);
...@@ -1447,7 +1447,7 @@ fn analyzeBodyInner(...@@ -1447,7 +1447,7 @@ fn analyzeBodyInner(
1447 const err_union = try sema.analyzeLoad(block, src, operand, operand_src);1447 const err_union = try sema.analyzeLoad(block, src, operand, operand_src);
1448 const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union);1448 const is_non_err = try sema.analyzeIsNonErrComptimeOnly(block, operand_src, err_union);
1449 assert(is_non_err != .none);1449 assert(is_non_err != .none);
1450 const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime known");1450 const is_non_err_tv = try sema.resolveInstConst(block, operand_src, is_non_err, "try operand inside comptime block must be comptime-known");
1451 if (is_non_err_tv.val.toBool()) {1451 if (is_non_err_tv.val.toBool()) {
1452 break :blk try sema.analyzeErrUnionPayloadPtr(block, src, operand, false, false);1452 break :blk try sema.analyzeErrUnionPayloadPtr(block, src, operand, false, false);
1453 }1453 }
...@@ -1592,7 +1592,7 @@ fn analyzeAsType(...@@ -1592,7 +1592,7 @@ fn analyzeAsType(
1592) !Type {1592) !Type {
1593 const wanted_type = Type.initTag(.@"type");1593 const wanted_type = Type.initTag(.@"type");
1594 const coerced_inst = try sema.coerce(block, wanted_type, air_inst, src);1594 const coerced_inst = try sema.coerce(block, wanted_type, air_inst, src);
1595 const val = try sema.resolveConstValue(block, src, coerced_inst, "types must be comptime known");1595 const val = try sema.resolveConstValue(block, src, coerced_inst, "types must be comptime-known");
1596 var buffer: Value.ToTypeBuffer = undefined;1596 var buffer: Value.ToTypeBuffer = undefined;
1597 const ty = val.toType(&buffer);1597 const ty = val.toType(&buffer);
1598 return ty.copy(sema.arena);1598 return ty.copy(sema.arena);
...@@ -2037,7 +2037,7 @@ fn analyzeAsAlign(...@@ -2037,7 +2037,7 @@ fn analyzeAsAlign(
2037 src: LazySrcLoc,2037 src: LazySrcLoc,
2038 air_ref: Air.Inst.Ref,2038 air_ref: Air.Inst.Ref,
2039) !u32 {2039) !u32 {
2040 const alignment_big = try sema.analyzeAsInt(block, src, air_ref, align_ty, "alignment must be comptime known");2040 const alignment_big = try sema.analyzeAsInt(block, src, air_ref, align_ty, "alignment must be comptime-known");
2041 const alignment = @intCast(u32, alignment_big); // We coerce to u16 in the prev line.2041 const alignment = @intCast(u32, alignment_big); // We coerce to u16 in the prev line.
2042 try sema.validateAlign(block, src, alignment);2042 try sema.validateAlign(block, src, alignment);
2043 return alignment;2043 return alignment;
...@@ -2711,7 +2711,7 @@ fn zirEnumDecl(...@@ -2711,7 +2711,7 @@ fn zirEnumDecl(
2711 // TODO: if we need to report an error here, use a source location2711 // TODO: if we need to report an error here, use a source location
2712 // that points to this default value expression rather than the struct.2712 // that points to this default value expression rather than the struct.
2713 // But only resolve the source location if we need to emit a compile error.2713 // But only resolve the source location if we need to emit a compile error.
2714 const tag_val = (try sema.resolveInstConst(block, src, tag_val_ref, "enum tag value must be comptime known")).val;2714 const tag_val = (try sema.resolveInstConst(block, src, tag_val_ref, "enum tag value must be comptime-known")).val;
2715 last_tag_val = tag_val;2715 last_tag_val = tag_val;
2716 const copied_tag_val = try tag_val.copy(decl_arena_allocator);2716 const copied_tag_val = try tag_val.copy(decl_arena_allocator);
2717 const gop_val = enum_obj.values.getOrPutAssumeCapacityContext(copied_tag_val, .{2717 const gop_val = enum_obj.values.getOrPutAssumeCapacityContext(copied_tag_val, .{
...@@ -3202,7 +3202,7 @@ fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro...@@ -3202,7 +3202,7 @@ fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
3202 var ptr_info = alloc_ty.ptrInfo().data;3202 var ptr_info = alloc_ty.ptrInfo().data;
3203 const elem_ty = ptr_info.pointee_type;3203 const elem_ty = ptr_info.pointee_type;
32043204
3205 // Detect if all stores to an `.alloc` were comptime known.3205 // Detect if all stores to an `.alloc` were comptime-known.
3206 ct: {3206 ct: {
3207 var search_index: usize = block.instructions.items.len;3207 var search_index: usize = block.instructions.items.len;
3208 const air_tags = sema.air_instructions.items(.tag);3208 const air_tags = sema.air_instructions.items(.tag);
...@@ -3419,7 +3419,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com...@@ -3419,7 +3419,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
3419 if (var_is_mut) {3419 if (var_is_mut) {
3420 try sema.validateVarType(block, ty_src, final_elem_ty, false);3420 try sema.validateVarType(block, ty_src, final_elem_ty, false);
3421 } else ct: {3421 } else ct: {
3422 // Detect if the value is comptime known. In such case, the3422 // Detect if the value is comptime-known. In such case, the
3423 // last 3 AIR instructions of the block will look like this:3423 // last 3 AIR instructions of the block will look like this:
3424 //3424 //
3425 // %a = constant3425 // %a = constant
...@@ -4326,7 +4326,7 @@ fn zirValidateDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr...@@ -4326,7 +4326,7 @@ fn zirValidateDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
4326 const msg = try sema.errMsg(4326 const msg = try sema.errMsg(
4327 block,4327 block,
4328 src,4328 src,
4329 "values of type '{}' must be comptime known, but operand value is runtime known",4329 "values of type '{}' must be comptime-known, but operand value is runtime known",
4330 .{elem_ty.fmt(sema.mod)},4330 .{elem_ty.fmt(sema.mod)},
4331 );4331 );
4332 errdefer msg.destroy(sema.gpa);4332 errdefer msg.destroy(sema.gpa);
...@@ -4540,13 +4540,13 @@ fn storeToInferredAllocComptime(...@@ -4540,13 +4540,13 @@ fn storeToInferredAllocComptime(
4540 return;4540 return;
4541 }4541 }
45424542
4543 return sema.failWithNeededComptime(block, src, "value being stored to a comptime variable must be comptime known");4543 return sema.failWithNeededComptime(block, src, "value being stored to a comptime variable must be comptime-known");
4544}4544}
45454545
4546fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {4546fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {
4547 const inst_data = sema.code.instructions.items(.data)[inst].un_node;4547 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
4548 const src = inst_data.src();4548 const src = inst_data.src();
4549 const quota = @intCast(u32, try sema.resolveInt(block, src, inst_data.operand, Type.u32, "eval branch quota must be comptime known"));4549 const quota = @intCast(u32, try sema.resolveInt(block, src, inst_data.operand, Type.u32, "eval branch quota must be comptime-known"));
4550 sema.branch_quota = @maximum(sema.branch_quota, quota);4550 sema.branch_quota = @maximum(sema.branch_quota, quota);
4551}4551}
45524552
...@@ -4699,7 +4699,7 @@ fn zirCompileError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro...@@ -4699,7 +4699,7 @@ fn zirCompileError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
4699 const inst_data = sema.code.instructions.items(.data)[inst].un_node;4699 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
4700 const src = inst_data.src();4700 const src = inst_data.src();
4701 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };4701 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
4702 const msg = try sema.resolveConstString(block, operand_src, inst_data.operand, "compile error string must be comptime known");4702 const msg = try sema.resolveConstString(block, operand_src, inst_data.operand, "compile error string must be comptime-known");
4703 return sema.fail(block, src, "{s}", .{msg});4703 return sema.fail(block, src, "{s}", .{msg});
4704}4704}
47054705
...@@ -5146,7 +5146,7 @@ fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -5146,7 +5146,7 @@ fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
5146 const src = inst_data.src();5146 const src = inst_data.src();
5147 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };5147 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
5148 const options_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };5148 const options_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };
5149 const operand = try sema.resolveInstConst(block, operand_src, extra.operand, "export target must be comptime known");5149 const operand = try sema.resolveInstConst(block, operand_src, extra.operand, "export target must be comptime-known");
5150 const options = sema.resolveExportOptions(block, .unneeded, extra.options) catch |err| switch (err) {5150 const options = sema.resolveExportOptions(block, .unneeded, extra.options) catch |err| switch (err) {
5151 error.NeededSourceLocation => {5151 error.NeededSourceLocation => {
5152 _ = try sema.resolveExportOptions(block, options_src, extra.options);5152 _ = try sema.resolveExportOptions(block, options_src, extra.options);
...@@ -5287,7 +5287,7 @@ fn zirSetAlignStack(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst...@@ -5287,7 +5287,7 @@ fn zirSetAlignStack(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst
5287fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {5287fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {
5288 const inst_data = sema.code.instructions.items(.data)[inst].un_node;5288 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
5289 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };5289 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
5290 const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setCold must be comptime known");5290 const is_cold = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setCold must be comptime-known");
5291 const func = sema.func orelse return; // does nothing outside a function5291 const func = sema.func orelse return; // does nothing outside a function
5292 func.is_cold = is_cold;5292 func.is_cold = is_cold;
5293}5293}
...@@ -5295,13 +5295,13 @@ fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi...@@ -5295,13 +5295,13 @@ fn zirSetCold(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi
5295fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void {5295fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void {
5296 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;5296 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
5297 const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };5297 const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };
5298 block.float_mode = try sema.resolveBuiltinEnum(block, src, extra.operand, "FloatMode", "operand to @setFloatMode must be comptime known");5298 block.float_mode = try sema.resolveBuiltinEnum(block, src, extra.operand, "FloatMode", "operand to @setFloatMode must be comptime-known");
5299}5299}
53005300
5301fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {5301fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {
5302 const inst_data = sema.code.instructions.items(.data)[inst].un_node;5302 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
5303 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };5303 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
5304 block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setRuntimeSafety must be comptime known");5304 block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand, "operand to @setRuntimeSafety must be comptime-known");
5305}5305}
53065306
5307fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void {5307fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void {
...@@ -5309,7 +5309,7 @@ fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) Co...@@ -5309,7 +5309,7 @@ fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) Co
53095309
5310 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;5310 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
5311 const order_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };5311 const order_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };
5312 const order = try sema.resolveAtomicOrder(block, order_src, extra.operand, "atomic order of @fence must be comptime known");5312 const order = try sema.resolveAtomicOrder(block, order_src, extra.operand, "atomic order of @fence must be comptime-known");
53135313
5314 if (@enumToInt(order) < @enumToInt(std.builtin.AtomicOrder.Acquire)) {5314 if (@enumToInt(order) < @enumToInt(std.builtin.AtomicOrder.Acquire)) {
5315 return sema.fail(block, order_src, "atomic ordering must be Acquire or stricter", .{});5315 return sema.fail(block, order_src, "atomic ordering must be Acquire or stricter", .{});
...@@ -5946,7 +5946,7 @@ fn analyzeCall(...@@ -5946,7 +5946,7 @@ fn analyzeCall(
5946 }5946 }
59475947
5948 const result: Air.Inst.Ref = if (is_inline_call) res: {5948 const result: Air.Inst.Ref = if (is_inline_call) res: {
5949 const func_val = sema.resolveConstValue(block, func_src, func, "function being called at comptime must be comptime known") catch |err| {5949 const func_val = sema.resolveConstValue(block, func_src, func, "function being called at comptime must be comptime-known") catch |err| {
5950 if (err == error.AnalysisFail and sema.err != null) {5950 if (err == error.AnalysisFail and sema.err != null) {
5951 try sema.addComptimeReturnTypeNote(block, func, func_src, func_ty_info.return_type, sema.err.?, comptime_only_ret_ty);5951 try sema.addComptimeReturnTypeNote(block, func, func_src, func_ty_info.return_type, sema.err.?, comptime_only_ret_ty);
5952 }5952 }
...@@ -6343,7 +6343,7 @@ fn analyzeInlineCallArg(...@@ -6343,7 +6343,7 @@ fn analyzeInlineCallArg(
6343 new_fn_info.param_types[arg_i.*] = param_ty;6343 new_fn_info.param_types[arg_i.*] = param_ty;
6344 const uncasted_arg = uncasted_args[arg_i.*];6344 const uncasted_arg = uncasted_args[arg_i.*];
6345 if (try sema.typeRequiresComptime(param_ty)) {6345 if (try sema.typeRequiresComptime(param_ty)) {
6346 _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime-only type must be comptime known") catch |err| {6346 _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime-only type must be comptime-known") catch |err| {
6347 if (err == error.AnalysisFail and sema.err != null) {6347 if (err == error.AnalysisFail and sema.err != null) {
6348 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);6348 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);
6349 }6349 }
...@@ -6354,7 +6354,7 @@ fn analyzeInlineCallArg(...@@ -6354,7 +6354,7 @@ fn analyzeInlineCallArg(
6354 try sema.inst_map.putNoClobber(sema.gpa, inst, casted_arg);6354 try sema.inst_map.putNoClobber(sema.gpa, inst, casted_arg);
63556355
6356 if (is_comptime_call) {6356 if (is_comptime_call) {
6357 const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, casted_arg, "argument to function being called at comptime must be comptime known") catch |err| {6357 const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, casted_arg, "argument to function being called at comptime must be comptime-known") catch |err| {
6358 if (err == error.AnalysisFail and sema.err != null) {6358 if (err == error.AnalysisFail and sema.err != null) {
6359 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);6359 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);
6360 }6360 }
...@@ -6389,7 +6389,7 @@ fn analyzeInlineCallArg(...@@ -6389,7 +6389,7 @@ fn analyzeInlineCallArg(
6389 try sema.inst_map.putNoClobber(sema.gpa, inst, uncasted_arg);6389 try sema.inst_map.putNoClobber(sema.gpa, inst, uncasted_arg);
63906390
6391 if (is_comptime_call) {6391 if (is_comptime_call) {
6392 const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to function being called at comptime must be comptime known") catch |err| {6392 const arg_val = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to function being called at comptime must be comptime-known") catch |err| {
6393 if (err == error.AnalysisFail and sema.err != null) {6393 if (err == error.AnalysisFail and sema.err != null) {
6394 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);6394 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);
6395 }6395 }
...@@ -6475,7 +6475,7 @@ fn instantiateGenericCall(...@@ -6475,7 +6475,7 @@ fn instantiateGenericCall(
6475 const mod = sema.mod;6475 const mod = sema.mod;
6476 const gpa = sema.gpa;6476 const gpa = sema.gpa;
64776477
6478 const func_val = try sema.resolveConstValue(block, func_src, func, "generic function being called must be comptime known");6478 const func_val = try sema.resolveConstValue(block, func_src, func, "generic function being called must be comptime-known");
6479 const module_fn = switch (func_val.tag()) {6479 const module_fn = switch (func_val.tag()) {
6480 .function => func_val.castTag(.function).?.data,6480 .function => func_val.castTag(.function).?.data,
6481 .decl_ref => mod.declPtr(func_val.castTag(.decl_ref).?.data).val.castTag(.function).?.data,6481 .decl_ref => mod.declPtr(func_val.castTag(.decl_ref).?.data).val.castTag(.function).?.data,
...@@ -6967,7 +6967,7 @@ fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!...@@ -6967,7 +6967,7 @@ fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
6967 const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };6967 const elem_type_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
6968 const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };6968 const len_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };
6969 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;6969 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
6970 const len = try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector length must be comptime known");6970 const len = try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector length must be comptime-known");
6971 const elem_type = try sema.resolveType(block, elem_type_src, extra.rhs);6971 const elem_type = try sema.resolveType(block, elem_type_src, extra.rhs);
6972 try sema.checkVectorElemType(block, elem_type_src, elem_type);6972 try sema.checkVectorElemType(block, elem_type_src, elem_type);
6973 const vector_type = try Type.Tag.vector.create(sema.arena, .{6973 const vector_type = try Type.Tag.vector.create(sema.arena, .{
...@@ -6985,7 +6985,7 @@ fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -6985,7 +6985,7 @@ fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
6985 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;6985 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
6986 const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node };6986 const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node };
6987 const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node };6987 const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node };
6988 const len = try sema.resolveInt(block, len_src, extra.lhs, Type.usize, "array length must be comptime known");6988 const len = try sema.resolveInt(block, len_src, extra.lhs, Type.usize, "array length must be comptime-known");
6989 const elem_type = try sema.resolveType(block, elem_src, extra.rhs);6989 const elem_type = try sema.resolveType(block, elem_src, extra.rhs);
6990 const array_ty = try Type.array(sema.arena, len, null, elem_type, sema.mod);6990 const array_ty = try Type.array(sema.arena, len, null, elem_type, sema.mod);
69916991
...@@ -7001,11 +7001,11 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil...@@ -7001,11 +7001,11 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil
7001 const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node };7001 const len_src: LazySrcLoc = .{ .node_offset_array_type_len = inst_data.src_node };
7002 const sentinel_src: LazySrcLoc = .{ .node_offset_array_type_sentinel = inst_data.src_node };7002 const sentinel_src: LazySrcLoc = .{ .node_offset_array_type_sentinel = inst_data.src_node };
7003 const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node };7003 const elem_src: LazySrcLoc = .{ .node_offset_array_type_elem = inst_data.src_node };
7004 const len = try sema.resolveInt(block, len_src, extra.len, Type.usize, "array length must be comptime known");7004 const len = try sema.resolveInt(block, len_src, extra.len, Type.usize, "array length must be comptime-known");
7005 const elem_type = try sema.resolveType(block, elem_src, extra.elem_type);7005 const elem_type = try sema.resolveType(block, elem_src, extra.elem_type);
7006 const uncasted_sentinel = try sema.resolveInst(extra.sentinel);7006 const uncasted_sentinel = try sema.resolveInst(extra.sentinel);
7007 const sentinel = try sema.coerce(block, elem_type, uncasted_sentinel, sentinel_src);7007 const sentinel = try sema.coerce(block, elem_type, uncasted_sentinel, sentinel_src);
7008 const sentinel_val = try sema.resolveConstValue(block, sentinel_src, sentinel, "array sentinel value must be comptime known");7008 const sentinel_val = try sema.resolveConstValue(block, sentinel_src, sentinel, "array sentinel value must be comptime-known");
7009 const array_ty = try Type.array(sema.arena, len, sentinel_val, elem_type, sema.mod);7009 const array_ty = try Type.array(sema.arena, len, sentinel_val, elem_type, sema.mod);
70107010
7011 return sema.addType(array_ty);7011 return sema.addType(array_ty);
...@@ -7703,7 +7703,7 @@ fn zirFunc(...@@ -7703,7 +7703,7 @@ fn zirFunc(
7703 const ret_ty_body = sema.code.extra[extra_index..][0..extra.data.ret_body_len];7703 const ret_ty_body = sema.code.extra[extra_index..][0..extra.data.ret_body_len];
7704 extra_index += ret_ty_body.len;7704 extra_index += ret_ty_body.len;
77057705
7706 const ret_ty_val = try sema.resolveGenericBody(block, ret_ty_src, ret_ty_body, inst, Type.type, "return type must be comptime known");7706 const ret_ty_val = try sema.resolveGenericBody(block, ret_ty_src, ret_ty_body, inst, Type.type, "return type must be comptime-known");
7707 var buffer: Value.ToTypeBuffer = undefined;7707 var buffer: Value.ToTypeBuffer = undefined;
7708 break :blk try ret_ty_val.toType(&buffer).copy(sema.arena);7708 break :blk try ret_ty_val.toType(&buffer).copy(sema.arena);
7709 },7709 },
...@@ -8530,7 +8530,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr...@@ -8530,7 +8530,7 @@ fn zirFieldValNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
8530 const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };8530 const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };
8531 const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data;8531 const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data;
8532 const object = try sema.resolveInst(extra.lhs);8532 const object = try sema.resolveInst(extra.lhs);
8533 const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime known");8533 const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime-known");
8534 return sema.fieldVal(block, src, object, field_name, field_name_src);8534 return sema.fieldVal(block, src, object, field_name, field_name_src);
8535}8535}
85368536
...@@ -8543,7 +8543,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr...@@ -8543,7 +8543,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
8543 const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };8543 const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };
8544 const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data;8544 const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data;
8545 const object_ptr = try sema.resolveInst(extra.lhs);8545 const object_ptr = try sema.resolveInst(extra.lhs);
8546 const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime known");8546 const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime-known");
8547 return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src, false);8547 return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src, false);
8548}8548}
85498549
...@@ -8555,7 +8555,7 @@ fn zirFieldCallBindNamed(sema: *Sema, block: *Block, extended: Zir.Inst.Extended...@@ -8555,7 +8555,7 @@ fn zirFieldCallBindNamed(sema: *Sema, block: *Block, extended: Zir.Inst.Extended
8555 const src = LazySrcLoc.nodeOffset(extra.node);8555 const src = LazySrcLoc.nodeOffset(extra.node);
8556 const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node };8556 const field_name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node };
8557 const object_ptr = try sema.resolveInst(extra.lhs);8557 const object_ptr = try sema.resolveInst(extra.lhs);
8558 const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime known");8558 const field_name = try sema.resolveConstString(block, field_name_src, extra.field_name, "field name must be comptime-known");
8559 return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src);8559 return sema.fieldCallBind(block, src, object_ptr, field_name, field_name_src);
8560}8560}
85618561
...@@ -10282,7 +10282,7 @@ fn resolveSwitchItemVal(...@@ -10282,7 +10282,7 @@ fn resolveSwitchItemVal(
10282 const src = switch_prong_src.resolve(sema.gpa, sema.mod.declPtr(block.src_decl), switch_node_offset, range_expand);10282 const src = switch_prong_src.resolve(sema.gpa, sema.mod.declPtr(block.src_decl), switch_node_offset, range_expand);
10283 return TypedValue{10283 return TypedValue{
10284 .ty = item_ty,10284 .ty = item_ty,
10285 .val = try sema.resolveConstValue(block, src, item, "switch prong values must be comptime known"),10285 .val = try sema.resolveConstValue(block, src, item, "switch prong values must be comptime-known"),
10286 };10286 };
10287 },10287 },
10288 else => |e| return e,10288 else => |e| return e,
...@@ -10571,7 +10571,7 @@ fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -10571,7 +10571,7 @@ fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
10571 const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };10571 const ty_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
10572 const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };10572 const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };
10573 const unresolved_ty = try sema.resolveType(block, ty_src, extra.lhs);10573 const unresolved_ty = try sema.resolveType(block, ty_src, extra.lhs);
10574 const field_name = try sema.resolveConstString(block, name_src, extra.rhs, "field name must be comptime known");10574 const field_name = try sema.resolveConstString(block, name_src, extra.rhs, "field name must be comptime-known");
10575 const ty = try sema.resolveTypeFields(block, ty_src, unresolved_ty);10575 const ty = try sema.resolveTypeFields(block, ty_src, unresolved_ty);
1057610576
10577 const has_field = hf: {10577 const has_field = hf: {
...@@ -10613,7 +10613,7 @@ fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air...@@ -10613,7 +10613,7 @@ fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
10613 const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };10613 const lhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
10614 const rhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };10614 const rhs_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };
10615 const container_type = try sema.resolveType(block, lhs_src, extra.lhs);10615 const container_type = try sema.resolveType(block, lhs_src, extra.lhs);
10616 const decl_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "decl name must be comptime known");10616 const decl_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "decl name must be comptime-known");
1061710617
10618 try checkNamespaceType(sema, block, lhs_src, container_type);10618 try checkNamespaceType(sema, block, lhs_src, container_type);
1061910619
...@@ -10677,7 +10677,7 @@ fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -10677,7 +10677,7 @@ fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
10677 const mod = sema.mod;10677 const mod = sema.mod;
10678 const inst_data = sema.code.instructions.items(.data)[inst].un_node;10678 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
10679 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };10679 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
10680 const name = try sema.resolveConstString(block, operand_src, inst_data.operand, "file path name must be comptime known");10680 const name = try sema.resolveConstString(block, operand_src, inst_data.operand, "file path name must be comptime-known");
1068110681
10682 const embed_file = mod.embedFile(block.getFileScope(), name) catch |err| switch (err) {10682 const embed_file = mod.embedFile(block.getFileScope(), name) catch |err| switch (err) {
10683 error.ImportOutsidePkgPath => {10683 error.ImportOutsidePkgPath => {
...@@ -10792,7 +10792,7 @@ fn zirShl(...@@ -10792,7 +10792,7 @@ fn zirShl(
10792 if (lhs_val.isUndef()) return sema.addConstUndef(lhs_ty);10792 if (lhs_val.isUndef()) return sema.addConstUndef(lhs_ty);
10793 const rhs_val = maybe_rhs_val orelse {10793 const rhs_val = maybe_rhs_val orelse {
10794 if (scalar_ty.zigTypeTag() == .ComptimeInt) {10794 if (scalar_ty.zigTypeTag() == .ComptimeInt) {
10795 return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be a comptime known", .{});10795 return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{});
10796 }10796 }
10797 break :rs rhs_src;10797 break :rs rhs_src;
10798 };10798 };
...@@ -10974,7 +10974,7 @@ fn zirShr(...@@ -10974,7 +10974,7 @@ fn zirShr(
10974 } else rhs_src;10974 } else rhs_src;
1097510975
10976 if (maybe_rhs_val == null and scalar_ty.zigTypeTag() == .ComptimeInt) {10976 if (maybe_rhs_val == null and scalar_ty.zigTypeTag() == .ComptimeInt) {
10977 return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be a comptime known", .{});10977 return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{});
10978 }10978 }
1097910979
10980 try sema.requireRuntimeBlock(block, src, runtime_src);10980 try sema.requireRuntimeBlock(block, src, runtime_src);
...@@ -11244,8 +11244,8 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -11244,8 +11244,8 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
11244 const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val);11244 const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val);
11245 const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src);11245 const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src);
11246 const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src);11246 const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src);
11247 const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime known");11247 const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime-known");
11248 const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime known");11248 const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime-known");
11249 if (try sema.valuesEqual(block, src, lhs_sent_casted_val, rhs_sent_casted_val, resolved_elem_ty)) {11249 if (try sema.valuesEqual(block, src, lhs_sent_casted_val, rhs_sent_casted_val, resolved_elem_ty)) {
11250 break :s lhs_sent_casted_val;11250 break :s lhs_sent_casted_val;
11251 } else {11251 } else {
...@@ -11253,14 +11253,14 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -11253,14 +11253,14 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
11253 }11253 }
11254 } else {11254 } else {
11255 const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src);11255 const lhs_sent_casted = try sema.coerce(block, resolved_elem_ty, lhs_sent, lhs_src);
11256 const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime known");11256 const lhs_sent_casted_val = try sema.resolveConstValue(block, lhs_src, lhs_sent_casted, "array sentinel value must be comptime-known");
11257 break :s lhs_sent_casted_val;11257 break :s lhs_sent_casted_val;
11258 }11258 }
11259 } else {11259 } else {
11260 if (rhs_info.sentinel) |rhs_sent_val| {11260 if (rhs_info.sentinel) |rhs_sent_val| {
11261 const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val);11261 const rhs_sent = try sema.addConstant(rhs_info.elem_type, rhs_sent_val);
11262 const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src);11262 const rhs_sent_casted = try sema.coerce(block, resolved_elem_ty, rhs_sent, rhs_src);
11263 const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime known");11263 const rhs_sent_casted_val = try sema.resolveConstValue(block, rhs_src, rhs_sent_casted, "array sentinel value must be comptime-known");
11264 break :s rhs_sent_casted_val;11264 break :s rhs_sent_casted_val;
11265 } else {11265 } else {
11266 break :s null;11266 break :s null;
...@@ -11381,7 +11381,7 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins...@@ -11381,7 +11381,7 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins
11381 // has a sentinel, and this code should compute the length based11381 // has a sentinel, and this code should compute the length based
11382 // on the sentinel value.11382 // on the sentinel value.
11383 .Slice, .Many => {11383 .Slice, .Many => {
11384 const val = try sema.resolveConstValue(block, src, operand, "slice value being concatenated must be comptime known");11384 const val = try sema.resolveConstValue(block, src, operand, "slice value being concatenated must be comptime-known");
11385 return Type.ArrayInfo{11385 return Type.ArrayInfo{
11386 .elem_type = ptr_info.pointee_type,11386 .elem_type = ptr_info.pointee_type,
11387 .sentinel = ptr_info.sentinel,11387 .sentinel = ptr_info.sentinel,
...@@ -11482,7 +11482,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -11482,7 +11482,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
11482 const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };11482 const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
1148311483
11484 // In `**` rhs must be comptime-known, but lhs can be runtime-known11484 // In `**` rhs must be comptime-known, but lhs can be runtime-known
11485 const factor = try sema.resolveInt(block, rhs_src, extra.rhs, Type.usize, "array multiplication factor must be comptime known");11485 const factor = try sema.resolveInt(block, rhs_src, extra.rhs, Type.usize, "array multiplication factor must be comptime-known");
1148611486
11487 if (lhs_ty.isTuple()) {11487 if (lhs_ty.isTuple()) {
11488 return sema.analyzeTupleMul(block, inst_data.src_node, lhs, factor);11488 return sema.analyzeTupleMul(block, inst_data.src_node, lhs, factor);
...@@ -15812,14 +15812,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air...@@ -15812,14 +15812,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
15812 const sentinel = if (inst_data.flags.has_sentinel) blk: {15812 const sentinel = if (inst_data.flags.has_sentinel) blk: {
15813 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);15813 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);
15814 extra_i += 1;15814 extra_i += 1;
15815 break :blk (try sema.resolveInstConst(block, sentinel_src, ref, "pointer sentinel value must be comptime known")).val;15815 break :blk (try sema.resolveInstConst(block, sentinel_src, ref, "pointer sentinel value must be comptime-known")).val;
15816 } else null;15816 } else null;
1581715817
15818 const abi_align: u32 = if (inst_data.flags.has_align) blk: {15818 const abi_align: u32 = if (inst_data.flags.has_align) blk: {
15819 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);15819 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);
15820 extra_i += 1;15820 extra_i += 1;
15821 const coerced = try sema.coerce(block, Type.u32, try sema.resolveInst(ref), align_src);15821 const coerced = try sema.coerce(block, Type.u32, try sema.resolveInst(ref), align_src);
15822 const val = try sema.resolveConstValue(block, align_src, coerced, "pointer alignment must be comptime known");15822 const val = try sema.resolveConstValue(block, align_src, coerced, "pointer alignment must be comptime-known");
15823 // Check if this happens to be the lazy alignment of our element type, in15823 // Check if this happens to be the lazy alignment of our element type, in
15824 // which case we can make this 0 without resolving it.15824 // which case we can make this 0 without resolving it.
15825 if (val.castTag(.lazy_align)) |payload| {15825 if (val.castTag(.lazy_align)) |payload| {
...@@ -15841,14 +15841,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air...@@ -15841,14 +15841,14 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
15841 const bit_offset = if (inst_data.flags.has_bit_range) blk: {15841 const bit_offset = if (inst_data.flags.has_bit_range) blk: {
15842 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);15842 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);
15843 extra_i += 1;15843 extra_i += 1;
15844 const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, Type.u16, "pointer bit-offset must be comptime known");15844 const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, Type.u16, "pointer bit-offset must be comptime-known");
15845 break :blk @intCast(u16, bit_offset);15845 break :blk @intCast(u16, bit_offset);
15846 } else 0;15846 } else 0;
1584715847
15848 const host_size: u16 = if (inst_data.flags.has_bit_range) blk: {15848 const host_size: u16 = if (inst_data.flags.has_bit_range) blk: {
15849 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);15849 const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]);
15850 extra_i += 1;15850 extra_i += 1;
15851 const host_size = try sema.resolveInt(block, hostsize_src, ref, Type.u16, "pointer host size must be comptime known");15851 const host_size = try sema.resolveInt(block, hostsize_src, ref, Type.u16, "pointer host size must be comptime-known");
15852 break :blk @intCast(u16, host_size);15852 break :blk @intCast(u16, host_size);
15853 } else 0;15853 } else 0;
1585415854
...@@ -15972,7 +15972,7 @@ fn zirUnionInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -15972,7 +15972,7 @@ fn zirUnionInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
15972 const init_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node };15972 const init_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node };
15973 const extra = sema.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data;15973 const extra = sema.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data;
15974 const union_ty = try sema.resolveType(block, ty_src, extra.union_type);15974 const union_ty = try sema.resolveType(block, ty_src, extra.union_type);
15975 const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "name of field being initialized must be comptime known");15975 const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "name of field being initialized must be comptime-known");
15976 const init = try sema.resolveInst(extra.init);15976 const init = try sema.resolveInst(extra.init);
15977 return sema.unionInit(block, init, init_src, union_ty, ty_src, field_name, field_src);15977 return sema.unionInit(block, init, init_src, union_ty, ty_src, field_name, field_src);
15978}15978}
...@@ -16070,7 +16070,7 @@ fn zirStructInit(...@@ -16070,7 +16070,7 @@ fn zirStructInit(
16070 field_inits[field_index] = try sema.resolveInst(item.data.init);16070 field_inits[field_index] = try sema.resolveInst(item.data.init);
16071 if (!is_packed) if (resolved_ty.structFieldValueComptime(field_index)) |default_value| {16071 if (!is_packed) if (resolved_ty.structFieldValueComptime(field_index)) |default_value| {
16072 const init_val = (try sema.resolveMaybeUndefVal(block, field_src, field_inits[field_index])) orelse {16072 const init_val = (try sema.resolveMaybeUndefVal(block, field_src, field_inits[field_index])) orelse {
16073 return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime known");16073 return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime-known");
16074 };16074 };
1607516075
16076 if (!init_val.eql(default_value, resolved_ty.structFieldType(field_index), sema.mod)) {16076 if (!init_val.eql(default_value, resolved_ty.structFieldType(field_index), sema.mod)) {
...@@ -16581,7 +16581,7 @@ fn zirFieldTypeRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro...@@ -16581,7 +16581,7 @@ fn zirFieldTypeRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
16581 const ty_src = inst_data.src();16581 const ty_src = inst_data.src();
16582 const field_src = inst_data.src();16582 const field_src = inst_data.src();
16583 const aggregate_ty = try sema.resolveType(block, ty_src, extra.container_type);16583 const aggregate_ty = try sema.resolveType(block, ty_src, extra.container_type);
16584 const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "field name must be comptime known");16584 const field_name = try sema.resolveConstString(block, field_src, extra.field_name, "field name must be comptime-known");
16585 return sema.fieldType(block, aggregate_ty, field_name, field_src, ty_src);16585 return sema.fieldType(block, aggregate_ty, field_name, field_src, ty_src);
16586}16586}
1658716587
...@@ -16862,7 +16862,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in...@@ -16862,7 +16862,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
16862 const uncasted_operand = try sema.resolveInst(extra.operand);16862 const uncasted_operand = try sema.resolveInst(extra.operand);
16863 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };16863 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };
16864 const type_info = try sema.coerce(block, type_info_ty, uncasted_operand, operand_src);16864 const type_info = try sema.coerce(block, type_info_ty, uncasted_operand, operand_src);
16865 const val = try sema.resolveConstValue(block, operand_src, type_info, "operand to @Type must be comptime known");16865 const val = try sema.resolveConstValue(block, operand_src, type_info, "operand to @Type must be comptime-known");
16866 const union_val = val.cast(Value.Payload.Union).?.data;16866 const union_val = val.cast(Value.Payload.Union).?.data;
16867 const target = mod.getTarget();16867 const target = mod.getTarget();
16868 const tag_index = type_info_ty.unionTagFieldIndex(union_val.tag, mod).?;16868 const tag_index = type_info_ty.unionTagFieldIndex(union_val.tag, mod).?;
...@@ -17798,7 +17798,7 @@ fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!...@@ -17798,7 +17798,7 @@ fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
17798 const result_val = try sema.floatToInt(block, operand_src, val, operand_ty, dest_ty);17798 const result_val = try sema.floatToInt(block, operand_src, val, operand_ty, dest_ty);
17799 return sema.addConstant(dest_ty, result_val);17799 return sema.addConstant(dest_ty, result_val);
17800 } else if (dest_ty.zigTypeTag() == .ComptimeInt) {17800 } else if (dest_ty.zigTypeTag() == .ComptimeInt) {
17801 return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_int' must be comptime known");17801 return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_int' must be comptime-known");
17802 }17802 }
1780317803
17804 try sema.requireRuntimeBlock(block, inst_data.src(), operand_src);17804 try sema.requireRuntimeBlock(block, inst_data.src(), operand_src);
...@@ -17831,7 +17831,7 @@ fn zirIntToFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!...@@ -17831,7 +17831,7 @@ fn zirIntToFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
17831 const result_val = try val.intToFloatAdvanced(sema.arena, operand_ty, dest_ty, target, sema.kit(block, operand_src));17831 const result_val = try val.intToFloatAdvanced(sema.arena, operand_ty, dest_ty, target, sema.kit(block, operand_src));
17832 return sema.addConstant(dest_ty, result_val);17832 return sema.addConstant(dest_ty, result_val);
17833 } else if (dest_ty.zigTypeTag() == .ComptimeFloat) {17833 } else if (dest_ty.zigTypeTag() == .ComptimeFloat) {
17834 return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_float' must be comptime known");17834 return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_float' must be comptime-known");
17835 }17835 }
1783617836
17837 try sema.requireRuntimeBlock(block, inst_data.src(), operand_src);17837 try sema.requireRuntimeBlock(block, inst_data.src(), operand_src);
...@@ -18411,7 +18411,7 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6...@@ -18411,7 +18411,7 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6
18411 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;18411 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
1841218412
18413 const ty = try sema.resolveType(block, lhs_src, extra.lhs);18413 const ty = try sema.resolveType(block, lhs_src, extra.lhs);
18414 const field_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "name of field must be comptime known");18414 const field_name = try sema.resolveConstString(block, rhs_src, extra.rhs, "name of field must be comptime-known");
18415 const target = sema.mod.getTarget();18415 const target = sema.mod.getTarget();
1841618416
18417 try sema.resolveTypeLayout(block, lhs_src, ty);18417 try sema.resolveTypeLayout(block, lhs_src, ty);
...@@ -18882,19 +18882,19 @@ fn resolveExportOptions(...@@ -18882,19 +18882,19 @@ fn resolveExportOptions(
18882 const visibility_src = sema.maybeOptionsSrc(block, src, "visibility");18882 const visibility_src = sema.maybeOptionsSrc(block, src, "visibility");
1888318883
18884 const name_operand = try sema.fieldVal(block, src, options, "name", name_src);18884 const name_operand = try sema.fieldVal(block, src, options, "name", name_src);
18885 const name_val = try sema.resolveConstValue(block, name_src, name_operand, "name of exported value must be comptime known");18885 const name_val = try sema.resolveConstValue(block, name_src, name_operand, "name of exported value must be comptime-known");
18886 const name_ty = Type.initTag(.const_slice_u8);18886 const name_ty = Type.initTag(.const_slice_u8);
18887 const name = try name_val.toAllocatedBytes(name_ty, sema.arena, sema.mod);18887 const name = try name_val.toAllocatedBytes(name_ty, sema.arena, sema.mod);
1888818888
18889 const linkage_operand = try sema.fieldVal(block, src, options, "linkage", linkage_src);18889 const linkage_operand = try sema.fieldVal(block, src, options, "linkage", linkage_src);
18890 const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_operand, "linkage of exported value must be comptime known");18890 const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_operand, "linkage of exported value must be comptime-known");
18891 const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage);18891 const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage);
1889218892
18893 const section = try sema.fieldVal(block, src, options, "section", section_src);18893 const section = try sema.fieldVal(block, src, options, "section", section_src);
18894 const section_val = try sema.resolveConstValue(block, section_src, section, "linksection of exported value must be comptime known");18894 const section_val = try sema.resolveConstValue(block, section_src, section, "linksection of exported value must be comptime-known");
1889518895
18896 const visibility_operand = try sema.fieldVal(block, src, options, "visibility", visibility_src);18896 const visibility_operand = try sema.fieldVal(block, src, options, "visibility", visibility_src);
18897 const visibility_val = try sema.resolveConstValue(block, visibility_src, visibility_operand, "visibility of exported value must be comptime known");18897 const visibility_val = try sema.resolveConstValue(block, visibility_src, visibility_operand, "visibility of exported value must be comptime-known");
18898 const visibility = visibility_val.toEnum(std.builtin.SymbolVisibility);18898 const visibility = visibility_val.toEnum(std.builtin.SymbolVisibility);
1889918899
18900 if (name.len < 1) {18900 if (name.len < 1) {
...@@ -18950,7 +18950,7 @@ fn resolveAtomicRmwOp(...@@ -18950,7 +18950,7 @@ fn resolveAtomicRmwOp(
18950 src: LazySrcLoc,18950 src: LazySrcLoc,
18951 zir_ref: Zir.Inst.Ref,18951 zir_ref: Zir.Inst.Ref,
18952) CompileError!std.builtin.AtomicRmwOp {18952) CompileError!std.builtin.AtomicRmwOp {
18953 return resolveBuiltinEnum(sema, block, src, zir_ref, "AtomicRmwOp", "@atomicRmW operation must be comptime known");18953 return resolveBuiltinEnum(sema, block, src, zir_ref, "AtomicRmwOp", "@atomicRmW operation must be comptime-known");
18954}18954}
1895518955
18956fn zirCmpxchg(18956fn zirCmpxchg(
...@@ -18986,8 +18986,8 @@ fn zirCmpxchg(...@@ -18986,8 +18986,8 @@ fn zirCmpxchg(
18986 const uncasted_ptr = try sema.resolveInst(extra.ptr);18986 const uncasted_ptr = try sema.resolveInst(extra.ptr);
18987 const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false);18987 const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false);
18988 const new_value = try sema.coerce(block, elem_ty, try sema.resolveInst(extra.new_value), new_value_src);18988 const new_value = try sema.coerce(block, elem_ty, try sema.resolveInst(extra.new_value), new_value_src);
18989 const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, "atomic order of cmpxchg success must be comptime known");18989 const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, "atomic order of cmpxchg success must be comptime-known");
18990 const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, "atomic order of cmpxchg failure must be comptime known");18990 const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, "atomic order of cmpxchg failure must be comptime-known");
1899118991
18992 if (@enumToInt(success_order) < @enumToInt(std.builtin.AtomicOrder.Monotonic)) {18992 if (@enumToInt(success_order) < @enumToInt(std.builtin.AtomicOrder.Monotonic)) {
18993 return sema.fail(block, success_order_src, "success atomic ordering must be Monotonic or stricter", .{});18993 return sema.fail(block, success_order_src, "success atomic ordering must be Monotonic or stricter", .{});
...@@ -19052,7 +19052,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I...@@ -19052,7 +19052,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I
19052 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;19052 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
19053 const len_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };19053 const len_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
19054 const scalar_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };19054 const scalar_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
19055 const len = @intCast(u32, try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector splat destination length must be comptime known"));19055 const len = @intCast(u32, try sema.resolveInt(block, len_src, extra.lhs, Type.u32, "vector splat destination length must be comptime-known"));
19056 const scalar = try sema.resolveInst(extra.rhs);19056 const scalar = try sema.resolveInst(extra.rhs);
19057 const scalar_ty = sema.typeOf(scalar);19057 const scalar_ty = sema.typeOf(scalar);
19058 try sema.checkVectorElemType(block, scalar_src, scalar_ty);19058 try sema.checkVectorElemType(block, scalar_src, scalar_ty);
...@@ -19078,7 +19078,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air....@@ -19078,7 +19078,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
19078 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;19078 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
19079 const op_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };19079 const op_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node };
19080 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };19080 const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = inst_data.src_node };
19081 const operation = try sema.resolveBuiltinEnum(block, op_src, extra.lhs, "ReduceOp", "@reduce operation must be comptime known");19081 const operation = try sema.resolveBuiltinEnum(block, op_src, extra.lhs, "ReduceOp", "@reduce operation must be comptime-known");
19082 const operand = try sema.resolveInst(extra.rhs);19082 const operand = try sema.resolveInst(extra.rhs);
19083 const operand_ty = sema.typeOf(operand);19083 const operand_ty = sema.typeOf(operand);
19084 const target = sema.mod.getTarget();19084 const target = sema.mod.getTarget();
...@@ -19165,7 +19165,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air...@@ -19165,7 +19165,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
19165 .elem_type = Type.@"i32",19165 .elem_type = Type.@"i32",
19166 });19166 });
19167 mask = try sema.coerce(block, mask_ty, mask, mask_src);19167 mask = try sema.coerce(block, mask_ty, mask, mask_src);
19168 const mask_val = try sema.resolveConstMaybeUndefVal(block, mask_src, mask, "shuffle mask must be comptime known");19168 const mask_val = try sema.resolveConstMaybeUndefVal(block, mask_src, mask, "shuffle mask must be comptime-known");
19169 return sema.analyzeShuffle(block, inst_data.src_node, elem_ty, a, b, mask_val, @intCast(u32, mask_len));19169 return sema.analyzeShuffle(block, inst_data.src_node, elem_ty, a, b, mask_val, @intCast(u32, mask_len));
19170}19170}
1917119171
...@@ -19433,7 +19433,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!...@@ -19433,7 +19433,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
19433 const elem_ty = try sema.resolveType(block, elem_ty_src, extra.elem_type);19433 const elem_ty = try sema.resolveType(block, elem_ty_src, extra.elem_type);
19434 const uncasted_ptr = try sema.resolveInst(extra.ptr);19434 const uncasted_ptr = try sema.resolveInst(extra.ptr);
19435 const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, true);19435 const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, true);
19436 const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicLoad must be comptime known");19436 const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicLoad must be comptime-known");
1943719437
19438 switch (order) {19438 switch (order) {
19439 .Release, .AcqRel => {19439 .Release, .AcqRel => {
...@@ -19497,7 +19497,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -19497,7 +19497,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
19497 },19497 },
19498 else => {},19498 else => {},
19499 }19499 }
19500 const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicRmW must be comptime known");19500 const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicRmW must be comptime-known");
1950119501
19502 if (order == .Unordered) {19502 if (order == .Unordered) {
19503 return sema.fail(block, order_src, "@atomicRmw atomic ordering must not be Unordered", .{});19503 return sema.fail(block, order_src, "@atomicRmw atomic ordering must not be Unordered", .{});
...@@ -19565,7 +19565,7 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -19565,7 +19565,7 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
19565 const elem_ty = sema.typeOf(operand);19565 const elem_ty = sema.typeOf(operand);
19566 const uncasted_ptr = try sema.resolveInst(extra.ptr);19566 const uncasted_ptr = try sema.resolveInst(extra.ptr);
19567 const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false);19567 const ptr = try sema.checkAtomicPtrOperand(block, elem_ty, elem_ty_src, uncasted_ptr, ptr_src, false);
19568 const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicStore must be comptime known");19568 const order = try sema.resolveAtomicOrder(block, order_src, extra.ordering, "atomic order of @atomicStore must be comptime-known");
1956919569
19570 const air_tag: Air.Inst.Tag = switch (order) {19570 const air_tag: Air.Inst.Tag = switch (order) {
19571 .Acquire, .AcqRel => {19571 .Acquire, .AcqRel => {
...@@ -19668,11 +19668,11 @@ fn resolveCallOptions(...@@ -19668,11 +19668,11 @@ fn resolveCallOptions(
19668 const stack_src = sema.maybeOptionsSrc(block, src, "stack");19668 const stack_src = sema.maybeOptionsSrc(block, src, "stack");
1966919669
19670 const modifier = try sema.fieldVal(block, src, options, "modifier", modifier_src);19670 const modifier = try sema.fieldVal(block, src, options, "modifier", modifier_src);
19671 const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier, "call modifier must be comptime known");19671 const modifier_val = try sema.resolveConstValue(block, modifier_src, modifier, "call modifier must be comptime-known");
19672 const wanted_modifier = modifier_val.toEnum(std.builtin.CallOptions.Modifier);19672 const wanted_modifier = modifier_val.toEnum(std.builtin.CallOptions.Modifier);
1967319673
19674 const stack = try sema.fieldVal(block, src, options, "stack", stack_src);19674 const stack = try sema.fieldVal(block, src, options, "stack", stack_src);
19675 const stack_val = try sema.resolveConstValue(block, stack_src, stack, "call stack value must be comptime known");19675 const stack_val = try sema.resolveConstValue(block, stack_src, stack, "call stack value must be comptime-known");
1967619676
19677 if (!stack_val.isNull()) {19677 if (!stack_val.isNull()) {
19678 return sema.fail(block, stack_src, "TODO: implement @call with stack", .{});19678 return sema.fail(block, stack_src, "TODO: implement @call with stack", .{});
...@@ -19802,7 +19802,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr...@@ -19802,7 +19802,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
19802 const ptr_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node };19802 const ptr_src: LazySrcLoc = .{ .node_offset_builtin_call_arg2 = inst_data.src_node };
1980319803
19804 const struct_ty = try sema.resolveType(block, ty_src, extra.parent_type);19804 const struct_ty = try sema.resolveType(block, ty_src, extra.parent_type);
19805 const field_name = try sema.resolveConstString(block, name_src, extra.field_name, "field name must be comptime known");19805 const field_name = try sema.resolveConstString(block, name_src, extra.field_name, "field name must be comptime-known");
19806 const field_ptr = try sema.resolveInst(extra.field_ptr);19806 const field_ptr = try sema.resolveInst(extra.field_ptr);
19807 const field_ptr_ty = sema.typeOf(field_ptr);19807 const field_ptr_ty = sema.typeOf(field_ptr);
1980819808
...@@ -20115,7 +20115,7 @@ fn zirVarExtended(...@@ -20115,7 +20115,7 @@ fn zirVarExtended(
20115 uncasted_init;20115 uncasted_init;
2011620116
20117 break :blk (try sema.resolveMaybeUndefVal(block, init_src, init)) orelse20117 break :blk (try sema.resolveMaybeUndefVal(block, init_src, init)) orelse
20118 return sema.failWithNeededComptime(block, init_src, "container level variable initializers must be comptime known");20118 return sema.failWithNeededComptime(block, init_src, "container level variable initializers must be comptime-known");
20119 } else Value.initTag(.unreachable_value);20119 } else Value.initTag(.unreachable_value);
2012020120
20121 try sema.validateVarType(block, ty_src, var_ty, small.is_extern);20121 try sema.validateVarType(block, ty_src, var_ty, small.is_extern);
...@@ -20184,7 +20184,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20184,7 +20184,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20184 const body = sema.code.extra[extra_index..][0..body_len];20184 const body = sema.code.extra[extra_index..][0..body_len];
20185 extra_index += body.len;20185 extra_index += body.len;
2018620186
20187 const val = try sema.resolveGenericBody(block, align_src, body, inst, Type.u29, "alignment must be comptime known");20187 const val = try sema.resolveGenericBody(block, align_src, body, inst, Type.u29, "alignment must be comptime-known");
20188 if (val.tag() == .generic_poison) {20188 if (val.tag() == .generic_poison) {
20189 break :blk null;20189 break :blk null;
20190 }20190 }
...@@ -20198,7 +20198,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20198,7 +20198,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20198 } else if (extra.data.bits.has_align_ref) blk: {20198 } else if (extra.data.bits.has_align_ref) blk: {
20199 const align_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);20199 const align_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);
20200 extra_index += 1;20200 extra_index += 1;
20201 const align_tv = sema.resolveInstConst(block, align_src, align_ref, "alignment must be comptime known") catch |err| switch (err) {20201 const align_tv = sema.resolveInstConst(block, align_src, align_ref, "alignment must be comptime-known") catch |err| switch (err) {
20202 error.GenericPoison => {20202 error.GenericPoison => {
20203 break :blk null;20203 break :blk null;
20204 },20204 },
...@@ -20220,7 +20220,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20220,7 +20220,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20220 extra_index += body.len;20220 extra_index += body.len;
2022120221
20222 const addrspace_ty = try sema.getBuiltinType(block, addrspace_src, "AddressSpace");20222 const addrspace_ty = try sema.getBuiltinType(block, addrspace_src, "AddressSpace");
20223 const val = try sema.resolveGenericBody(block, addrspace_src, body, inst, addrspace_ty, "addrespace must be comptime known");20223 const val = try sema.resolveGenericBody(block, addrspace_src, body, inst, addrspace_ty, "addrespace must be comptime-known");
20224 if (val.tag() == .generic_poison) {20224 if (val.tag() == .generic_poison) {
20225 break :blk null;20225 break :blk null;
20226 }20226 }
...@@ -20228,7 +20228,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20228,7 +20228,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20228 } else if (extra.data.bits.has_addrspace_ref) blk: {20228 } else if (extra.data.bits.has_addrspace_ref) blk: {
20229 const addrspace_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);20229 const addrspace_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);
20230 extra_index += 1;20230 extra_index += 1;
20231 const addrspace_tv = sema.resolveInstConst(block, addrspace_src, addrspace_ref, "addrespace must be comptime known") catch |err| switch (err) {20231 const addrspace_tv = sema.resolveInstConst(block, addrspace_src, addrspace_ref, "addrespace must be comptime-known") catch |err| switch (err) {
20232 error.GenericPoison => {20232 error.GenericPoison => {
20233 break :blk null;20233 break :blk null;
20234 },20234 },
...@@ -20243,7 +20243,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20243,7 +20243,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20243 const body = sema.code.extra[extra_index..][0..body_len];20243 const body = sema.code.extra[extra_index..][0..body_len];
20244 extra_index += body.len;20244 extra_index += body.len;
2024520245
20246 const val = try sema.resolveGenericBody(block, section_src, body, inst, Type.initTag(.const_slice_u8), "linksection must be comptime known");20246 const val = try sema.resolveGenericBody(block, section_src, body, inst, Type.initTag(.const_slice_u8), "linksection must be comptime-known");
20247 if (val.tag() == .generic_poison) {20247 if (val.tag() == .generic_poison) {
20248 break :blk FuncLinkSection{ .generic = {} };20248 break :blk FuncLinkSection{ .generic = {} };
20249 }20249 }
...@@ -20251,7 +20251,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20251,7 +20251,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20251 } else if (extra.data.bits.has_section_ref) blk: {20251 } else if (extra.data.bits.has_section_ref) blk: {
20252 const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);20252 const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);
20253 extra_index += 1;20253 extra_index += 1;
20254 const section_tv = sema.resolveInstConst(block, section_src, section_ref, "linksection must be comptime known") catch |err| switch (err) {20254 const section_tv = sema.resolveInstConst(block, section_src, section_ref, "linksection must be comptime-known") catch |err| switch (err) {
20255 error.GenericPoison => {20255 error.GenericPoison => {
20256 break :blk FuncLinkSection{ .generic = {} };20256 break :blk FuncLinkSection{ .generic = {} };
20257 },20257 },
...@@ -20268,7 +20268,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20268,7 +20268,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20268 extra_index += body.len;20268 extra_index += body.len;
2026920269
20270 const cc_ty = try sema.getBuiltinType(block, addrspace_src, "CallingConvention");20270 const cc_ty = try sema.getBuiltinType(block, addrspace_src, "CallingConvention");
20271 const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, "calling convention must be comptime known");20271 const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, "calling convention must be comptime-known");
20272 if (val.tag() == .generic_poison) {20272 if (val.tag() == .generic_poison) {
20273 break :blk null;20273 break :blk null;
20274 }20274 }
...@@ -20276,7 +20276,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20276,7 +20276,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20276 } else if (extra.data.bits.has_cc_ref) blk: {20276 } else if (extra.data.bits.has_cc_ref) blk: {
20277 const cc_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);20277 const cc_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);
20278 extra_index += 1;20278 extra_index += 1;
20279 const cc_tv = sema.resolveInstConst(block, cc_src, cc_ref, "calling convention must be comptime known") catch |err| switch (err) {20279 const cc_tv = sema.resolveInstConst(block, cc_src, cc_ref, "calling convention must be comptime-known") catch |err| switch (err) {
20280 error.GenericPoison => {20280 error.GenericPoison => {
20281 break :blk null;20281 break :blk null;
20282 },20282 },
...@@ -20291,14 +20291,14 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -20291,14 +20291,14 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
20291 const body = sema.code.extra[extra_index..][0..body_len];20291 const body = sema.code.extra[extra_index..][0..body_len];
20292 extra_index += body.len;20292 extra_index += body.len;
2029320293
20294 const val = try sema.resolveGenericBody(block, ret_src, body, inst, Type.type, "return type must be comptime known");20294 const val = try sema.resolveGenericBody(block, ret_src, body, inst, Type.type, "return type must be comptime-known");
20295 var buffer: Value.ToTypeBuffer = undefined;20295 var buffer: Value.ToTypeBuffer = undefined;
20296 const ty = try val.toType(&buffer).copy(sema.arena);20296 const ty = try val.toType(&buffer).copy(sema.arena);
20297 break :blk ty;20297 break :blk ty;
20298 } else if (extra.data.bits.has_ret_ty_ref) blk: {20298 } else if (extra.data.bits.has_ret_ty_ref) blk: {
20299 const ret_ty_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);20299 const ret_ty_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]);
20300 extra_index += 1;20300 extra_index += 1;
20301 const ret_ty_tv = sema.resolveInstConst(block, ret_src, ret_ty_ref, "return type must be comptime known") catch |err| switch (err) {20301 const ret_ty_tv = sema.resolveInstConst(block, ret_src, ret_ty_ref, "return type must be comptime-known") catch |err| switch (err) {
20302 error.GenericPoison => {20302 error.GenericPoison => {
20303 break :blk Type.initTag(.generic_poison);20303 break :blk Type.initTag(.generic_poison);
20304 },20304 },
...@@ -20354,7 +20354,7 @@ fn zirCUndef(...@@ -20354,7 +20354,7 @@ fn zirCUndef(
20354 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;20354 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
20355 const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };20355 const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };
2035620356
20357 const name = try sema.resolveConstString(block, src, extra.operand, "name of macro being undefined must be comptime known");20357 const name = try sema.resolveConstString(block, src, extra.operand, "name of macro being undefined must be comptime-known");
20358 try block.c_import_buf.?.writer().print("#undefine {s}\n", .{name});20358 try block.c_import_buf.?.writer().print("#undefine {s}\n", .{name});
20359 return Air.Inst.Ref.void_value;20359 return Air.Inst.Ref.void_value;
20360}20360}
...@@ -20367,7 +20367,7 @@ fn zirCInclude(...@@ -20367,7 +20367,7 @@ fn zirCInclude(
20367 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;20367 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
20368 const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };20368 const src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };
2036920369
20370 const name = try sema.resolveConstString(block, src, extra.operand, "path being included must be comptime known");20370 const name = try sema.resolveConstString(block, src, extra.operand, "path being included must be comptime-known");
20371 try block.c_import_buf.?.writer().print("#include <{s}>\n", .{name});20371 try block.c_import_buf.?.writer().print("#include <{s}>\n", .{name});
20372 return Air.Inst.Ref.void_value;20372 return Air.Inst.Ref.void_value;
20373}20373}
...@@ -20381,10 +20381,10 @@ fn zirCDefine(...@@ -20381,10 +20381,10 @@ fn zirCDefine(
20381 const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };20381 const name_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node };
20382 const val_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node };20382 const val_src: LazySrcLoc = .{ .node_offset_builtin_call_arg1 = extra.node };
2038320383
20384 const name = try sema.resolveConstString(block, name_src, extra.lhs, "name of macro being undefined must be comptime known");20384 const name = try sema.resolveConstString(block, name_src, extra.lhs, "name of macro being undefined must be comptime-known");
20385 const rhs = try sema.resolveInst(extra.rhs);20385 const rhs = try sema.resolveInst(extra.rhs);
20386 if (sema.typeOf(rhs).zigTypeTag() != .Void) {20386 if (sema.typeOf(rhs).zigTypeTag() != .Void) {
20387 const value = try sema.resolveConstString(block, val_src, extra.rhs, "value of macro being undefined must be comptime known");20387 const value = try sema.resolveConstString(block, val_src, extra.rhs, "value of macro being undefined must be comptime-known");
20388 try block.c_import_buf.?.writer().print("#define {s} {s}\n", .{ name, value });20388 try block.c_import_buf.?.writer().print("#define {s} {s}\n", .{ name, value });
20389 } else {20389 } else {
20390 try block.c_import_buf.?.writer().print("#define {s}\n", .{name});20390 try block.c_import_buf.?.writer().print("#define {s}\n", .{name});
...@@ -20405,7 +20405,7 @@ fn zirWasmMemorySize(...@@ -20405,7 +20405,7 @@ fn zirWasmMemorySize(
20405 return sema.fail(block, builtin_src, "builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)});20405 return sema.fail(block, builtin_src, "builtin @wasmMemorySize is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)});
20406 }20406 }
2040720407
20408 const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.operand, Type.u32, "wasm memory size index must be comptime known"));20408 const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.operand, Type.u32, "wasm memory size index must be comptime-known"));
20409 try sema.requireRuntimeBlock(block, builtin_src, null);20409 try sema.requireRuntimeBlock(block, builtin_src, null);
20410 return block.addInst(.{20410 return block.addInst(.{
20411 .tag = .wasm_memory_size,20411 .tag = .wasm_memory_size,
...@@ -20430,7 +20430,7 @@ fn zirWasmMemoryGrow(...@@ -20430,7 +20430,7 @@ fn zirWasmMemoryGrow(
20430 return sema.fail(block, builtin_src, "builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)});20430 return sema.fail(block, builtin_src, "builtin @wasmMemoryGrow is available when targeting WebAssembly; targeted CPU architecture is {s}", .{@tagName(target.cpu.arch)});
20431 }20431 }
2043220432
20433 const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.lhs, Type.u32, "wasm memory size index must be comptime known"));20433 const index = @intCast(u32, try sema.resolveInt(block, index_src, extra.lhs, Type.u32, "wasm memory size index must be comptime-known"));
20434 const delta = try sema.coerce(block, Type.u32, try sema.resolveInst(extra.rhs), delta_src);20434 const delta = try sema.coerce(block, Type.u32, try sema.resolveInst(extra.rhs), delta_src);
2043520435
20436 try sema.requireRuntimeBlock(block, builtin_src, null);20436 try sema.requireRuntimeBlock(block, builtin_src, null);
...@@ -20458,13 +20458,13 @@ fn resolvePrefetchOptions(...@@ -20458,13 +20458,13 @@ fn resolvePrefetchOptions(
20458 const cache_src = sema.maybeOptionsSrc(block, src, "cache");20458 const cache_src = sema.maybeOptionsSrc(block, src, "cache");
2045920459
20460 const rw = try sema.fieldVal(block, src, options, "rw", rw_src);20460 const rw = try sema.fieldVal(block, src, options, "rw", rw_src);
20461 const rw_val = try sema.resolveConstValue(block, rw_src, rw, "prefetch read/write must be comptime known");20461 const rw_val = try sema.resolveConstValue(block, rw_src, rw, "prefetch read/write must be comptime-known");
2046220462
20463 const locality = try sema.fieldVal(block, src, options, "locality", locality_src);20463 const locality = try sema.fieldVal(block, src, options, "locality", locality_src);
20464 const locality_val = try sema.resolveConstValue(block, locality_src, locality, "prefetch locality must be comptime known");20464 const locality_val = try sema.resolveConstValue(block, locality_src, locality, "prefetch locality must be comptime-known");
2046520465
20466 const cache = try sema.fieldVal(block, src, options, "cache", cache_src);20466 const cache = try sema.fieldVal(block, src, options, "cache", cache_src);
20467 const cache_val = try sema.resolveConstValue(block, cache_src, cache, "prefetch cache must be comptime known");20467 const cache_val = try sema.resolveConstValue(block, cache_src, cache, "prefetch cache must be comptime-known");
2046820468
20469 return std.builtin.PrefetchOptions{20469 return std.builtin.PrefetchOptions{
20470 .rw = rw_val.toEnum(std.builtin.PrefetchOptions.Rw),20470 .rw = rw_val.toEnum(std.builtin.PrefetchOptions.Rw),
...@@ -20524,18 +20524,18 @@ fn resolveExternOptions(...@@ -20524,18 +20524,18 @@ fn resolveExternOptions(
20524 const thread_local_src = sema.maybeOptionsSrc(block, src, "thread_local");20524 const thread_local_src = sema.maybeOptionsSrc(block, src, "thread_local");
2052520525
20526 const name_ref = try sema.fieldVal(block, src, options, "name", name_src);20526 const name_ref = try sema.fieldVal(block, src, options, "name", name_src);
20527 const name_val = try sema.resolveConstValue(block, name_src, name_ref, "name of the extern symbol must be comptime known");20527 const name_val = try sema.resolveConstValue(block, name_src, name_ref, "name of the extern symbol must be comptime-known");
20528 const name = try name_val.toAllocatedBytes(Type.initTag(.const_slice_u8), sema.arena, mod);20528 const name = try name_val.toAllocatedBytes(Type.initTag(.const_slice_u8), sema.arena, mod);
2052920529
20530 const library_name_inst = try sema.fieldVal(block, src, options, "library_name", library_src);20530 const library_name_inst = try sema.fieldVal(block, src, options, "library_name", library_src);
20531 const library_name_val = try sema.resolveConstValue(block, library_src, library_name_inst, "library in which extern symbol is must be comptime known");20531 const library_name_val = try sema.resolveConstValue(block, library_src, library_name_inst, "library in which extern symbol is must be comptime-known");
2053220532
20533 const linkage_ref = try sema.fieldVal(block, src, options, "linkage", linkage_src);20533 const linkage_ref = try sema.fieldVal(block, src, options, "linkage", linkage_src);
20534 const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_ref, "linkage of the extern symbol must be comptime known");20534 const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_ref, "linkage of the extern symbol must be comptime-known");
20535 const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage);20535 const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage);
2053620536
20537 const is_thread_local = try sema.fieldVal(block, src, options, "is_thread_local", thread_local_src);20537 const is_thread_local = try sema.fieldVal(block, src, options, "is_thread_local", thread_local_src);
20538 const is_thread_local_val = try sema.resolveConstValue(block, thread_local_src, is_thread_local, "threadlocality of the extern symbol must be comptime known");20538 const is_thread_local_val = try sema.resolveConstValue(block, thread_local_src, is_thread_local, "threadlocality of the extern symbol must be comptime-known");
2053920539
20540 const library_name = if (!library_name_val.isNull()) blk: {20540 const library_name = if (!library_name_val.isNull()) blk: {
20541 const payload = library_name_val.castTag(.opt_payload).?.data;20541 const payload = library_name_val.castTag(.opt_payload).?.data;
...@@ -22518,7 +22518,7 @@ fn elemPtr(...@@ -22518,7 +22518,7 @@ fn elemPtr(
22518 .Array, .Vector => return sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init),22518 .Array, .Vector => return sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init),
22519 .Struct => {22519 .Struct => {
22520 // Tuple field access.22520 // Tuple field access.
22521 const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime known");22521 const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime-known");
22522 const index = @intCast(u32, index_val.toUnsignedInt(target));22522 const index = @intCast(u32, index_val.toUnsignedInt(target));
22523 return sema.tupleFieldPtr(block, src, indexable_ptr, elem_index_src, index, init);22523 return sema.tupleFieldPtr(block, src, indexable_ptr, elem_index_src, index, init);
22524 },22524 },
...@@ -22580,7 +22580,7 @@ fn elemVal(...@@ -22580,7 +22580,7 @@ fn elemVal(
22580 },22580 },
22581 .Struct => {22581 .Struct => {
22582 // Tuple field access.22582 // Tuple field access.
22583 const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime known");22583 const index_val = try sema.resolveConstValue(block, elem_index_src, elem_index, "tuple field access index must be comptime-known");
22584 const index = @intCast(u32, index_val.toUnsignedInt(target));22584 const index = @intCast(u32, index_val.toUnsignedInt(target));
22585 return tupleField(sema, block, indexable_src, indexable, elem_index_src, index);22585 return tupleField(sema, block, indexable_src, indexable, elem_index_src, index);
22586 },22586 },
...@@ -22602,7 +22602,7 @@ fn validateRuntimeElemAccess(...@@ -22602,7 +22602,7 @@ fn validateRuntimeElemAccess(
22602 const msg = try sema.errMsg(22602 const msg = try sema.errMsg(
22603 block,22603 block,
22604 elem_index_src,22604 elem_index_src,
22605 "values of type '{}' must be comptime known, but index value is runtime known",22605 "values of type '{}' must be comptime-known, but index value is runtime known",
22606 .{parent_ty.fmt(sema.mod)},22606 .{parent_ty.fmt(sema.mod)},
22607 );22607 );
22608 errdefer msg.destroy(sema.gpa);22608 errdefer msg.destroy(sema.gpa);
...@@ -23307,7 +23307,7 @@ fn coerceExtra(...@@ -23307,7 +23307,7 @@ fn coerceExtra(
23307 const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse {23307 const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse {
23308 if (dest_ty.zigTypeTag() == .ComptimeInt) {23308 if (dest_ty.zigTypeTag() == .ComptimeInt) {
23309 if (!opts.report_err) return error.NotCoercible;23309 if (!opts.report_err) return error.NotCoercible;
23310 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime known");23310 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime-known");
23311 }23311 }
23312 break :float;23312 break :float;
23313 };23313 };
...@@ -23325,7 +23325,7 @@ fn coerceExtra(...@@ -23325,7 +23325,7 @@ fn coerceExtra(
23325 },23325 },
23326 .Int, .ComptimeInt => {23326 .Int, .ComptimeInt => {
23327 if (try sema.resolveDefinedValue(block, inst_src, inst)) |val| {23327 if (try sema.resolveDefinedValue(block, inst_src, inst)) |val| {
23328 // comptime known integer to other number23328 // comptime-known integer to other number
23329 if (!(try sema.intFitsInType(block, inst_src, val, dest_ty, null))) {23329 if (!(try sema.intFitsInType(block, inst_src, val, dest_ty, null))) {
23330 if (!opts.report_err) return error.NotCoercible;23330 if (!opts.report_err) return error.NotCoercible;
23331 return sema.fail(block, inst_src, "type '{}' cannot represent integer value '{}'", .{ dest_ty.fmt(sema.mod), val.fmtValue(inst_ty, sema.mod) });23331 return sema.fail(block, inst_src, "type '{}' cannot represent integer value '{}'", .{ dest_ty.fmt(sema.mod), val.fmtValue(inst_ty, sema.mod) });
...@@ -23335,7 +23335,7 @@ fn coerceExtra(...@@ -23335,7 +23335,7 @@ fn coerceExtra(
23335 if (dest_ty.zigTypeTag() == .ComptimeInt) {23335 if (dest_ty.zigTypeTag() == .ComptimeInt) {
23336 if (!opts.report_err) return error.NotCoercible;23336 if (!opts.report_err) return error.NotCoercible;
23337 if (opts.no_cast_to_comptime_int) return inst;23337 if (opts.no_cast_to_comptime_int) return inst;
23338 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime known");23338 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_int' must be comptime-known");
23339 }23339 }
2334023340
23341 // integer widening23341 // integer widening
...@@ -23374,7 +23374,7 @@ fn coerceExtra(...@@ -23374,7 +23374,7 @@ fn coerceExtra(
23374 return try sema.addConstant(dest_ty, result_val);23374 return try sema.addConstant(dest_ty, result_val);
23375 } else if (dest_ty.zigTypeTag() == .ComptimeFloat) {23375 } else if (dest_ty.zigTypeTag() == .ComptimeFloat) {
23376 if (!opts.report_err) return error.NotCoercible;23376 if (!opts.report_err) return error.NotCoercible;
23377 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime known");23377 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime-known");
23378 }23378 }
2337923379
23380 // float widening23380 // float widening
...@@ -23389,7 +23389,7 @@ fn coerceExtra(...@@ -23389,7 +23389,7 @@ fn coerceExtra(
23389 const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse {23389 const val = (try sema.resolveDefinedValue(block, inst_src, inst)) orelse {
23390 if (dest_ty.zigTypeTag() == .ComptimeFloat) {23390 if (dest_ty.zigTypeTag() == .ComptimeFloat) {
23391 if (!opts.report_err) return error.NotCoercible;23391 if (!opts.report_err) return error.NotCoercible;
23392 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime known");23392 return sema.failWithNeededComptime(block, inst_src, "value being casted to 'comptime_float' must be comptime-known");
23393 }23393 }
23394 break :int;23394 break :int;
23395 };23395 };
...@@ -26185,7 +26185,7 @@ fn coerceTupleToStruct(...@@ -26185,7 +26185,7 @@ fn coerceTupleToStruct(
26185 field_refs[field_index] = coerced;26185 field_refs[field_index] = coerced;
26186 if (field.is_comptime) {26186 if (field.is_comptime) {
26187 const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse {26187 const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse {
26188 return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime known");26188 return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime-known");
26189 };26189 };
2619026190
26191 if (!init_val.eql(field.default_val, field.ty, sema.mod)) {26191 if (!init_val.eql(field.default_val, field.ty, sema.mod)) {
...@@ -26281,7 +26281,7 @@ fn coerceTupleToTuple(...@@ -26281,7 +26281,7 @@ fn coerceTupleToTuple(
26281 field_refs[field_index] = coerced;26281 field_refs[field_index] = coerced;
26282 if (default_val.tag() != .unreachable_value) {26282 if (default_val.tag() != .unreachable_value) {
26283 const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse {26283 const init_val = (try sema.resolveMaybeUndefVal(block, field_src, coerced)) orelse {
26284 return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime known");26284 return sema.failWithNeededComptime(block, field_src, "value stored in comptime field must be comptime-known");
26285 };26285 };
2628626286
26287 if (!init_val.eql(default_val, field_ty, sema.mod)) {26287 if (!init_val.eql(default_val, field_ty, sema.mod)) {
...@@ -26647,7 +26647,7 @@ fn analyzeIsNonErrComptimeOnly(...@@ -26647,7 +26647,7 @@ fn analyzeIsNonErrComptimeOnly(
26647 const maybe_operand_val = try sema.resolveMaybeUndefVal(block, src, operand);26647 const maybe_operand_val = try sema.resolveMaybeUndefVal(block, src, operand);
2664826648
26649 // exception if the error union error set is known to be empty,26649 // exception if the error union error set is known to be empty,
26650 // we allow the comparison but always make it comptime known.26650 // we allow the comparison but always make it comptime-known.
26651 const set_ty = operand_ty.errorUnionSet();26651 const set_ty = operand_ty.errorUnionSet();
26652 switch (set_ty.tag()) {26652 switch (set_ty.tag()) {
26653 .anyerror => {},26653 .anyerror => {},
...@@ -26914,7 +26914,7 @@ fn analyzeSlice(...@@ -26914,7 +26914,7 @@ fn analyzeSlice(
26914 const sentinel = s: {26914 const sentinel = s: {
26915 if (sentinel_opt != .none) {26915 if (sentinel_opt != .none) {
26916 const casted = try sema.coerce(block, elem_ty, sentinel_opt, sentinel_src);26916 const casted = try sema.coerce(block, elem_ty, sentinel_opt, sentinel_src);
26917 break :s try sema.resolveConstValue(block, sentinel_src, casted, "slice sentinel must be comptime known");26917 break :s try sema.resolveConstValue(block, sentinel_src, casted, "slice sentinel must be comptime-known");
26918 }26918 }
26919 // If we are slicing to the end of something that is sentinel-terminated26919 // If we are slicing to the end of something that is sentinel-terminated
26920 // then the resulting slice type is also sentinel-terminated.26920 // then the resulting slice type is also sentinel-terminated.
...@@ -28836,7 +28836,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void...@@ -28836,7 +28836,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void
28836 const field = &struct_obj.fields.values()[i];28836 const field = &struct_obj.fields.values()[i];
28837 const coerced = try sema.coerce(&block_scope, field.ty, init, src);28837 const coerced = try sema.coerce(&block_scope, field.ty, init, src);
28838 const default_val = (try sema.resolveMaybeUndefVal(&block_scope, src, coerced)) orelse28838 const default_val = (try sema.resolveMaybeUndefVal(&block_scope, src, coerced)) orelse
28839 return sema.failWithNeededComptime(&block_scope, src, "struct field default value must be comptime known");28839 return sema.failWithNeededComptime(&block_scope, src, "struct field default value must be comptime-known");
28840 field.default_val = try default_val.copy(decl_arena_allocator);28840 field.default_val = try default_val.copy(decl_arena_allocator);
28841 }28841 }
28842 }28842 }
...@@ -29032,7 +29032,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void {...@@ -29032,7 +29032,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void {
29032 if (tag_ref != .none) {29032 if (tag_ref != .none) {
29033 const tag_src = src; // TODO better source location29033 const tag_src = src; // TODO better source location
29034 const coerced = try sema.coerce(&block_scope, int_tag_ty, tag_ref, tag_src);29034 const coerced = try sema.coerce(&block_scope, int_tag_ty, tag_ref, tag_src);
29035 const val = try sema.resolveConstValue(&block_scope, tag_src, coerced, "enum tag value must be comptime known");29035 const val = try sema.resolveConstValue(&block_scope, tag_src, coerced, "enum tag value must be comptime-known");
29036 last_tag_val = val;29036 last_tag_val = val;
2903729037
29038 // This puts the memory into the union arena, not the enum arena, but29038 // This puts the memory into the union arena, not the enum arena, but
...@@ -29856,7 +29856,7 @@ pub fn analyzeAddrspace(...@@ -29856,7 +29856,7 @@ pub fn analyzeAddrspace(
29856 zir_ref: Zir.Inst.Ref,29856 zir_ref: Zir.Inst.Ref,
29857 ctx: AddressSpaceContext,29857 ctx: AddressSpaceContext,
29858) !std.builtin.AddressSpace {29858) !std.builtin.AddressSpace {
29859 const addrspace_tv = try sema.resolveInstConst(block, src, zir_ref, "addresspace must be comptime known");29859 const addrspace_tv = try sema.resolveInstConst(block, src, zir_ref, "addresspace must be comptime-known");
29860 const address_space = addrspace_tv.val.toEnum(std.builtin.AddressSpace);29860 const address_space = addrspace_tv.val.toEnum(std.builtin.AddressSpace);
29861 const target = sema.mod.getTarget();29861 const target = sema.mod.getTarget();
29862 const arch = target.cpu.arch;29862 const arch = target.cpu.arch;
src/arch/aarch64/CodeGen.zig+1-1
...@@ -5425,7 +5425,7 @@ fn parseRegName(name: []const u8) ?Register {...@@ -5425,7 +5425,7 @@ fn parseRegName(name: []const u8) ?Register {
54255425
5426fn registerAlias(reg: Register, size_bytes: u64) Register {5426fn registerAlias(reg: Register, size_bytes: u64) Register {
5427 if (size_bytes == 0) {5427 if (size_bytes == 0) {
5428 unreachable; // should be comptime known5428 unreachable; // should be comptime-known
5429 } else if (size_bytes <= 4) {5429 } else if (size_bytes <= 4) {
5430 return reg.to32();5430 return reg.to32();
5431 } else if (size_bytes <= 8) {5431 } else if (size_bytes <= 8) {
src/arch/x86_64/CodeGen.zig+1-1
...@@ -7272,7 +7272,7 @@ fn parseRegName(name: []const u8) ?Register {...@@ -7272,7 +7272,7 @@ fn parseRegName(name: []const u8) ?Register {
7272/// Returns register wide enough to hold at least `size_bytes`.7272/// Returns register wide enough to hold at least `size_bytes`.
7273fn registerAlias(reg: Register, size_bytes: u32) Register {7273fn registerAlias(reg: Register, size_bytes: u32) Register {
7274 if (size_bytes == 0) {7274 if (size_bytes == 0) {
7275 unreachable; // should be comptime known7275 unreachable; // should be comptime-known
7276 } else if (size_bytes <= 1) {7276 } else if (size_bytes <= 1) {
7277 return reg.to8();7277 return reg.to8();
7278 } else if (size_bytes <= 2) {7278 } else if (size_bytes <= 2) {
src/link.zig+1-1
...@@ -305,7 +305,7 @@ pub const File = struct {...@@ -305,7 +305,7 @@ pub const File = struct {
305 };305 };
306 }306 }
307 const emit = options.emit.?;307 const emit = options.emit.?;
308 const use_lld = build_options.have_llvm and options.use_lld; // comptime known false when !have_llvm308 const use_lld = build_options.have_llvm and options.use_lld; // comptime-known false when !have_llvm
309 const sub_path = if (use_lld) blk: {309 const sub_path = if (use_lld) blk: {
310 if (options.module == null) {310 if (options.module == null) {
311 // No point in opening a file, we would not write anything to it.311 // No point in opening a file, we would not write anything to it.
src/tracy.zig+2-2
...@@ -173,13 +173,13 @@ pub fn TracyAllocator(comptime name: ?[:0]const u8) type {...@@ -173,13 +173,13 @@ pub fn TracyAllocator(comptime name: ?[:0]const u8) type {
173 };173 };
174}174}
175175
176// This function only accepts comptime known strings, see `messageCopy` for runtime strings176// This function only accepts comptime-known strings, see `messageCopy` for runtime strings
177pub inline fn message(comptime msg: [:0]const u8) void {177pub inline fn message(comptime msg: [:0]const u8) void {
178 if (!enable) return;178 if (!enable) return;
179 ___tracy_emit_messageL(msg.ptr, if (enable_callstack) callstack_depth else 0);179 ___tracy_emit_messageL(msg.ptr, if (enable_callstack) callstack_depth else 0);
180}180}
181181
182// This function only accepts comptime known strings, see `messageColorCopy` for runtime strings182// This function only accepts comptime-known strings, see `messageColorCopy` for runtime strings
183pub inline fn messageColor(comptime msg: [:0]const u8, color: u32) void {183pub inline fn messageColor(comptime msg: [:0]const u8, color: u32) void {
184 if (!enable) return;184 if (!enable) return;
185 ___tracy_emit_messageLC(msg.ptr, color, if (enable_callstack) callstack_depth else 0);185 ___tracy_emit_messageLC(msg.ptr, color, if (enable_callstack) callstack_depth else 0);
test/behavior/basic.zig+1-1
...@@ -999,7 +999,7 @@ test "generic function uses return type of other generic function" {...@@ -999,7 +999,7 @@ test "generic function uses return type of other generic function" {
999 try std.testing.expect(S.call(S.func, .{@as(u8, 1)}) == 1);999 try std.testing.expect(S.call(S.func, .{@as(u8, 1)}) == 1);
1000}1000}
10011001
1002test "const alloc with comptime known initializer is made comptime known" {1002test "const alloc with comptime-known initializer is made comptime-known" {
1003 const S = struct {1003 const S = struct {
1004 a: bool,1004 a: bool,
1005 b: [2]u8,1005 b: [2]u8,
test/behavior/enum.zig+2-2
...@@ -846,12 +846,12 @@ fn doALoopThing(id: EnumWithOneMember) void {...@@ -846,12 +846,12 @@ fn doALoopThing(id: EnumWithOneMember) void {
846 }846 }
847}847}
848848
849test "comparison operator on enum with one member is comptime known" {849test "comparison operator on enum with one member is comptime-known" {
850 doALoopThing(EnumWithOneMember.Eof);850 doALoopThing(EnumWithOneMember.Eof);
851}851}
852852
853const State = enum { Start };853const State = enum { Start };
854test "switch on enum with one member is comptime known" {854test "switch on enum with one member is comptime-known" {
855 var state = State.Start;855 var state = State.Start;
856 switch (state) {856 switch (state) {
857 State.Start => return,857 State.Start => return,
test/behavior/eval.zig+5-5
...@@ -582,16 +582,16 @@ test "comparisons 0 <= uint and 0 > uint should be comptime" {...@@ -582,16 +582,16 @@ test "comparisons 0 <= uint and 0 > uint should be comptime" {
582}582}
583fn testCompTimeUIntComparisons(x: u32) void {583fn testCompTimeUIntComparisons(x: u32) void {
584 if (!(0 <= x)) {584 if (!(0 <= x)) {
585 @compileError("this condition should be comptime known");585 @compileError("this condition should be comptime-known");
586 }586 }
587 if (0 > x) {587 if (0 > x) {
588 @compileError("this condition should be comptime known");588 @compileError("this condition should be comptime-known");
589 }589 }
590 if (!(x >= 0)) {590 if (!(x >= 0)) {
591 @compileError("this condition should be comptime known");591 @compileError("this condition should be comptime-known");
592 }592 }
593 if (x < 0) {593 if (x < 0) {
594 @compileError("this condition should be comptime known");594 @compileError("this condition should be comptime-known");
595 }595 }
596}596}
597597
...@@ -1302,7 +1302,7 @@ test "repeated value is correctly expanded" {...@@ -1302,7 +1302,7 @@ test "repeated value is correctly expanded" {
1302 }1302 }
1303}1303}
13041304
1305test "value in if block is comptime known" {1305test "value in if block is comptime-known" {
1306 if (builtin.zig_backend == .stage1) return error.SkipZigTest;1306 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
13071307
1308 const first = blk: {1308 const first = blk: {
test/behavior/math.zig+1-1
...@@ -990,7 +990,7 @@ test "overflow arithmetic with u0 values" {...@@ -990,7 +990,7 @@ test "overflow arithmetic with u0 values" {
990 try expect(result == 0);990 try expect(result == 0);
991}991}
992992
993test "allow signed integer division/remainder when values are comptime known and positive or exact" {993test "allow signed integer division/remainder when values are comptime-known and positive or exact" {
994 if (builtin.zig_backend == .stage1) return error.SkipZigTest;994 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
995995
996 try expect(5 / 3 == 1);996 try expect(5 / 3 == 1);
test/behavior/struct.zig+1-1
...@@ -653,7 +653,7 @@ test "default struct initialization fields" {...@@ -653,7 +653,7 @@ test "default struct initialization fields" {
653 .b = five,653 .b = five,
654 };654 };
655 if (x.a + x.b != 1239) {655 if (x.a + x.b != 1239) {
656 @compileError("it should be comptime known");656 @compileError("it should be comptime-known");
657 }657 }
658 try expect(y.a == x.a);658 try expect(y.a == x.a);
659 try expect(y.b == x.b);659 try expect(y.b == x.b);
test/behavior/truncate.zig+2-2
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const expect = std.testing.expect;3const expect = std.testing.expect;
44
5test "truncate u0 to larger integer allowed and has comptime known result" {5test "truncate u0 to larger integer allowed and has comptime-known result" {
6 var x: u0 = 0;6 var x: u0 = 0;
7 const y = @truncate(u8, x);7 const y = @truncate(u8, x);
8 comptime try expect(y == 0);8 comptime try expect(y == 0);
...@@ -25,7 +25,7 @@ test "truncate.u0.var" {...@@ -25,7 +25,7 @@ test "truncate.u0.var" {
25 try expect(z == 0);25 try expect(z == 0);
26}26}
2727
28test "truncate i0 to larger integer allowed and has comptime known result" {28test "truncate i0 to larger integer allowed and has comptime-known result" {
29 var x: i0 = 0;29 var x: i0 = 0;
30 const y = @truncate(i8, x);30 const y = @truncate(i8, x);
31 comptime try expect(y == 0);31 comptime try expect(y == 0);
test/cases/compile_errors/dereference_anyopaque.zig+4-4
...@@ -45,11 +45,11 @@ pub export fn entry() void {...@@ -45,11 +45,11 @@ pub export fn entry() void {
45// backend=llvm45// backend=llvm
46//46//
47// :11:22: error: comparison of 'void' with null47// :11:22: error: comparison of 'void' with null
48// :25:51: error: values of type 'anyopaque' must be comptime known, but operand value is runtime known48// :25:51: error: values of type 'anyopaque' must be comptime-known, but operand value is runtime known
49// :25:51: note: opaque type 'anyopaque' has undefined size49// :25:51: note: opaque type 'anyopaque' has undefined size
50// :25:51: error: values of type 'fn(*anyopaque, usize, u29, u29, usize) error{OutOfMemory}![]u8' must be comptime known, but operand value is runtime known50// :25:51: error: values of type 'fn(*anyopaque, usize, u29, u29, usize) error{OutOfMemory}![]u8' must be comptime-known, but operand value is runtime known
51// :25:51: note: use '*const fn(*anyopaque, usize, u29, u29, usize) error{OutOfMemory}![]u8' for a function pointer type51// :25:51: note: use '*const fn(*anyopaque, usize, u29, u29, usize) error{OutOfMemory}![]u8' for a function pointer type
52// :25:51: error: values of type 'fn(*anyopaque, []u8, u29, usize, u29, usize) ?usize' must be comptime known, but operand value is runtime known52// :25:51: error: values of type 'fn(*anyopaque, []u8, u29, usize, u29, usize) ?usize' must be comptime-known, but operand value is runtime known
53// :25:51: note: use '*const fn(*anyopaque, []u8, u29, usize, u29, usize) ?usize' for a function pointer type53// :25:51: note: use '*const fn(*anyopaque, []u8, u29, usize, u29, usize) ?usize' for a function pointer type
54// :25:51: error: values of type 'fn(*anyopaque, []u8, u29, usize) void' must be comptime known, but operand value is runtime known54// :25:51: error: values of type 'fn(*anyopaque, []u8, u29, usize) void' must be comptime-known, but operand value is runtime known
55// :25:51: note: use '*const fn(*anyopaque, []u8, u29, usize) void' for a function pointer type55// :25:51: note: use '*const fn(*anyopaque, []u8, u29, usize) void' for a function pointer type
test/cases/compile_errors/error_in_typeof_param.zig+1-1
...@@ -11,4 +11,4 @@ pub export fn entry() void {...@@ -11,4 +11,4 @@ pub export fn entry() void {
11// target=native11// target=native
12//12//
13// :6:31: error: unable to resolve comptime value13// :6:31: error: unable to resolve comptime value
14// :6:31: note: argument to parameter with comptime-only type must be comptime known14// :6:31: note: argument to parameter with comptime-only type must be comptime-known
test/cases/compile_errors/explain_why_fn_is_called_at_comptime.zig+1-1
...@@ -17,7 +17,7 @@ pub export fn entry() void {...@@ -17,7 +17,7 @@ pub export fn entry() void {
17// target=native17// target=native
18//18//
19// :12:13: error: unable to resolve comptime value19// :12:13: error: unable to resolve comptime value
20// :12:13: note: argument to function being called at comptime must be comptime known20// :12:13: note: argument to function being called at comptime must be comptime-known
21// :7:25: note: function is being called at comptime because it returns a comptime-only type 'tmp.S'21// :7:25: note: function is being called at comptime because it returns a comptime-only type 'tmp.S'
22// :2:12: note: struct requires comptime because of this field22// :2:12: note: struct requires comptime because of this field
23// :2:12: note: use '*const fn() void' for a function pointer type23// :2:12: note: use '*const fn() void' for a function pointer type
test/cases/compile_errors/explain_why_generic_fn_is_called_at_comptime.zig+1-1
...@@ -18,5 +18,5 @@ pub export fn entry() void {...@@ -18,5 +18,5 @@ pub export fn entry() void {
18// target=native18// target=native
19//19//
20// :14:13: error: unable to resolve comptime value20// :14:13: error: unable to resolve comptime value
21// :14:13: note: argument to function being called at comptime must be comptime known21// :14:13: note: argument to function being called at comptime must be comptime-known
22// :9:38: note: generic function is instantiated with a comptime-only return type22// :9:38: note: generic function is instantiated with a comptime-only return type
test/cases/compile_errors/int-float_conversion_to_comptime_int-float.zig+2-2
...@@ -12,6 +12,6 @@ export fn bar() void {...@@ -12,6 +12,6 @@ export fn bar() void {
12// target=native12// target=native
13//13//
14// :3:35: error: unable to resolve comptime value14// :3:35: error: unable to resolve comptime value
15// :3:35: note: value being casted to 'comptime_int' must be comptime known15// :3:35: note: value being casted to 'comptime_int' must be comptime-known
16// :7:37: error: unable to resolve comptime value16// :7:37: error: unable to resolve comptime value
17// :7:37: note: value being casted to 'comptime_float' must be comptime known17// :7:37: note: value being casted to 'comptime_float' must be comptime-known
test/cases/compile_errors/non-comptime-parameter-used-as-array-size.zig+1-1
...@@ -12,4 +12,4 @@ fn makeLlamas(count: usize) [count]u8 {...@@ -12,4 +12,4 @@ fn makeLlamas(count: usize) [count]u8 {
12// target=native12// target=native
13//13//
14// :8:30: error: unable to resolve comptime value14// :8:30: error: unable to resolve comptime value
15// :8:30: note: array length must be comptime known15// :8:30: note: array length must be comptime-known
test/cases/compile_errors/non-const_variables_of_things_that_require_const_variables.zig+1-1
...@@ -39,7 +39,7 @@ const Opaque = opaque {};...@@ -39,7 +39,7 @@ const Opaque = opaque {};
39// :14:8: error: variable of type 'comptime_float' must be const or comptime39// :14:8: error: variable of type 'comptime_float' must be const or comptime
40// :14:8: note: to modify this variable at runtime, it must be given an explicit fixed-size number type40// :14:8: note: to modify this variable at runtime, it must be given an explicit fixed-size number type
41// :18:8: error: variable of type '@TypeOf(null)' must be const or comptime41// :18:8: error: variable of type '@TypeOf(null)' must be const or comptime
42// :22:19: error: values of type 'tmp.Opaque' must be comptime known, but operand value is runtime known42// :22:19: error: values of type 'tmp.Opaque' must be comptime-known, but operand value is runtime known
43// :22:19: note: opaque type 'tmp.Opaque' has undefined size43// :22:19: note: opaque type 'tmp.Opaque' has undefined size
44// :26:8: error: variable of type 'type' must be const or comptime44// :26:8: error: variable of type 'type' must be const or comptime
45// :26:8: note: types are not available at runtime45// :26:8: note: types are not available at runtime
test/cases/compile_errors/non-inline_for_loop_on_a_type_that_requires_comptime.zig+1-1
...@@ -11,6 +11,6 @@ export fn entry() void {...@@ -11,6 +11,6 @@ export fn entry() void {
11// backend=stage211// backend=stage2
12// target=native12// target=native
13//13//
14// :7:10: error: values of type '[2]tmp.Foo' must be comptime known, but index value is runtime known14// :7:10: error: values of type '[2]tmp.Foo' must be comptime-known, but index value is runtime known
15// :3:8: note: struct requires comptime because of this field15// :3:8: note: struct requires comptime because of this field
16// :3:8: note: types are not available at runtime16// :3:8: note: types are not available at runtime
test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig+1-1
...@@ -14,6 +14,6 @@ export fn entry() void {...@@ -14,6 +14,6 @@ export fn entry() void {
14// backend=stage214// backend=stage2
15// target=native15// target=native
16//16//
17// :9:51: error: values of type '[]const builtin.Type.StructField' must be comptime known, but index value is runtime known17// :9:51: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime known
18// :?:21: note: struct requires comptime because of this field18// :?:21: note: struct requires comptime because of this field
19// :?:21: note: types are not available at runtime19// :?:21: note: types are not available at runtime
test/cases/compile_errors/runtime_indexing_comptime_array.zig+3-3
...@@ -24,9 +24,9 @@ pub export fn entry3() void {...@@ -24,9 +24,9 @@ pub export fn entry3() void {
24// target=native24// target=native
25// backend=stage225// backend=stage2
26//26//
27// :7:10: error: values of type '[2]fn() void' must be comptime known, but index value is runtime known27// :7:10: error: values of type '[2]fn() void' must be comptime-known, but index value is runtime known
28// :7:10: note: use '*const fn() void' for a function pointer type28// :7:10: note: use '*const fn() void' for a function pointer type
29// :15:18: error: values of type '[2]fn() void' must be comptime known, but index value is runtime known29// :15:18: error: values of type '[2]fn() void' must be comptime-known, but index value is runtime known
30// :15:17: note: use '*const fn() void' for a function pointer type30// :15:17: note: use '*const fn() void' for a function pointer type
31// :21:19: error: values of type '[2]fn() void' must be comptime known, but index value is runtime known31// :21:19: error: values of type '[2]fn() void' must be comptime-known, but index value is runtime known
32// :21:18: note: use '*const fn() void' for a function pointer type32// :21:18: note: use '*const fn() void' for a function pointer type
test/cases/compile_errors/runtime_to_comptime_num.zig+4-4
...@@ -22,10 +22,10 @@ pub export fn entry4() void{...@@ -22,10 +22,10 @@ pub export fn entry4() void{
22// target=native22// target=native
23//23//
24// :3:27: error: unable to resolve comptime value24// :3:27: error: unable to resolve comptime value
25// :3:27: note: value being casted to 'comptime_int' must be comptime known25// :3:27: note: value being casted to 'comptime_int' must be comptime-known
26// :7:29: error: unable to resolve comptime value26// :7:29: error: unable to resolve comptime value
27// :7:29: note: value being casted to 'comptime_float' must be comptime known27// :7:29: note: value being casted to 'comptime_float' must be comptime-known
28// :12:10: error: unable to resolve comptime value28// :12:10: error: unable to resolve comptime value
29// :12:10: note: value being casted to 'comptime_float' must be comptime known29// :12:10: note: value being casted to 'comptime_float' must be comptime-known
30// :17:10: error: unable to resolve comptime value30// :17:10: error: unable to resolve comptime value
31// :17:10: note: value being casted to 'comptime_int' must be comptime known31// :17:10: note: value being casted to 'comptime_int' must be comptime-known
test/cases/compile_errors/shifting_without_int_type_or_comptime_known.zig+4-4
...@@ -17,7 +17,7 @@ export fn entry3() void {...@@ -17,7 +17,7 @@ export fn entry3() void {
17// backend=stage217// backend=stage2
18// target=native18// target=native
19//19//
20// :2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be a comptime known20// :2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known
21// :5:17: error: LHS of shift must be a fixed-width integer type, or RHS must be a comptime known21// :5:17: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known
22// :9:9: error: LHS of shift must be a fixed-width integer type, or RHS must be a comptime known22// :9:9: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known
23// :13:9: error: LHS of shift must be a fixed-width integer type, or RHS must be a comptime known23// :13:9: error: LHS of shift must be a fixed-width integer type, or RHS must be comptime-known
test/cases/x86_64-linux/assert_function.8.zig+1-1
...@@ -22,4 +22,4 @@ pub fn assert(ok: bool) void {...@@ -22,4 +22,4 @@ pub fn assert(ok: bool) void {
22// error22// error
23//23//
24// :3:21: error: unable to resolve comptime value24// :3:21: error: unable to resolve comptime value
25// :3:21: note: condition in comptime branch must be comptime known25// :3:21: note: condition in comptime branch must be comptime-known
test/cases/x86_64-macos/assert_function.8.zig+1-1
...@@ -17,4 +17,4 @@ pub fn assert(ok: bool) void {...@@ -17,4 +17,4 @@ pub fn assert(ok: bool) void {
17// error17// error
18//18//
19// :5:21: error: unable to resolve comptime value19// :5:21: error: unable to resolve comptime value
20// :5:21: note: condition in comptime branch must be comptime known20// :5:21: note: condition in comptime branch must be comptime-known
test/compile_errors.zig+1-1
...@@ -203,7 +203,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -203,7 +203,7 @@ pub fn addCases(ctx: *TestContext) !void {
203 \\}203 \\}
204 , &[_][]const u8{204 , &[_][]const u8{
205 ":3:12: error: unable to resolve comptime value",205 ":3:12: error: unable to resolve comptime value",
206 ":3:12: note: argument to function being called at comptime must be comptime known",206 ":3:12: note: argument to function being called at comptime must be comptime-known",
207 ":2:55: note: generic function is instantiated with a comptime-only return type",207 ":2:55: note: generic function is instantiated with a comptime-only return type",
208 });208 });
209 }209 }