You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect nullable annotations on most MemoryExtensions methods #73457
where the T is constrained to be IEquatable<T>. The questionable nature of the constraint in general aside (we can use EqualityComparer<T>.Default), the constraint is too strict with regards to nullable reference types. The constraint should be where T : IEquatable<T>? rather than where T : IEquatable<T>; otherwise, it's prohibiting nullable Ts, e.g. this erroneously warns:
warning CS8631: The type 'string?' cannot be used as type parameter 'T' in the generic type or method 'MemoryExtensions.Contains<T>(Span<T>, T)'. Nullability of type argument 'string?' doesn't match constraint type 'System.IEquatable<string?>'.
We need to audit all such constraints and fix them.
Activity