mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
type: fix onePossibleValue for auto numbered enums
This commit is contained in:
parent
f6bd534fc9
commit
26dfbf8122
@ -4511,7 +4511,11 @@ pub const Type = extern union {
|
||||
.enum_full => {
|
||||
const enum_full = ty.castTag(.enum_full).?.data;
|
||||
if (enum_full.fields.count() == 1) {
|
||||
return enum_full.values.keys()[0];
|
||||
if (enum_full.values.count() == 0) {
|
||||
return Value.zero;
|
||||
} else {
|
||||
return enum_full.values.keys()[0];
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user