zig/test/behavior/bugs/7047.zig
Andrew Kelley 4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00

23 lines
441 B
Zig

const std = @import("std");
const U = union(enum) {
T: type,
N: void,
};
fn S(comptime query: U) type {
return struct {
fn tag() type {
return query.T;
}
};
}
test "compiler doesn't consider equal unions with different 'type' payload" {
const s1 = S(U{ .T = u32 }).tag();
std.testing.expectEqual(u32, s1);
const s2 = S(U{ .T = u64 }).tag();
std.testing.expectEqual(u64, s2);
}