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

S2583 FN: Local functions #4515

Closed
hankovich opened this issue Jun 4, 2021 · 2 comments · Fixed by #7478
Closed

S2583 FN: Local functions #4515

hankovich opened this issue Jun 4, 2021 · 2 comments · Fixed by #7478
Assignees
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@hankovich
Copy link

Description

public void A()
{
    int? i = GetNullableInt();

    if (i == null && i == 3) // <- S2583 is reported here (i == 3 is always false)
    {

    }

    static void B()
    {
        int? i = GetNullableInt();

        if (i == null && i == 3) // <- but... S2583 is NOT reported here
        {

        }
    }

    static int? GetNullableInt() => 42;
}

Related information

  • C#/VB.NET Plugins version: 8.23.0.32424
@csaba-sagi-sonarsource
Copy link
Contributor

Hi @hankovich , I can confirm the false negative. Thanks for your feedback.

@csaba-sagi-sonarsource csaba-sagi-sonarsource added Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Type: False Negative Rule is NOT triggered when it should be. labels Jun 25, 2021
@mary-georgiou-sonarsource mary-georgiou-sonarsource added this to the 9.7 milestone Jul 24, 2023
@martin-strecker-sonarsource martin-strecker-sonarsource modified the milestones: 9.7, 9.8 Aug 4, 2023
@mary-georgiou-sonarsource
Copy link
Contributor

Fixed by #7478

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. Area: CFG/SE CFG and SE related issues. Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants