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

RCS1132 false positive with .ToString() in records #1012

Closed
eduherminio opened this issue Dec 9, 2022 · 1 comment · Fixed by #1015
Closed

RCS1132 false positive with .ToString() in records #1012

eduherminio opened this issue Dec 9, 2022 · 1 comment · Fixed by #1015

Comments

@eduherminio
Copy link
Member

Product and Version Used:

Roslynator 2022 4.2.0 (VS 2022 extension)
.NET 6

Steps to Reproduce:

Console.WriteLine(new IntPointWithValue<string>("id", 0, 1).ToString());

public record IntPoint(int X, int Y)
{
    public override string ToString()
    {
        return $"[{X}, {Y}]";
    }
}

public record IntPointWithValue<T>(T value, int X, int Y) : IntPoint(X, Y)
{
    // Comment and uncomment
    // public override string ToString() => base.ToString();    // RCS1132, but without this, it's not inheriting base behavior
}

Actual Behavior:
RCS1132 Remove redundant overriding member

Expected Behavior:
No RCS1132, since we're indeed changing the behavior with that override

@eduherminio
Copy link
Member Author

(Closely?) related to #744.

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

Successfully merging a pull request may close this issue.

2 participants