-
Notifications
You must be signed in to change notification settings - Fork 2
feat: enabled nullability and changed formatting standards to our editorconfig #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9269b4b
1235094
0d26b6c
7f75f09
07ae86a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ namespace wimm.Secundatives.UnitTests | |
| { | ||
| public class Result_Test | ||
| { | ||
| private readonly Error _err = new Error("BadDoot"); | ||
| private readonly Error _err = new("BadDoot"); | ||
|
|
||
| [Fact] | ||
| public void Error_ContainsValue_Throws() | ||
|
|
@@ -14,7 +14,6 @@ public void Error_ContainsValue_Throws() | |
| Assert.Throws<InvalidOperationException>(() => underTest.Error); | ||
| } | ||
|
|
||
|
|
||
| [Fact] | ||
| public void Value_ContainsError_Throws() | ||
| { | ||
|
|
@@ -29,7 +28,6 @@ public void Error_ContainsError_ReturnsError() | |
| Assert.Equal(_err, underTest.Error); | ||
| } | ||
|
|
||
|
|
||
| [Fact] | ||
| public void Value_ContainsValue_ReturnsValue() | ||
| { | ||
|
|
@@ -92,9 +90,7 @@ public void Ok_ContainsError_ReturnsNone() | |
| var underTest = ConstructErr(); | ||
| Assert.False(underTest.Ok().Exists); | ||
| } | ||
|
|
||
|
|
||
| private Result<int> ConstructInt() | ||
| private static Result<int> ConstructInt() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to leave no empty lines here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not |
||
| { | ||
| return 42; | ||
| } | ||
|
|
@@ -103,6 +99,5 @@ private Result<int> ConstructErr() | |
| { | ||
| return _err; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,8 @@ public static class FlattenExtensions | |
| /// The un-nested result of inspecting the outer result for error and returning it if it exists or the nested result itself otherwise | ||
| /// </returns> | ||
| public static Result<TValue, TErr> Flatten<TValue, TErr>(this Result<Result<TValue, TErr>, TErr> result) | ||
| where TValue : notnull | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I was going to say I think code using NRT (like this) would interpret code not using NRT as though all its types were nullable and then this constraint wouldn't be satisfied. Thinking a bit more though I'm not sure what We should just try it. I'll do it after supper if you don't beat me to it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good.
|
||
| where TErr : notnull | ||
| { | ||
| return result.IsValue ? result.Value : result.Error; | ||
| } | ||
|
|
@@ -31,6 +33,8 @@ public static Result<TValue, TErr> Flatten<TValue, TErr>(this Result<Result<TVal | |
| /// A task containing the un-nested result of inspecting the outer result for error and returning it if it exists or the nested result itself otherwise | ||
| /// </returns> | ||
| public static async Task<Result<TValue, TErr>> Flatten<TValue, TErr>(this Task<Result<Result<TValue, TErr>, TErr>> res) | ||
| where TValue : notnull | ||
| where TErr : notnull | ||
| { | ||
| var result = await res; | ||
| return result.IsValue ? result.Value : result.Error; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HA!