# frontend: make fn calls byval; fix false positive isNonErr · gitcafe/zig

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

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

Visibility: public

Requested revision: e66190025ffab39527da601980b7e3211069b6f5

Requested commit: e66190025ffab39527da601980b7e3211069b6f5

Commit: e66190025ffab39527da601980b7e3211069b6f5

Tree: a5ab77ea514c9993edcbd9335ad3904cebefd7bd

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
frontend: make fn calls byval; fix false positive isNonErr

This commit does two things which seem unrelated at first, but,
together, solve a miscompilation, and potentially slightly speed up
compiler perf, at the expense of making #2765 trickier to implement in
the future.

Sema: avoid returning a false positive for whether an inferred error set
is comptime-known to be empty.

AstGen: mark function calls as not being interested in a result
location. This prevents the test case "ret_ptr doesn't cause own
inferred error set to be resolved" from being regressed. If we want to
accept and implement #2765 in the future, it will require solving this
problem a different way, but the principle of YAGNI tells us to go ahead
with this change.

Old ZIR looks like this:

  %97 = ret_ptr()
  %101 = store_node(%97, %100)
  %102 = load(%97)
  %103 = ret_is_non_err(%102)

New ZIR looks like this:

  %97 = ret_type()
  %101 = as_node(%97, %100)
  %102 = ret_is_non_err(%101)

closes #15669

```

## Parents

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

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