master
 1const std = @import("std");
 2const expect = std.testing.expect;
 3
 4const Number = union {
 5    int: i32,
 6    float: f64,
 7};
 8
 9test "anonymous union literal syntax" {
10    const i: Number = .{ .int = 42 };
11    const f = makeNumber();
12    try expect(i.int == 42);
13    try expect(f.float == 12.34);
14}
15
16fn makeNumber() Number {
17    return .{ .float = 12.34 };
18}
19
20// test