diff --git a/MaybeError/MaybeError.csproj b/MaybeError/MaybeError.csproj index ea3c177..203d4d7 100644 --- a/MaybeError/MaybeError.csproj +++ b/MaybeError/MaybeError.csproj @@ -8,7 +8,7 @@ MaybeError - 1.0.3 + 1.0.4 Amatsugu Errors as values https://github.com/Amatsugu/MaybeError diff --git a/MaybeError/ValueMaybe.cs b/MaybeError/ValueMaybe.cs index e29fce5..9c91044 100644 --- a/MaybeError/ValueMaybe.cs +++ b/MaybeError/ValueMaybe.cs @@ -9,6 +9,7 @@ public interface IValueMaybe where T : struct where E : Error { [MemberNotNullWhen(true, nameof(Error))] bool HasError { get; } + [MemberNotNullWhen(false, nameof(Error))] bool HasValue => !HasError; E? Error { get; } T Value { get; } @@ -18,6 +19,7 @@ public readonly struct ValueMaybe : IValueMaybe where T : struct whe { [MemberNotNullWhen(true, nameof(Error))] public readonly bool HasError { get; } + [MemberNotNullWhen(false, nameof(Error))] public readonly bool HasValue => !HasError; public readonly E? Error { get; } public readonly T Value => HasError ? throw Error.GetException() : _value;