# sema: after block gets peer type resolved, insert type coercions · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/588171c30b34426fbb07645aa2625e989f369eec)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 588171c30b34426fbb07645aa2625e989f369eec

Requested commit: 588171c30b34426fbb07645aa2625e989f369eec

Commit: 588171c30b34426fbb07645aa2625e989f369eec

Tree: 254ff4567279c496dd61a4a790c64c64a8d7e763

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
sema: after block gets peer type resolved, insert type coercions

on the break instruction operands. This involves a new TZIR instruction,
br_block_flat, which represents a break instruction where the operand is
the result of a flat block. See the doc comments on the instructions for
more details.

How it works: when adding break instructions in semantic analysis, the
underlying allocation is slightly padded so that it is the size of a
br_block_flat instruction, which allows the break instruction to later
be converted without removing instructions inside the parent body. The
extra type coercion instructions go into the body of the br_block_flat,
and backends are responsible for dispatching the instruction correctly
(it should map to the same function calls for related instructions).

```

## Parents

- [06bb360dd296288db33844d682188e33116d7ab6](https://git.cafe/gitcafe/zig/commit/06bb360dd296288db33844d682188e33116d7ab6?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/588171c30b34426fbb07645aa2625e989f369eec?format=markdown)
