Skip to content

Skip emptiness handling if type cannot be empty #30

@mknejp

Description

@mknejp

If a variant class has no default constructor and all other constructors initialize the _variant field to a non-default value then the variant cannot be empty. Under these circumstances the "empty" case is impossible to achieve and can be removed from the interface as these code paths will never execute.

Possible conflict: if constructors are later changed and the empty state becomes possible the previously safe methods could now throw InvalidOperationException. Maybe keeping the empty state is the safer option as it reminds the user of this eventuality. This needs investigating.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions