From 4e64373fc07a1e24735bcbdfd463e11839c8c273 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Fri, 30 Dec 2022 14:28:04 +0200 Subject: fix generic function arg debug info referencing wrong parameter Closes #14123 --- src/Sema.zig | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/Sema.zig') diff --git a/src/Sema.zig b/src/Sema.zig index 6546708aaa..05ea86c387 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -476,13 +476,6 @@ pub const Block = struct { }); } - fn addArg(block: *Block, ty: Type) error{OutOfMemory}!Air.Inst.Ref { - return block.addInst(.{ - .tag = .arg, - .data = .{ .ty = ty }, - }); - } - fn addStructFieldPtr( block: *Block, struct_ptr: Air.Inst.Ref, @@ -7258,7 +7251,13 @@ fn instantiateGenericCall( } else { // We insert into the map an instruction which is runtime-known // but has the type of the argument. - const child_arg = try child_block.addArg(arg_ty); + const child_arg = try child_block.addInst(.{ + .tag = .arg, + .data = .{ .arg = .{ + .ty = try child_sema.addType(arg_ty), + .src_index = @intCast(u32, arg_i), + } }, + }); child_sema.inst_map.putAssumeCapacityNoClobber(inst, child_arg); } } -- cgit v1.2.3