This code causes Expression_Atom to be an invalid union variant only when actually switched on. I could not manage to minimally reproduce it but it manifests in a bigger codebase with essentially the same code as below (everything else commented out). Removing the args field from Expression_Call makes the error go away. Does this break some union/generic rule that I'm not aware off? After flattening Expression_Atom into Expression everything is fine.
`Link :: struct(T: typeid) {
value: T,
next: ^Link(T),
}
Expression :: union {
Expression_Atom,
// ...
}
Expression_Atom :: union {
i64,
string,
Expression_Call,
}
Expression_Call :: struct {
name: string,
args: ^Link(Expression),
}
switch_atom :: proc(atom: Expression_Atom) {
switch a in atom {
case i64:
case string:
case Expression_Call:
case nil:
}
}
`
(sorry for the title lol)