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

Fix S2743 FP: Arrow properties do not have static fields #8358

Closed
pavel-mikula-sonarsource opened this issue Nov 14, 2023 · 0 comments · Fixed by #8364
Closed

Fix S2743 FP: Arrow properties do not have static fields #8358

pavel-mikula-sonarsource opened this issue Nov 14, 2023 · 0 comments · Fixed by #8364
Assignees
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Milestone

Comments

@pavel-mikula-sonarsource
Copy link
Contributor

pavel-mikula-sonarsource commented Nov 14, 2023

The S2743 rule says

A static field in a generic type is not shared among instances of different close constructed types.

but when it is an arrow property, there's no static field involved.

public class Sample<T>
{
    protected static IEnumerable<string> Empty => Enumerable.Empty<string>(); // Noncompliant FP
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants