# rework enums and unions and their relationship to each other · gitcafe/zig

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

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

Visibility: public

Requested revision: 0ad1239522c70418990dc7b9da4e128da7cdd1d5

Requested commit: 0ad1239522c70418990dc7b9da4e128da7cdd1d5

Commit: 0ad1239522c70418990dc7b9da4e128da7cdd1d5

Tree: 3a434788633db0a3d6e30f779fc1239a7513205a

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
rework enums and unions and their relationship to each other

 * @enumTagName renamed to @tagName and it works on enums and
   union-enums
 * Remove the EnumTag type. Now there is only enum and union,
   and the tag type of a union is always an enum.
 * unions support specifying the tag enum type, and they support
   inferring an enum tag type.
 * Enums no longer support field types but they do support
   setting the tag values. Likewise union-enums when inferring
   an enum tag type support setting the tag values.
 * It is now an error for enums and unions to have 0 fields.
 * switch statements support union-enums

closes #618

```

## Parents

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

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