-
Notifications
You must be signed in to change notification settings - Fork 226
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 S3878 FP: When input array is collection expression with spread operator #8970
Conversation
|
||
// repro for https://github.com/SonarSource/sonar-dotnet/issues/8510 | ||
_ = new MyClass(1, [a, .. array]); // Noncompliant FP | ||
_ = new MyClass(1, [a, .. array]); // Compliant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
_ = new MyClass4(class1, new(1, [1, .. array])); // Compliant | ||
_ = new MyClass4([class1, new(1, [1, .. array])]); // Noncompliant, outer collection raises, despite the nested spread operator | ||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case is why I do expression.Elements
instead of expression.DescendantNodes()
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #8510