# astgen: improved handling of coercion · gitcafe/zig

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

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

Visibility: public

Requested revision: 3cebaaad1ca16a9e0203ed8c1684d0ce72da9487

Requested commit: 3cebaaad1ca16a9e0203ed8c1684d0ce72da9487

Commit: 3cebaaad1ca16a9e0203ed8c1684d0ce72da9487

Tree: a153e50f75fad0a1b6c683ad5c06e28e102ff848

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
astgen: improved handling of coercion

GenZir struct now has rl_ty_inst field which tracks the result location
type (if any) a block expects all of its results to be coerced to.

Remove a redundant coercion on const local initialization with a
specified type.

Switch expressions, during elision of store_to_block_ptr instructions,
now re-purpose them to be type coercion when the block has a type in the
result location.

```

## Parents

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

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