Skip to content

Commit

Permalink
Nullability: RuntimeHelpers.GetHashCode should accept null obj input (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabYourPitchforks authored Feb 6, 2020
1 parent 5040afe commit 0d607a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[]
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);
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7273,7 +7273,7 @@ public static partial class RuntimeHelpers
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; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public static int OffsetToStringData {
}

[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);
}
Expand Down

0 comments on commit 0d607a7

Please sign in to comment.