You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The doctest enums.zig in the #enum section has this example:
// An enum variant of different types can be switched upon.constFoo=enum {
string,
number,
none,
};
test"enum variant switch" {
constp=Foo.number;
constwhat_is_it=switch (p) {
Foo.string=>"this is a string",
Foo.number=>"this is a number",
Foo.none=>"this is a none",
};
tryexpect(mem.eql(u8, what_is_it, "this is a number"));
}
However, IMHO, the term enum invariant is used incorrectly; this term can be used in Rust, but not in Zig. Also, the enum fields all have the same type.
NOTE: the term enum invariant is also used in #12186.
The text was updated successfully, but these errors were encountered:
The doctest
enums.zig
in the#enum
section has this example:However, IMHO, the term enum invariant is used incorrectly; this term can be used in Rust, but not in Zig. Also, the enum fields all have the same type.
NOTE: the term enum invariant is also used in #12186.
The text was updated successfully, but these errors were encountered: