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

SA1119 Works incorrectly with C# 7.0 pattern matching #2662

Closed
VitaliiTsilnyk opened this issue May 1, 2018 · 1 comment
Closed

SA1119 Works incorrectly with C# 7.0 pattern matching #2662

VitaliiTsilnyk opened this issue May 1, 2018 · 1 comment

Comments

@VitaliiTsilnyk
Copy link

VitaliiTsilnyk commented May 1, 2018

This code will trigger SA1119 (Statement must not use unnecessary parenthesis) while those parenthesis are necessary to make the expression negative.

if (!(someVariable is TypeA typeAVariable))

On the other hand, if we use only type check without pattern matching, the error will not pop up:

if (!(someVariable is TypeA))
@sharwell
Copy link
Member

sharwell commented May 1, 2018

Duplicate of #2372

@sharwell sharwell marked this as a duplicate of #2372 May 1, 2018
@sharwell sharwell closed this as completed May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants