# Sema: fix compile error for switching on undefined union · gitcafe/zig

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

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

Visibility: public

Requested revision: 00ff123b1eb237f72f918ffd413c8d9c8936c46d

Requested commit: 00ff123b1eb237f72f918ffd413c8d9c8936c46d

Commit: 00ff123b1eb237f72f918ffd413c8d9c8936c46d

Tree: 7a42500140004999e5d8c28aa06fbf531a8de804

Author: John Schmidt

Committer: Andrew Kelley

## Message

```
Sema: fix compile error for switching on undefined union

Before this fix, passing an undefined union value to `Sema.switchCond`
returned an undefined value of the union type, not the tag type, since
`Value.unionTag` forwards undefined values unchanged.
This leads us into the `.Union` branch in `Sema.zirSwitchBlock` which is
unreachable, now we take the `.Enum` branch instead.

```

## Parents

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

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