# Sema: fix generics with struct literal coerced to tagged union · gitcafe/zig

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

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

Visibility: public

Requested revision: c764640e92c9e4d32b89650ac774bebf1498be92

Requested commit: c764640e92c9e4d32b89650ac774bebf1498be92

Commit: c764640e92c9e4d32b89650ac774bebf1498be92

Tree: 5b17ee88da0d6499007a36a3a4b701c5d8f44a81

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: fix generics with struct literal coerced to tagged union

The `Value.eql` function has to test for value equality *as-if* the lhs
value parameter is coerced into the type of the rhs. For tagged unions,
there was a problematic case when the lhs was an anonymous struct,
because in such case the value is empty_struct_value and the type
contains all the value information. But the only type available in the
function was the rhs type.

So the fix involved making `Value.eqlAdvanced` also accept the lhs type,
and then enhancing the logic to handle the case of the `.anon_struct` tag.

closes #12418

Tests run locally:
 * test-behavior
 * test-cases

```

## Parents

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

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