Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullability: RuntimeHelpers.GetHashCode should accept null obj input #31819

Merged
merged 1 commit into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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