# Sema: handle inferred error set tail call · gitcafe/zig

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

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

Visibility: public

Requested revision: 97019bc56d27349e0aeb44faa9d3f738887abe7f

Requested commit: 97019bc56d27349e0aeb44faa9d3f738887abe7f

Commit: 97019bc56d27349e0aeb44faa9d3f738887abe7f

Tree: 4c9ceb095fa8885a21a77030108d8cae90173e3e

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: handle inferred error set tail call

When Sema sees a store_node instruction, it now checks for
the possibility of this pattern:
  %a = ret_ptr
  %b = store(%a, %c)
Where %c is an error union. In such case we need to add to the
current function's inferred error set, if any.

Coercion from error union to error union will be handled ideally if the
operand is comptime known. In such case it does the appropriate
unwrapping, then wraps again.

In the future, coercion from error union to error union should do the
same thing for a runtime value; emitting a runtime branch to check if
the value is an error or not.

`Value.arrayLen` for structs returns the number of fields. This is so
that Liveness can use it for the `vector_init` instruction (soon to be
renamed to `aggregate_init`).

```

## Parents

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

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