Closed bernardnormier closed 9 months ago
The reason is to disallow this:
enum Foo: uint8 {
A()
}
Using field syntax within an enum-with-an-underlying-type. Even though this enum technically doesn't have any fields, it seemed cleaner to me to disallow even the syntax.
If we only stored a Vec
, we couldn't distinguish between A
and A()
.
This change was implemented in #685
This change meaning:
Changes fields to return a Vec
instead of an Option<Vec > for easier use (None => vec![]).
The associated fields of an Enumerator are an:
And apparently, when slicec parses an enumerator, it:
E()
as a non-null empty vector of fieldsE
as a null vector of fieldsThis seems overcomplicated. Why not simply:
with an empty vec in the common situation where the enumerator has no associated field.