Skip to content

Commit

Permalink
sema fixey fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mlugg authored and jacobly0 committed Aug 11, 2024
1 parent 8f361d6 commit d1fa1b6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Sema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27668,21 +27668,21 @@ fn fieldVal(
return Air.internedToRef(enum_val.toIntern());
},
.Struct, .Opaque => {
if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(mod), field_name)) |inst| {
return inst;
switch (child_type.toIntern()) {
.empty_struct_type, .anyopaque_type => {}, // no namespace
else => if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(mod), field_name)) |inst| {
return inst;
},
}
return sema.failWithBadMemberAccess(block, child_type, src, field_name);
},
else => {
const msg = msg: {
const msg = try sema.errMsg(src, "type '{}' has no members", .{child_type.fmt(pt)});
errdefer msg.destroy(sema.gpa);
if (child_type.isSlice(mod)) try sema.errNote(src, msg, "slice values have 'len' and 'ptr' members", .{});
if (child_type.zigTypeTag(mod) == .Array) try sema.errNote(src, msg, "array values have 'len' member", .{});
break :msg msg;
};
return sema.failWithOwnedErrorMsg(block, msg);
},
else => return sema.failWithOwnedErrorMsg(block, msg: {
const msg = try sema.errMsg(src, "type '{}' has no members", .{child_type.fmt(pt)});
errdefer msg.destroy(sema.gpa);
if (child_type.isSlice(mod)) try sema.errNote(src, msg, "slice values have 'len' and 'ptr' members", .{});
if (child_type.zigTypeTag(mod) == .Array) try sema.errNote(src, msg, "array values have 'len' member", .{});
break :msg msg;
}),
}
},
.Struct => if (is_pointer_to) {
Expand Down

0 comments on commit d1fa1b6

Please sign in to comment.