diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-07-07 19:50:56 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-07 19:50:56 -0700 |
| commit | 5c8bd443d92c6306f60857720103ae46ca7b8b3e (patch) | |
| tree | fbac6bd8a6d337ef035b07ef766b3718f91e0781 /src/type.zig | |
| parent | 5816997ae79c6025d5f85aab0c9ab456fecadec9 (diff) | |
| download | zig-5c8bd443d92c6306f60857720103ae46ca7b8b3e.tar.gz zig-5c8bd443d92c6306f60857720103ae46ca7b8b3e.zip | |
stage2: fix if expressions on error unions
AstGen had the then-else logic backwards for if expressions
on error unions. This commit fixes it.
Turns out AstGen only really needs `is_non_null` and `is_non_err`,
and does not need the `is_null` or `is_err` variants. So I removed the
`is_null{,_ptr}` and `is_err{,_ptr}` ZIR instructions (-4) and
added `is_non_err`, `is_non_err_ptr` ZIR instructions (+2) for
a total of (-2) ZIR instructions, giving us a tiny bit more headroom
within the 256 tag limit. This required swapping the order of
then/else blocks in a handful of cases, but ultimately means the
ZIR will be in the same as source order, which is convenient
when debugging.
AIR code on the other hand, gains the `is_non_err` and `is_non_err_ptr`
instructions.
Sema: fix logic in zirErrUnionCode and zirErrUnionCodePtr returning the
wrong result type.
Diffstat (limited to 'src/type.zig')
0 files changed, 0 insertions, 0 deletions
