diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-01-15 23:13:44 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-01-15 23:13:44 -0700 |
| commit | 7f41e20802fd8f9eb19c0218f1e2000e2751592a (patch) | |
| tree | 535a39fbae2c811e4c7af03b36cf52b3f164ad73 /lib/std/bounded_array.zig | |
| parent | 7c6f5d26eadb137ab3fb2be340485ebd860a85fe (diff) | |
| download | zig-7f41e20802fd8f9eb19c0218f1e2000e2751592a.tar.gz zig-7f41e20802fd8f9eb19c0218f1e2000e2751592a.zip | |
AstGen: emit `as` instructions for branching expressions
There is a mechanism to avoid redundant `as` ZIR instructions which is
to pass `ResultLoc.coerced_ty` instead of `ResultLoc.ty` when it is
known by AstGen that Sema will do the coercion.
This commit downgrades `coerced_ty` to `ty` when a result location
passes through an expression that branches, such as `if`, `switch`,
`while`, and `for`, causing the `as` ZIR instruction to be emitted.
This ensures that the type of a result location will be applied to, e.g.
a `comptime_int` on either side of a branch on a runtime condition.
Diffstat (limited to 'lib/std/bounded_array.zig')
0 files changed, 0 insertions, 0 deletions
