0ad1239522
* @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
10 lines
219 B
Zig
10 lines
219 B
Zig
const E = union(enum) { A: [9]u8, B: u64, };
|
|
const S = struct { x: u8, y: E, };
|
|
|
|
const assert = @import("std").debug.assert;
|
|
|
|
test "bug 394 fixed" {
|
|
const x = S { .x = 3, .y = E {.B = 1 } };
|
|
assert(x.x == 3);
|
|
}
|