You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 1
Do<Foo>();
// 2
Do1<Foo>();
// 3
Console.WriteLine(new Foo() == new Foo());
// 4
IEqualityOperators<Foo, Foo, bool> foo1 = new Foo();
IEqualityOperators<Foo, Foo, bool> foo2 = new Foo();
Console.WriteLine(foo1 == foo2);
// 5
IAutoEquatable<Foo> foo3 = new Foo();
IAutoEquatable<Foo> foo4 = new Foo();
Console.WriteLine(foo3 == foo4);
void Do<T>() where T :IAutoEquatable<T> , new()
{
Console.WriteLine(new T() == new T());
}
void Do1<T>() where T : IEqualityOperators<T, T, bool> , new()
{
Console.WriteLine(new T() == new T());
}
Expected behavior
ieop.== eq True
ieop.== eq True
ideally would be great to get ieop.== eq True but based on the fact that classes do not inherit members from its interfaces (default interface implementation spec) False can be somewhat explained
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
gurustron
changed the title
Default interface implemented static abstract operators do not resolve.
Default interface implementation of static abstract operator is not resolved.
Mar 5, 2023
Description
Not sure if this a bug though and maybe this is better addressed in the csharplang repo.
When interface provides implementation for
IEqualityOperators.==
operator the implementation is not resolved unless via generic indirection.Original SO question
Reproduction Steps
And usage:
Expected behavior
ieop.== eq True
ieop.== eq True
ieop.== eq True
but based on the fact that classes do not inherit members from its interfaces (default interface implementation spec)False
can be somewhat explainedieop.== eq True
ieop.== eq True
Actual behavior
ieop.== eq True
ieop.== eq True
False
False
False
Regression?
NA
Known Workarounds
NA
Configuration
Windows 11
7.0.100 [C:\Program Files\dotnet\sdk]
Other information
@sharplab
The text was updated successfully, but these errors were encountered: