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