-
Notifications
You must be signed in to change notification settings - Fork 231
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 S1172 FP: case when
where the pattern is a constant
#2010
Labels
Area: C#
C# rules related issues.
Area: CFG/SE
CFG and SE related issues.
Type: False Positive
Rule IS triggered when it shouldn't be.
Milestone
Comments
Thanks for reporting this problem @tsleegers, I managed to reproduce it, we will fix it in a future release. Note to implementers: for this to be fixed the Live Variable Analysis needs to start analysing patterns. |
@valhristov Is there any progress on this issue? |
case when
pattern matching with parameter
@Herdo no progress yet. We plan to invest some effort this year to improve our Control Flow Graph. |
case when
pattern matching with parametercase when
where the pattern is a constant
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 Positive
Rule IS triggered when it shouldn't be.
Description
When a function parameter only is used in het when clause of pattern matching in a switch statement it incorrecty marks that parameter as unused (S1172)
Repro steps
Please provide the steps required to reproduce the problem
Example code:
Parameter i is marked unused.
Expected behavior
No warning from sonar analyzers.
Actual behavior
S1172 warning generated:
Warning S1172 Remove this parameter 'i', whose value is ignored in the method.
Known workarounds
Suppress warning.
Related information
The text was updated successfully, but these errors were encountered: