Version Used: VS 16.2.0-pre.1.0+28917.182
Steps to Reproduce:
#nullable enable
interface IEquatable<T> {
bool Equals(T other);
}
interface IFoo : IEquatable<IFoo?>, IEquatable<string?>
{ }
class Foo : IFoo
{
public bool Equals(string? other)
{
return true;
}
public bool Equals(IFoo? other)
{
return true;
}
}
class C
{
void M(IFoo foo)
{
foo.Equals("");
// ^^ CS8620
// Argument of type 'string' cannot be used for parameter 'other' of type 'IFoo'
// in 'bool IEquatable<IFoo?>.Equals(IFoo? other)' due to differences in the
// nullability of reference types.
}
}
The error message implies an incorrect overload of IEquatable<>.Equals is being considered when evaluating nullability here.
Expected Behavior:
No warning.
Actual Behavior:
CS8620 is issued.
Version Used: VS 16.2.0-pre.1.0+28917.182
Steps to Reproduce:
The error message implies an incorrect overload of
IEquatable<>.Equalsis being considered when evaluating nullability here.Expected Behavior:
No warning.
Actual Behavior:
CS8620 is issued.