# Sema: fix generic instantiations of return types with nested captures · gitcafe/zig

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

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

Visibility: public

Requested revision: 9821a0c6f0caf3df4cc6000c000d9cc38baf27d8

Requested commit: 9821a0c6f0caf3df4cc6000c000d9cc38baf27d8

Commit: 9821a0c6f0caf3df4cc6000c000d9cc38baf27d8

Tree: baa31bbf0e3fc3a5cbed557eb2a800ccbf2b55d6

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: fix generic instantiations of return types with nested captures

 * In semaStructFields and semaUnionFields we return error.GenericPoison
   if one of the field types ends up being generic poison.
   - This requires handling function calls and function types taking
     this into account when calling `typeRequiresComptime` on the return
     type.
 * Unrelated: I noticed using Valgrind that struct reification did not
   populate the `known_opv` field. After fixing it, the behavior tests
   run Valgrind-clean.
 * ZIR: use `@ptrCast` to cast between slices instead of exploiting
   the fact that stage1 incorrectly allows `@bitCast` between slices.
   - A future enhancement will make Zig support `@ptrCast` to directly
     cast between slices.

```

## Parents

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

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