fix nullable annotation for ImmutableInterlocked.Update methods (#40459)
authorEirik Tsarpalis <eirik.tsarpalis@gmail.com>
Fri, 7 Aug 2020 14:09:56 +0000 (15:09 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Aug 2020 14:09:56 +0000 (15:09 +0100)
src/libraries/System.Collections.Immutable/ref/System.Collections.Immutable.cs
src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableInterlocked.cs

index c8daf5a..5c77291 100644 (file)
@@ -520,8 +520,8 @@ namespace System.Collections.Immutable
         public static bool TryPop<T>(ref System.Collections.Immutable.ImmutableStack<T> location, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T value) { throw null; }
         public static bool TryRemove<TKey, TValue>(ref System.Collections.Immutable.ImmutableDictionary<TKey, TValue> location, TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) where TKey : notnull { throw null; }
         public static bool TryUpdate<TKey, TValue>(ref System.Collections.Immutable.ImmutableDictionary<TKey, TValue> location, TKey key, TValue newValue, TValue comparisonValue) where TKey : notnull { throw null; }
-        public static bool Update<T>(ref T location, System.Func<T, T> transformer) where T : class { throw null; }
-        public static bool Update<T, TArg>(ref T location, System.Func<T, TArg, T> transformer, TArg transformerArgument) where T : class { throw null; }
+        public static bool Update<T>(ref T location, System.Func<T, T> transformer) where T : class? { throw null; }
+        public static bool Update<T, TArg>(ref T location, System.Func<T, TArg, T> transformer, TArg transformerArgument) where T : class? { throw null; }
         public static bool Update<T>(ref System.Collections.Immutable.ImmutableArray<T> location, Func<System.Collections.Immutable.ImmutableArray<T>, System.Collections.Immutable.ImmutableArray<T>> transformer) { throw null; }
         public static bool Update<T, TArg>(ref System.Collections.Immutable.ImmutableArray<T> location, Func<System.Collections.Immutable.ImmutableArray<T>, TArg, System.Collections.Immutable.ImmutableArray<T>> transformer, TArg transformerArgument) { throw null; }
     }
index 6d3ba17..f907de4 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Collections.Immutable
         /// <c>false</c> if the location's value remained the same because the last
         /// invocation of <paramref name="transformer"/> returned the existing value.
         /// </returns>
-        public static bool Update<T>(ref T location, Func<T, T> transformer) where T : class
+        public static bool Update<T>(ref T location, Func<T, T> transformer) where T : class?
         {
             Requires.NotNull(transformer, nameof(transformer));
 
@@ -74,7 +74,7 @@ namespace System.Collections.Immutable
         /// <c>false</c> if the location's value remained the same because the last
         /// invocation of <paramref name="transformer"/> returned the existing value.
         /// </returns>
-        public static bool Update<T, TArg>(ref T location, Func<T, TArg, T> transformer, TArg transformerArgument) where T : class
+        public static bool Update<T, TArg>(ref T location, Func<T, TArg, T> transformer, TArg transformerArgument) where T : class?
         {
             Requires.NotNull(transformer, nameof(transformer));