| ... | @@ -37125,7 +37125,7 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Key.Un | ... | @@ -37125,7 +37125,7 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Key.Un |
| 37125 | const msg = msg: { | 37125 | const msg = msg: { |
| 37126 | const ty_src = mod.fieldSrcLoc(union_type.decl, .{ | 37126 | const ty_src = mod.fieldSrcLoc(union_type.decl, .{ |
| 37127 | .index = field_i, | 37127 | .index = field_i, |
| 37128 | .range = .type, | 37128 | .range = .name, |
| 37129 | }).lazy; | 37129 | }).lazy; |
| 37130 | const msg = try sema.errMsg(&block_scope, ty_src, "no field named '{}' in enum '{}'", .{ | 37130 | const msg = try sema.errMsg(&block_scope, ty_src, "no field named '{}' in enum '{}'", .{ |
| 37131 | field_name.fmt(ip), Type.fromInterned(union_type.tagTypePtr(ip).*).fmt(mod), | 37131 | field_name.fmt(ip), Type.fromInterned(union_type.tagTypePtr(ip).*).fmt(mod), |
| ... | @@ -37136,6 +37136,7 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Key.Un | ... | @@ -37136,6 +37136,7 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Key.Un |
| 37136 | }; | 37136 | }; |
| 37137 | return sema.failWithOwnedErrorMsg(&block_scope, msg); | 37137 | return sema.failWithOwnedErrorMsg(&block_scope, msg); |
| 37138 | }; | 37138 | }; |
| | 37139 | |
| 37139 | // No check for duplicate because the check already happened in order | 37140 | // No check for duplicate because the check already happened in order |
| 37140 | // to create the enum type in the first place. | 37141 | // to create the enum type in the first place. |
| 37141 | assert(!explicit_tags_seen[enum_index]); | 37142 | assert(!explicit_tags_seen[enum_index]); |
| ... | @@ -37146,14 +37147,15 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Key.Un | ... | @@ -37146,14 +37147,15 @@ fn semaUnionFields(mod: *Module, arena: Allocator, union_type: InternPool.Key.Un |
| 37146 | const msg = msg: { | 37147 | const msg = msg: { |
| 37147 | const ty_src = mod.fieldSrcLoc(union_type.decl, .{ | 37148 | const ty_src = mod.fieldSrcLoc(union_type.decl, .{ |
| 37148 | .index = field_i, | 37149 | .index = field_i, |
| 37149 | .range = .type, | 37150 | .range = .name, |
| 37150 | }).lazy; | 37151 | }).lazy; |
| 37151 | const enum_field_src = mod.fieldSrcLoc(tag_info.decl, .{ .index = enum_index }).lazy; | 37152 | const enum_field_src = mod.fieldSrcLoc(tag_info.decl, .{ .index = enum_index }).lazy; |
| 37152 | const msg = try sema.errMsg(&block_scope, ty_src, "union field '{}' ordered differently than corresponding enum field", .{ | 37153 | const msg = try sema.errMsg(&block_scope, ty_src, "union field '{}' ordered differently than corresponding enum field", .{ |
| 37153 | field_name.fmt(ip), | 37154 | field_name.fmt(ip), |
| 37154 | }); | 37155 | }); |
| 37155 | errdefer msg.destroy(sema.gpa); | 37156 | errdefer msg.destroy(sema.gpa); |
| 37156 | try sema.errNote(&block_scope, enum_field_src, msg, "enum field here", .{}); | 37157 | const decl_ptr = mod.declPtr(tag_info.decl); |
| | 37158 | try mod.errNoteNonLazy(enum_field_src.toSrcLoc(decl_ptr, mod), msg, "enum field here", .{}); |
| 37157 | break :msg msg; | 37159 | break :msg msg; |
| 37158 | }; | 37160 | }; |
| 37159 | return sema.failWithOwnedErrorMsg(&block_scope, msg); | 37161 | return sema.failWithOwnedErrorMsg(&block_scope, msg); |