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

RCS1182 triggered for overridden default interface methods #1496

Closed
gtbuchanan opened this issue Aug 2, 2024 · 0 comments · Fixed by #1502
Closed

RCS1182 triggered for overridden default interface methods #1496

gtbuchanan opened this issue Aug 2, 2024 · 0 comments · Fixed by #1502
Assignees

Comments

@gtbuchanan
Copy link

Product and Version Used:
Roslynator 4.12.4

Steps to Reproduce:

  1. Create an interface with a default method implementation
  2. Create a parent class that implements the interface
  3. Create a child class that inherits the parent class and implements the interface
  4. Add an implementation of the interface method to override the default implementation

Actual Behavior:

internal interface IInterface
{
    void Invoke() => Console.WriteLine(nameof(IInterface));
}

internal class ParentClass : IInterface;

internal class ChildClass : ParentClass, IInterface // BUG: RCS1182 triggered here
{
    public void Invoke() => Console.WriteLine(nameof(ChildClass));
}
...
IInterface x = new ChildClass();
x.Invoke();

Expected Behavior:
RCS1182 should not be triggered. Removing the "redundant" interface implementation causes the default interface method not to be overridden (i.e. the example logs IInterface).

Related to #591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants