Merge main into live - #55624
Open
dotnet-policy-service[bot] wants to merge 9 commits into
Open
Conversation
Co-authored-by: azure-sdk <azuresdk@microsoft.com>
* Add Expressions: operators article (issue #55334) Create docs/csharp/fundamentals/expressions/operators.md covering arithmetic, unary, increment/decrement, relational, equality survey, conditional-logical, conditional (?:), simple and compound assignment. - Add operators snippets project (net10.0, nullable, implicit usings) with 9 region-marked examples; 0 warnings, 0 errors - Add operators.md TOC node under Expressions and statements - Add reciprocal link in expressions/index.md - Add reciprocal link in expressions/equality.md - Link excluded operators (shift/bitwise, checked/unchecked) to existing Language Reference pages Closes #55334 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f5acfb15-adff-4860-a307-213196efda1c * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * 2nd draft - Add negative integer division example (-7/2 = -3) to clarify truncation toward zero - Add negative-operand remainder examples (-7%3 = -1, 7%-3 = 1) with sign rule explanation - Explain char relational comparison uses Unicode code point values (tied to grade example) - Update != comment to explicitly say 'true when values are not equal' - Remove invalid commented-out code from EqualityOps snippet; move === example to NOTE callout in article prose as fenced code block - Remove nested conditional example and related prose from ConditionalOp section - Add Console.WriteLine after each compound assignment step (hp progression: 100 -> 120 -> 110 -> 220 -> 73 -> 3) - Rename 'Operators not covered here' to 'Other C# operators'; expand bullets with concise definitions - Add displayName to toc.yml entry for operators.md with all covered operators Copilot-Session: f5acfb15-adff-4860-a307-213196efda1c Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * A few small repairs Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * Retire Programming Guide equality articles; migrate to Fundamentals (#55334) Retire the three Programming Guide equality articles and preserve their unique content in docs/csharp/fundamentals/expressions/equality.md: - equality-comparisons.md - how-to-test-for-reference-equality-identity.md - how-to-define-value-equality-for-a-type.md Content migrated into equality.md: - Equivalence contract (5 rules: reflexive, symmetric, transitive, consistent, null behavior) added to the manual-implementation section. - New section: 'Records with reference-type members' — explains that synthesized record equality uses each member's own equality semantics, so List<T>/array members compare by reference; shows custom IEquatable override with SequenceEqual as the recommended fix. - New section: 'Polymorphic equality in unsealed class hierarchies' — explains the compile-time dispatch hazard with IEquatable<T>, the GetType() guard and virtual Equals pattern for correct unsealed-class equality, and notes that sealed classes and records avoid the problem. Snippet additions to snippets/equality/Program.cs: - RecordWithCollectionProblem / RecordWithCollectionFixed regions - PlaylistFixedDefinition type (custom IEquatable record) - PolymorphicEqualityDefinition (Shape/Circle hierarchy with GetType() guard) - PolymorphicEqualityUsage region Intentionally omitted: string-interning note (per Bill's explicit decision). Retirement wiring: - 3 redirects added to .openpublishing.redirection.csharp.json - TOC entries and empty parent node removed from toc.yml - All 5 inbound links updated: objects.md, how-to/index.md, overloaded-operator-errors.md, record-declaration-errors.md, equality-operators.md - Orphaned snippet projects deleted Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f5acfb15-adff-4860-a307-213196efda1c * restructure equality article. Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * Add 'Equality in class hierarchies' section to Language Reference operators. Implements the persisted plan from PR #55469 equality restructuring: - Add ## Equality in class hierarchies before ## Operator overloadability in equality-operators.md; covers declared/runtime-type dispatch hazards, GetType() guard, virtual Equals, derived-class augmentation, GetHashCode with GetType(), sealed-class simplification, and records guidance. - Create net10.0 snippet project at docs/csharp/language-reference/operators/snippets/EqualityHierarchies/ with HierarchyShapeDefinition, HierarchyCircleDefinition, HierarchyUsage regions (all build-verified, 0 warnings/errors). - Update metadata: description, ms.date, helpviewer_keywords. - Add reciprocal Fundamentals link in new section. Cray item 3 (relocate polymorphic equality to Language Reference) implemented. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f5acfb15-adff-4860-a307-213196efda1c * Simplify Fundamentals equality article; add byte-range note to operators. Implements remaining Cray review items for PR #55469: Cray item 1 (Records with reference-type members): - Remove PlaylistFixed/IEquatable implementation code; replace rendered code blocks with brief named-strategy list; keep RecordWithCollectionProblem surprise example intact. Cray item 2 (Implement equality yourself): - Lead with code (ColorDefinition first); shorten IMPORTANT callout to 2 sentences; consolidate member-list description into commentary after the code; compact equivalence contract intro; demote IEquatable<T> footnote. - Retain IEquatableUsage region to show identity-vs-value contrast. Cray item 3 (Polymorphic section bridge): - Replace full polymorphic implementation in Fundamentals with a 3-sentence hazard summary + link to Language Reference ## Equality in class hierarchies. - Preserve ## Polymorphic equality in unsealed class hierarchies heading. Cray item 4 (operators.md byte-range): - Add byte-range clarification: 'the result, 210, fits within the byte range of 0-255'; beginner-safe, no checked/unchecked discussion. Cray item 5 (hash-loop): auto-resolved by PlaylistFixed removal. Snippets: - Remove PlaylistFixedDefinition, RecordWithCollectionFixed regions and PlaylistFixed type from Fundamentals Program.cs. - Remove PolymorphicEqualityDefinition, PolymorphicEqualityUsage regions (Shape/Circle now live in LR EqualityHierarchies project). - Fundamentals snippet builds 0 warnings/errors (net10.0). Links/redirects: - All three Programming Guide redirect targets unchanged (anchors verified). - Add reciprocal LR link in equality.md See also. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f5acfb15-adff-4860-a307-213196efda1c * Polish: improve equality documentation formatting and clarity - Add blank line before 'Polymorphic equality in unsealed class hierarchies' section heading in equality.md - Clarify 'declared type' with parenthetical '(the type written in the variable declaration)' in equality-operators.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f5acfb15-adff-4860-a307-213196efda1c * Final review Do a final review pass of all the changed content. * Fix build warnings. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Copilot-Session: f5acfb15-adff-4860-a307-213196efda1c
* docs: consolidate expression-form context restriction diagnostics (CS8115, CS8185, CS8209, CS8310, CS8312) This article consolidates five compiler diagnostics related to invalid expression contexts: - CS8115: Throw expressions in restricted contexts - CS8185: Declaration expressions in restricted contexts - CS8209: Void-returning expression restrictions - CS8310: Operator binding for null/default/new - CS8312: Default literal target type requirements Content organized by remediation strategy. Codes removed from catch-all. CS8188 preserved in expression-tree-restrictions.md per issue guidance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: expand expression-form diagnostics to eight codes with keyword context restrictions (CS0175, CS0186, CS1547) Consolidate three standalone diagnostic articles (CS0175, CS0186, CS1547) into expression-form-restrictions.md, broadening the article scope from 5 to 8 codes while maintaining thematic coherence: MERGED CODES: - CS0175: Use of keyword 'base' is not valid in this context - CS0186: Use of null is not valid in this context - CS1547: Keyword 'void' cannot be used in this context CHANGES: - Updated expression-form-restrictions.md with new 'Keyword and literal context restrictions' section containing substantive guidance from the three deleted standalone articles - Merged all unique remediation information and examples - Updated front matter f1_keywords and helpviewer_keywords (8 codes) - Updated master error list with all 8 codes and exact Roslyn messages - Updated TOC displayName with all 8 codes - Removed old TOC entries for CS0175, CS0186, CS1547 - Created three redirects from old paths to new destination anchors - Deleted three now-retired standalone files FOOTPRINT REDUCTION: 3 standalone files → 1 consolidated article VERIFICATION: - YAML front matter valid - All 8 codes present in f1_keywords/helpviewer_keywords - No trailing whitespace - Redirect JSON valid (1415 total entries) - Exact Roslyn messages preserved per Bill's requirements Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: remove duplicated legacy displayName tail from expression-form TOC entry The displayName folded scalar contained a duplicated five-code tail (CS8115, CS8185, CS8209, CS8310, CS8312 with associated phrases) left over from the original commit after the eight-code expansion appended new content without removing the old suffix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: restructure expression-form-restrictions with single H2 section and bullet-point remediation Consolidate five separate H2/H3 subsections into one unified 'Invalid expression contexts' H2 section with scannable bullet-point remediation guidance. All eight diagnostic codes (CS0175, CS0186, CS1547, CS8115, CS8185, CS8209, CS8310, CS8312) now appear as cohesive remedy bullets, preserving all substantive examples and guidance while following prevailing style in delegate-function-pointer-diagnostics.md and foreach-diagnostics.md. Changes: - Removed old H2/H3 headers (Base keyword, Null iteration, Void keyword, Throw expressions, Declaration expressions, Target type required, Void-returning) - Created unified 'Invalid expression contexts' H2 with all anchors consolidated - Restructured master error list to link all codes to single #invalid-expression-contexts - Updated redirects for cs0175.md, cs0186.md, cs1547.md to point to unified anchor - Preserved all code examples, remediation patterns, and guidance from original Validation: 8 codes in front matter, 8 bullet items, 2 code examples, 3 redirects updated, no trailing whitespace, single H2 anchor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Proofread and finalize. * Update docs/csharp/language-reference/compiler-messages/expression-form-restrictions.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: azure-sdk <azuresdk@microsoft.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
* Slim conditional operator coverage in selection statements (#55335) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * rebase and update links. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…aceSupport=false` (#55213)
* Consolidate C# statements documentation (#55336) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revise C# statements learning flow (#55336) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * proofread and finalize --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: azure-sdk <azuresdk@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please don't squash-merge this PR.
Internal previews
Toggle expand/collapse
Note
This table shows the first 30 preview links (sorted alphabetically by file path) found in the OPS build report. For the full list, select OpenPublishing.Build Details within checks.