Nullability: RuntimeHelpers.GetHashCode should accept null obj input (#31819)
authorLevi Broderick <GrabYourPitchforks@users.noreply.github.com>
Thu, 6 Feb 2020 02:50:38 +0000 (18:50 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2020 02:50:38 +0000 (21:50 -0500)
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
src/libraries/System.Runtime/ref/System.Runtime.cs
src/mono/netcore/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

index 3f2c4d0..0f2f96e 100644 (file)
@@ -107,7 +107,7 @@ namespace System.Runtime.CompilerServices
         public static extern void PrepareDelegate(Delegate d);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        public static extern int GetHashCode(object o);
+        public static extern int GetHashCode(object? o);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         public static extern new bool Equals(object? o1, object? o2);
index 9e91c7f..af0088d 100644 (file)
@@ -7273,7 +7273,7 @@ namespace System.Runtime.CompilerServices
         public static void EnsureSufficientExecutionStack() { }
         public static new bool Equals(object? o1, object? o2) { throw null; }
         public static void ExecuteCodeWithGuaranteedCleanup(System.Runtime.CompilerServices.RuntimeHelpers.TryCode code, System.Runtime.CompilerServices.RuntimeHelpers.CleanupCode backoutCode, object? userData) { }
-        public static int GetHashCode(object o) { throw null; }
+        public static int GetHashCode(object? o) { throw null; }
         [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("obj")]
         public static object? GetObjectValue(object? obj) { throw null; }
         public static T[] GetSubArray<T>(T[] array, System.Range range) { throw null; }
index 43efbaa..79a6a69 100644 (file)
@@ -20,9 +20,9 @@ namespace System.Runtime.CompilerServices
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               static extern int InternalGetHashCode (object o);
+               static extern int InternalGetHashCode (object? o);
 
-               public static int GetHashCode (object o)
+               public static int GetHashCode (object? o)
                {
                        return InternalGetHashCode (o);
                }