Skip to content

Conversation

@Insomniak47
Copy link
Member

@Insomniak47 Insomniak47 commented Aug 14, 2022

Also added nullable type constraints everywhere they were required

PR Question: Should this be a major version increment? It shouldn't break anything but the notnull constraints themselves might cause some issues.

Also updated twae settings - closes #67

# CA2007: Consider calling ConfigureAwait on the awaited task
# In almost all cases in dotnet core this is unnecessary as there is syncronization context
dotnet_diagnostic.CA2007.severity = none No newline at end of file
# In almost all cases in dotnet core this is unnecessary as there is no synchronization context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HA!



private Result<int> ConstructInt()
private static Result<int> ConstructInt()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave no empty lines here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not

/// 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
Copy link
Member

@ttd2089 ttd2089 Aug 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think this is breaking

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 notnull means in non-NRT contexts. If it means value types then this is breaking, but if it means not declared with ? then it's probably fine?

We should just try it. I'll do it after supper if you don't beat me to it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good.

The notnull constraint is available starting in C# 8.0 for code compiled in a nullable enable context. Unlike other constraints, if a type argument violates the notnull constraint, the compiler generates a warning instead of an error. Warnings are only generated in a nullable enable context.
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/where-generic-type-constraint

{
Min = Require(min, nameof(min));
Max = Require(max, nameof(max));
Min = Range<T>.Require(min, nameof(min));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is qualification required here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check. This might have just been compiler fighting

var wType = typeof(W);

if (!IsAssignableFromMemberType(wType))
if (!Variant<T, U>.IsAssignableFromMemberType(wType))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is qualification required here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explain or update the TWAE properties in csproj

2 participants