fix generic function arg debug info referencing wrong parameter

Closes #14123
This commit is contained in:
Veikka Tuominen
2022-12-30 14:28:04 +02:00
parent 4b5fc5239c
commit 4e64373fc0
12 changed files with 48 additions and 38 deletions

View File

@@ -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);
}
}