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

This article should include a discussion of binding order and logical patterns #43177

Open
BillWagner opened this issue Oct 23, 2024 · 0 comments · May be fixed by #43574
Open

This article should include a discussion of binding order and logical patterns #43177

BillWagner opened this issue Oct 23, 2024 · 0 comments · May be fixed by #43574
Assignees
Labels
doc-bug Problem with the content; needs to be fixed [org][type][category] dotnet-csharp/svc in-pr This issue will be closed (fixed) by an active pull request. lang-reference/subsvc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@BillWagner
Copy link
Member

BillWagner commented Oct 23, 2024

Type of issue

Missing information

Description

See dotnet/roslyn#75506 for details.

Developers have written patterns like is not a or b thinking it means is not (a or b). However, the binding means this is interpreted as is (not a) or b.

This was discussed in #33397, but that didn't result in changes in this article because the description was about operator precedence not binding order. (Yeah, that's on me, I should have connected those dots. I didn't at the time).

This article should include the information that not binds first, and second, and or is last. It should include examples, and the general guidance that parentheses can improve the clarity of any pattern matching expression.

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/patterns

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/operators/patterns.md

Document Version Independent Id

312e9c81-ee2a-1d84-64d7-bcaa71d7eab8

Article author

@BillWagner

Metadata

  • ID: 9112c305-f1cd-1aa5-4557-2c7d757e6ca0
  • Service: dotnet-csharp
  • Sub-service: lang-reference

Associated WorkItem - 330547

@issues-automation issues-automation bot added dotnet-csharp/svc lang-reference/subsvc Pri1 High priority, do before Pri2 and Pri3 labels Oct 23, 2024
@BillWagner BillWagner added the doc-bug Problem with the content; needs to be fixed [org][type][category] label Oct 23, 2024
@BillWagner BillWagner self-assigned this Oct 23, 2024
@BillWagner BillWagner added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Oct 23, 2024
@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Oct 23, 2024
@sequestor sequestor bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Oct 24, 2024
@dotnetrepoman dotnetrepoman bot added 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. and removed 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. labels Nov 14, 2024
BillWagner added a commit to BillWagner/docs that referenced this issue Nov 14, 2024
Fixes dotnet#43177

We've had feedback that indicates confusion on how C# parses patterns with multiple `and`, `not`, and `or` patterns. Add more examples that demonstrates the problems. Explain the binding order, and recommend using parentheses when the pattern can be misinterpreted.

Also, do a grammar check.
@BillWagner BillWagner linked a pull request Nov 14, 2024 that will close this issue
@dotnet-policy-service dotnet-policy-service bot added the in-pr This issue will be closed (fixed) by an active pull request. label Nov 14, 2024
@dotnetrepoman dotnetrepoman bot added 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. and removed 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-bug Problem with the content; needs to be fixed [org][type][category] dotnet-csharp/svc in-pr This issue will be closed (fixed) by an active pull request. lang-reference/subsvc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

1 participant