| ... | ... | @@ -19705,20 +19705,24 @@ fn zirArrayInit( |
| 19705 | 19705 | }, |
| 19706 | 19706 | else => return err, |
| 19707 | 19707 | }; |
| 19708 | | if (is_tuple) if (try array_ty.structFieldValueComptime(mod, i)) |field_val| { |
| 19709 | | const init_val = try sema.resolveValue(dest.*) orelse { |
| 19710 | | const decl = mod.declPtr(block.src_decl); |
| 19711 | | const elem_src = mod.initSrc(src.node_offset.x, decl, i); |
| 19712 | | return sema.failWithNeededComptime(block, elem_src, .{ |
| 19713 | | .needed_comptime_reason = "value stored in comptime field must be comptime-known", |
| 19714 | | }); |
| 19715 | | }; |
| 19716 | | if (!field_val.eql(init_val, elem_ty, mod)) { |
| 19717 | | const decl = mod.declPtr(block.src_decl); |
| 19718 | | const elem_src = mod.initSrc(src.node_offset.x, decl, i); |
| 19719 | | return sema.failWithInvalidComptimeFieldStore(block, elem_src, array_ty, i); |
| 19708 | if (is_tuple) { |
| 19709 | if (array_ty.structFieldIsComptime(i, mod)) |
| 19710 | try sema.resolveStructFieldInits(array_ty); |
| 19711 | if (try array_ty.structFieldValueComptime(mod, i)) |field_val| { |
| 19712 | const init_val = try sema.resolveValue(dest.*) orelse { |
| 19713 | const decl = mod.declPtr(block.src_decl); |
| 19714 | const elem_src = mod.initSrc(src.node_offset.x, decl, i); |
| 19715 | return sema.failWithNeededComptime(block, elem_src, .{ |
| 19716 | .needed_comptime_reason = "value stored in comptime field must be comptime-known", |
| 19717 | }); |
| 19718 | }; |
| 19719 | if (!field_val.eql(init_val, elem_ty, mod)) { |
| 19720 | const decl = mod.declPtr(block.src_decl); |
| 19721 | const elem_src = mod.initSrc(src.node_offset.x, decl, i); |
| 19722 | return sema.failWithInvalidComptimeFieldStore(block, elem_src, array_ty, i); |
| 19723 | } |
| 19720 | 19724 | } |
| 19721 | | }; |
| 19725 | } |
| 19722 | 19726 | } |
| 19723 | 19727 | |
| 19724 | 19728 | if (root_msg) |msg| { |
| ... | ... | @@ -31481,7 +31485,10 @@ fn coerceTupleToTuple( |
| 31481 | 31485 | anon_struct_type.names.get(ip)[field_i] |
| 31482 | 31486 | else |
| 31483 | 31487 | try ip.getOrPutStringFmt(sema.gpa, "{d}", .{field_i}), |
| 31484 | | .struct_type => |struct_type| struct_type.field_names.get(ip)[field_i], |
| 31488 | .struct_type => |struct_type| if (struct_type.field_names.len > 0) |
| 31489 | struct_type.field_names.get(ip)[field_i] |
| 31490 | else |
| 31491 | try ip.getOrPutStringFmt(sema.gpa, "{d}", .{field_i}), |
| 31485 | 31492 | else => unreachable, |
| 31486 | 31493 | }; |
| 31487 | 31494 | |