Skip to content

Conversation

@T-Gro
Copy link
Member

@T-Gro T-Gro commented Jul 9, 2024

This feature is driven by an occurence of BCL type design which I encountered during testing.

IEqualityComparer<in T>
StringComparer.Ordinal : IEqualityComparer<string | null>
But constructors of all dictionary-like types needing an IEqualityComparer<string>

Which would not much.
At the same time, natural conversion from Type<T | null> to Type cannot be done out of the box, since we cannot control how the T is used internally.
This nullness-equality relaxation can only be done for contravariant generic parameters (<in T>), which is used for interfaces taking the generic typar in its input.

@T-Gro T-Gro requested a review from vzarytovskii July 10, 2024 08:26
@T-Gro T-Gro marked this pull request as ready for review July 11, 2024 07:29
@T-Gro T-Gro requested a review from a team as a code owner July 11, 2024 07:29
@T-Gro T-Gro merged commit 57026b8 into feature/nullness Jul 11, 2024
@T-Gro T-Gro deleted the feature-nullness-variance branch July 11, 2024 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants