| ... | ... | @@ -19963,13 +19963,22 @@ fn finishStructInit( |
| 19963 | 19963 | |
| 19964 | 19964 | const field_init = struct_type.fieldInit(ip, i); |
| 19965 | 19965 | if (field_init == .none) { |
| 19966 | | const field_name = struct_type.field_names.get(ip)[i]; |
| 19967 | | const template = "missing struct field: {}"; |
| 19968 | | const args = .{field_name.fmt(ip)}; |
| 19969 | | if (root_msg) |msg| { |
| 19970 | | try sema.errNote(block, init_src, msg, template, args); |
| 19966 | if (!struct_type.isTuple(ip)) { |
| 19967 | const field_name = struct_type.field_names.get(ip)[i]; |
| 19968 | const template = "missing struct field: {}"; |
| 19969 | const args = .{field_name.fmt(ip)}; |
| 19970 | if (root_msg) |msg| { |
| 19971 | try sema.errNote(block, init_src, msg, template, args); |
| 19972 | } else { |
| 19973 | root_msg = try sema.errMsg(block, init_src, template, args); |
| 19974 | } |
| 19971 | 19975 | } else { |
| 19972 | | root_msg = try sema.errMsg(block, init_src, template, args); |
| 19976 | const template = "missing tuple field with index {d}"; |
| 19977 | if (root_msg) |msg| { |
| 19978 | try sema.errNote(block, init_src, msg, template, .{i}); |
| 19979 | } else { |
| 19980 | root_msg = try sema.errMsg(block, init_src, template, .{i}); |
| 19981 | } |
| 19973 | 19982 | } |
| 19974 | 19983 | } else { |
| 19975 | 19984 | field_inits[i] = Air.internedToRef(field_init); |