Commit 82a7895
Check all C# 15 docs against updated feature specs and .NET 11 preview 7 behavior (dotnet#55444)
* First pass: Fix dotnet#55322
Elaborate on the explanation for IUnionProviders.
* Document C# 15 unsafe updates (dotnet#55330)
Add unsafe(expression) coverage to What's new in C# 15 and to the
Language Reference (unsafe-code.md and keywords/unsafe.md), including
a field-initializer example and an await-with-unsafe-expression
example verified against the .NET 11 Preview 6 SDK. Explain why the
expression form is useful where an unsafe block can't appear
syntactically (field initializers, constructor initializers, catch
filters), without claiming await is permitted inside an unsafe
context; it remains illegal (CS4004).
Update keywords/safe.md: the compiler now recognizes the safe
modifier on extern members and explicit-layout fields (verified
against Preview 6), but caller-safety/requires-unsafe enforcement
has no public opt-in and isn't active under ordinary preview
settings. Align xmldoc/recommended-tags.md safety guidance with
the same caveat so it doesn't imply caller obligations are already
enforced.
Fixes dotnet#55330
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4c0acfc3-7e62-4739-a09e-2dedc26b27af
* Clarify C# 15 union pattern matching (dotnet#55330)
Fix residual wording in operators/patterns.md and the "Non-boxing
access pattern" section of builtin-types/union.md that conflated
TryGetValue and HasValue as a single combined mechanism. State
plainly that TryGetValue supports type-pattern checks without
boxing and HasValue supports null-pattern checks; neither is a
fallback for the other, and the compiler checks Value for the
corresponding pattern when a member is omitted. Cross-link to the
detailed "Union member providers" section (accepted in dotnet#55322)
instead of duplicating its explanation.
Fixes dotnet#55330
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4c0acfc3-7e62-4739-a09e-2dedc26b27af
* Update C# 15 closed hierarchy docs (dotnet#55330)
Remove the obsolete ClosedAttribute workaround from What's new and
the shared snippet projects. The .NET 11 Preview 6 runtime already
supplies System.Runtime.CompilerServices.IsClosedTypeAttribute
(verified: the compiler synthesizes it automatically), so projects
no longer need to declare a substitute attribute.
Fix a discovered inaccuracy while validating snippets against the
Preview 6 SDK: exhaustiveness checking for a switch governed by a
type parameter constrained to a closed class isn't implemented yet,
even though the specification defines it and the docs claimed it
worked. Keep the example (it shows valid syntax from the
specification) but add an accurate NOTE explaining the current
compiler limitation in both closed.md and patterns.md, instead of
leaving readers with example code whose "no warning" comment
contradicts what the compiler actually reports.
Fixes dotnet#55330
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4c0acfc3-7e62-4739-a09e-2dedc26b27af
* Clarify C# 15 collection expression arguments (dotnet#55330)
Add a restriction to operators/collection-expressions.md stating
that with(...) arguments don't affect conversion, overload
resolution, or type inference: only the presence of a with(...)
element affects whether a conversion from the collection expression
to a candidate target type exists, and the arguments themselves are
ignored. This matches the resolved LDM decision in the collection
expression arguments feature specification, verified against the
.NET 11 Preview 6 SDK (overload resolution stays ambiguous and type
arguments still can't be inferred when with(...) supplies them).
Fixes dotnet#55330
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4c0acfc3-7e62-4739-a09e-2dedc26b27af
* proofread
Proofread and grammar check all changed files in this PR.
* Validate against preview 7
* Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
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: 4c0acfc3-7e62-4739-a09e-2dedc26b27af1 parent bf2669b commit 82a7895
16 files changed
Lines changed: 133 additions & 72 deletions
File tree
- docs/csharp
- language-reference
- builtin-types
- snippets/unions
- keywords
- operators
- snippets/patterns
- snippets/memory-safety
- xmldoc
- whats-new
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
175 | 192 | | |
176 | 193 | | |
177 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
Lines changed: 0 additions & 6 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
| 118 | + | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
0 commit comments