mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
Sema: resoveTypeLayout resolves optionals and error unions too
Previously it only worked on struct, union, and array.
This commit is contained in:
parent
6cd14f051d
commit
912e7dc54b
@ -13662,6 +13662,15 @@ pub fn resolveTypeLayout(
|
||||
const elem_ty = ty.childType();
|
||||
return sema.resolveTypeLayout(block, src, elem_ty);
|
||||
},
|
||||
.Optional => {
|
||||
var buf: Type.Payload.ElemType = undefined;
|
||||
const payload_ty = ty.optionalChild(&buf);
|
||||
return sema.resolveTypeLayout(block, src, payload_ty);
|
||||
},
|
||||
.ErrorUnion => {
|
||||
const payload_ty = ty.errorUnionPayload();
|
||||
return sema.resolveTypeLayout(block, src, payload_ty);
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user