-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Clarify precedence groups. #51408
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
base: main
Are you sure you want to change the base?
Clarify precedence groups. #51408
Conversation
Fixes dotnet#50888 Readers had misinterpreted the list of operator precedence as an absolute list, rather than a list of groups. Clarify that within the same group, operators are evaluated in lexical order. Clarify that each list is a group with the same precedence.
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.
Pull request overview
This PR clarifies operator precedence documentation in response to issue #50888, where readers misinterpreted flat lists as implying different precedence for each operator. The changes restructure precedence information to explicitly show groupings and add a statement about evaluation order for operators with the same precedence.
Changes:
- Added clarification in index.md that operators with the same precedence are evaluated in lexical order
- Restructured precedence lists in five operator documentation files to explicitly show precedence groups with links to the main precedence table
- Changed list introductions from "orders operators from highest to lowest" to "orders operators in groups from highest to lowest"
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/csharp/language-reference/operators/index.md | Added statement about lexical order evaluation for same-precedence operators |
| docs/csharp/language-reference/operators/boolean-logical-operators.md | Restructured logical operator precedence list into linked groups |
| docs/csharp/language-reference/operators/bitwise-and-shift-operators.md | Restructured bitwise operator precedence list into linked groups |
| docs/csharp/language-reference/operators/arithmetic-operators.md | Restructured arithmetic operator precedence list into linked groups |
| docs/csharp/language-reference/operators/pointer-related-operators.md | Restructured pointer operator precedence list into linked groups |
Fixes #50888
Readers had misinterpreted the list of operator precedence as an absolute list, rather than a list of groups.
Clarify that within the same group, operators are evaluated in lexical order. Clarify that each list is a group with the same precedence.
Internal previews