diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-11-08 02:31:59 +0000 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2023-11-08 06:56:52 +0000 |
| commit | 4504e03a18d75d0c9e4695250c807b3b4a953791 (patch) | |
| tree | b517318ae077a2102c4f1bfbcf2b165f4381b5c0 /src/Sema.zig | |
| parent | ee47643b6eb175f4414a50c19afa0c22b2d15949 (diff) | |
| download | zig-4504e03a18d75d0c9e4695250c807b3b4a953791.tar.gz zig-4504e03a18d75d0c9e4695250c807b3b4a953791.zip | |
Sema: fix source location for untyped array init with result type
Resolves: #17923
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index b6cd17f438..8e34c9e4dc 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -4400,7 +4400,7 @@ fn zirValidateArrayInitTy( const mod = sema.mod; const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; const src = inst_data.src(); - const ty_src: LazySrcLoc = .{ .node_offset_init_ty = inst_data.src_node }; + const ty_src: LazySrcLoc = if (is_result_ty) src else .{ .node_offset_init_ty = inst_data.src_node }; const extra = sema.code.extraData(Zir.Inst.ArrayInit, inst_data.payload_index).data; const ty = sema.resolveType(block, ty_src, extra.ty) catch |err| switch (err) { // It's okay for the type to be unknown: this will result in an anonymous array init. |
