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

IDE0083 looks only for declaration patterns #50690

Closed
Youssef1313 opened this issue Jan 22, 2021 · 1 comment · Fixed by #54870
Closed

IDE0083 looks only for declaration patterns #50690

Youssef1313 opened this issue Jan 22, 2021 · 1 comment · Fixed by #54870
Labels
Area-Analyzers Concept-Continuous Improvement help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@Youssef1313
Copy link
Member

// Look for the form: !(x is Y y)
if (!(node is PrefixUnaryExpressionSyntax
{
Operand: ParenthesizedExpressionSyntax
{
Expression: IsPatternExpressionSyntax
{
Pattern: DeclarationPatternSyntax,
} isPattern,
},
} notExpression))
{
return;
}

The above implementation will produce a diagnostic for !(x is Y y) but not for !(x is Y). Both can use is not and should have diagnostic.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 22, 2021
@jinujoseph jinujoseph added Concept-Continuous Improvement help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 29, 2021
@jinujoseph jinujoseph added this to the Backlog milestone Jan 29, 2021
@reacheight
Copy link
Contributor

reacheight commented Jul 16, 2021

Seems like this analyzer and corresponding code fix should also handle binary is-expressions with types (!(x is string)) and constant is-patterns (!(x is null)). If that's ok I'd like to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers Concept-Continuous Improvement help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants