| ... | ... | @@ -6997,10 +6997,14 @@ fn analyzeCall( |
| 6997 | 6997 | var has_comptime_args = false; |
| 6998 | 6998 | var arg_i: u32 = 0; |
| 6999 | 6999 | for (fn_info.param_body) |inst| { |
| 7000 | | const arg_src: LazySrcLoc = .{ .call_arg = .{ |
| 7001 | | .call_node_offset = call_src.node_offset.x, |
| 7002 | | .arg_index = arg_i, |
| 7003 | | } }; |
| 7000 | const arg_src: LazySrcLoc = if (arg_i == 0 and bound_arg_src != null) |
| 7001 | bound_arg_src.? |
| 7002 | else |
| 7003 | .{ .call_arg = .{ |
| 7004 | .decl = block.src_decl, |
| 7005 | .call_node_offset = call_src.node_offset.x, |
| 7006 | .arg_index = arg_i - @intFromBool(bound_arg_src != null), |
| 7007 | } }; |
| 7004 | 7008 | try sema.analyzeInlineCallArg( |
| 7005 | 7009 | block, |
| 7006 | 7010 | &child_block, |
| ... | ... | @@ -7356,7 +7360,7 @@ fn analyzeInlineCallArg( |
| 7356 | 7360 | } |
| 7357 | 7361 | const casted_arg = sema.coerceExtra(arg_block, param_ty.toType(), uncasted_arg, arg_src, .{ .param_src = .{ |
| 7358 | 7362 | .func_inst = func_inst, |
| 7359 | | .param_i = @as(u32, @intCast(arg_i.*)), |
| 7363 | .param_i = @intCast(arg_i.*), |
| 7360 | 7364 | } }) catch |err| switch (err) { |
| 7361 | 7365 | error.NotCoercible => unreachable, |
| 7362 | 7366 | else => |e| return e, |
| ... | ... | @@ -7586,6 +7590,7 @@ fn instantiateGenericCall( |
| 7586 | 7590 | const arg_src: LazySrcLoc = if (total_i == 0 and bound_arg_src != null) |
| 7587 | 7591 | bound_arg_src.? |
| 7588 | 7592 | else if (call_src == .node_offset) .{ .call_arg = .{ |
| 7593 | .decl = block.src_decl, |
| 7589 | 7594 | .call_node_offset = call_src.node_offset.x, |
| 7590 | 7595 | .arg_index = @intCast(total_i), |
| 7591 | 7596 | } } else .unneeded; |
| ... | ... | @@ -8729,6 +8734,7 @@ fn funcCommon( |
| 8729 | 8734 | break :blk @as(u1, @truncate(noalias_bits >> index)) != 0; |
| 8730 | 8735 | }; |
| 8731 | 8736 | const param_src: LazySrcLoc = .{ .fn_proto_param = .{ |
| 8737 | .decl = block.src_decl, |
| 8732 | 8738 | .fn_proto_node_offset = src_node_offset, |
| 8733 | 8739 | .param_index = @intCast(i), |
| 8734 | 8740 | } }; |
| ... | ... | @@ -9316,9 +9322,10 @@ fn zirParamAnytype( |
| 9316 | 9322 | return; |
| 9317 | 9323 | } |
| 9318 | 9324 | const arg_src: LazySrcLoc = if (sema.generic_call_src == .node_offset) .{ .call_arg = .{ |
| 9325 | .decl = sema.generic_call_decl.unwrap().?, |
| 9319 | 9326 | .call_node_offset = sema.generic_call_src.node_offset.x, |
| 9320 | 9327 | .arg_index = param_index, |
| 9321 | | } } else .unneeded; |
| 9328 | } } else src; |
| 9322 | 9329 | |
| 9323 | 9330 | if (comptime_syntax) { |
| 9324 | 9331 | if (try sema.resolveMaybeUndefVal(air_ref)) |val| { |
| ... | ... | @@ -9326,15 +9333,7 @@ fn zirParamAnytype( |
| 9326 | 9333 | return; |
| 9327 | 9334 | } |
| 9328 | 9335 | const msg = msg: { |
| 9329 | | const fallback_src = src.toSrcLoc(mod.declPtr(block.src_decl), mod); |
| 9330 | | const src_loc = if (sema.generic_call_decl.unwrap()) |decl| |
| 9331 | | if (arg_src != .unneeded) |
| 9332 | | arg_src.toSrcLoc(mod.declPtr(decl), mod) |
| 9333 | | else |
| 9334 | | fallback_src |
| 9335 | | else |
| 9336 | | fallback_src; |
| 9337 | | |
| 9336 | const src_loc = arg_src.toSrcLoc(mod.declPtr(block.src_decl), mod); |
| 9338 | 9337 | const msg = try Module.ErrorMsg.create(gpa, src_loc, "{s}", .{ |
| 9339 | 9338 | @as([]const u8, "runtime-known argument passed to comptime parameter"), |
| 9340 | 9339 | }); |
| ... | ... | @@ -9354,15 +9353,7 @@ fn zirParamAnytype( |
| 9354 | 9353 | return; |
| 9355 | 9354 | } |
| 9356 | 9355 | const msg = msg: { |
| 9357 | | const fallback_src = src.toSrcLoc(mod.declPtr(block.src_decl), mod); |
| 9358 | | const src_loc = if (sema.generic_call_decl.unwrap()) |decl| |
| 9359 | | if (arg_src != .unneeded) |
| 9360 | | arg_src.toSrcLoc(mod.declPtr(decl), mod) |
| 9361 | | else |
| 9362 | | fallback_src |
| 9363 | | else |
| 9364 | | fallback_src; |
| 9365 | | |
| 9356 | const src_loc = arg_src.toSrcLoc(mod.declPtr(block.src_decl), mod); |
| 9366 | 9357 | const msg = try Module.ErrorMsg.create(gpa, src_loc, "{s}", .{ |
| 9367 | 9358 | @as([]const u8, "runtime-known argument passed to comptime-only type parameter"), |
| 9368 | 9359 | }); |