λ1009: Do not use default to instantiate this type
Types marked [NonDefaultable] must not be created with default or a parameterless constructor.
Cause
A default(T) expression, a default literal, or a parameterless new T() is used with a struct marked with [NonDefaultable].
This applies to Either<L, R>, Result<T> and EitherOrBoth<L, R>.
Reason for rule
These structs have no meaningful "empty" state: an Either is always Left or Right, a Result is always Ok or Error.
A default instance is in neither state. Every member on such an instance throws, so a default value is a latent bug
that surfaces far away from where it was created.
Option<T> is not affected, because its default is a valid None.
How to fix violations
Construct the value explicitly using one of the constructors, such as Either<L, R>.Left(...), Either<L>.Return(...),
Result.Return(...) or Result<T>.Error(...).
Examples
Disallowed
Result<int> result = default;
var either = default(Either<string, int>);
var eitherOrBoth = new EitherOrBoth<string, int>();
Allowed
Result<int> result = Result.Return(42);
var either = Either<string, int>.Left("error");
var eitherOrBoth = EitherOrBoth<string, int>.Both("left", 42);
// Option<T> has a valid default state.
Option<int> none = default;