Skip to content

Commit 462d109

Browse files
committed
Merge branch 'alpha-v9' into draft-10
2 parents 34c67a8 + 385ec51 commit 462d109

84 files changed

Lines changed: 44983 additions & 38364 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dependencies/EcmaTC49.BuildGrammar.2.1.0.nupkg renamed to .github/workflows/dependencies/EcmaTC49.BuildGrammar.2.4.0.nupkg

259 KB
Binary file not shown.
5.95 KB
Binary file not shown.

.github/workflows/do-not-merge-label-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- 'do not merge'
2323
steps:
2424
- name: Harden Runner
25-
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
25+
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
2626
with:
2727
egress-policy: audit
2828

.github/workflows/grammar-validator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
# Install build grammar global tool
3636
- name: Install BuildGrammar tool
3737
run: |
38-
dotnet tool install --version 2.1.0 --global --add-source ./.github/workflows/dependencies/ EcmaTC49.BuildGrammar
38+
dotnet tool install --version 2.4.0 --global --add-source ./.github/workflows/dependencies/ EcmaTC49.BuildGrammar
3939
4040
- name: run validate
4141
run: |

.github/workflows/markdownlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
32-
- uses: DavidAnson/markdownlint-cli2-action@07035fd053f7be764496c0f8d8f9f41f98305101 # v22.0.0
32+
- uses: DavidAnson/markdownlint-cli2-action@ce4853d43830c74c1753b39f3cf40f71c2031eb9 # v23.0.0
3333
with:
3434
config: ".markdownlint-cli2.jsonc"
3535
globs: "standard/*.md"

admin/alpha-branch-creation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ For example, this order worked best for V9:
9696
- Small - 2 files, 3 potential conflict opportunities
9797
- attributes.md: 2
9898
- statements.md: 1
99-
1. *More better nullable*
99+
1. *More better nullable*. **Already merged**
100100
- https://patch-diff.githubusercontent.com/raw/dotnet/csharpstandard/pull/1221.patch
101101
- Small - 2 files, 3 potential conflict opportunities
102102
- attributes.md: 3

standard/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@
105105
- [§8.3.9](types.md#839-the-bool-type) The Bool type
106106
- [§8.3.10](types.md#8310-enumeration-types) Enumeration types
107107
- [§8.3.11](types.md#8311-tuple-types) Tuple types
108+
- [§8.3.11.1](types.md#83111-general) General
109+
- [§8.3.11.2](types.md#83112-eliding-intermediate-tuple-creation) Eliding intermediate tuple creation
110+
- [§8.3.11.3](types.md#83113-runtime-representation) Runtime representation
108111
- [§8.3.12](types.md#8312-nullable-value-types) Nullable value types
109112
- [§8.3.13](types.md#8313-boxing-and-unboxing) Boxing and unboxing
110113
- [§8.4](types.md#84-constructed-types) Constructed types
@@ -178,7 +181,7 @@
178181
- [§9.4.4.22](variables.md#94422-general-rules-for-simple-expressions) General rules for simple expressions
179182
- [§9.4.4.23](variables.md#94423-general-rules-for-expressions-with-embedded-expressions) General rules for expressions with embedded expressions
180183
- [§9.4.4.24](variables.md#94424-invocation-expressions-and-object-creation-expressions) Invocation expressions and object creation expressions
181-
- [§9.4.4.25](variables.md#94425-simple-assignment-expressions) Simple assignment expressions
184+
- [§9.4.4.25](variables.md#94425-simple-and-deconstructing-assignment-expressions) Simple and deconstructing assignment expressions
182185
- [§9.4.4.26](variables.md#94426--expressions) && expressions
183186
- [§9.4.4.27](variables.md#94427--expressions) || expressions
184187
- [§9.4.4.28](variables.md#94428--expressions) ! expressions
@@ -336,7 +339,7 @@
336339
- [§12.8.3](expressions.md#1283-interpolated-string-expressions) Interpolated string expressions
337340
- [§12.8.4](expressions.md#1284-simple-names) Simple names
338341
- [§12.8.5](expressions.md#1285-parenthesized-expressions) Parenthesized expressions
339-
- [§12.8.6](expressions.md#1286-tuple-expressions) Tuple expressions
342+
- [§12.8.6](expressions.md#1286-tuple-literals) Tuple literals
340343
- [§12.8.7](expressions.md#1287-member-access) Member access
341344
- [§12.8.7.1](expressions.md#12871-general) General
342345
- [§12.8.7.2](expressions.md#12872-identical-simple-names-and-type-names) Identical simple names and type names
@@ -459,9 +462,12 @@
459462
- [§12.24](expressions.md#1224-assignment-operators) Assignment operators
460463
- [§12.24.1](expressions.md#12241-general) General
461464
- [§12.24.2](expressions.md#12242-simple-assignment) Simple assignment
462-
- [§12.24.3](expressions.md#12243-ref-assignment) Ref assignment
463-
- [§12.24.4](expressions.md#12244-compound-assignment) Compound assignment
464-
- [§12.24.5](expressions.md#12245-event-assignment) Event assignment
465+
- [§12.24.3](expressions.md#12243-deconstructing-assignment) Deconstructing assignment
466+
- [§12.24.3.1](expressions.md#122431-general) General
467+
- [§12.24.3.2](expressions.md#122432-abridged-deconstructors) Abridged deconstructors
468+
- [§12.24.4](expressions.md#12244-ref-assignment) Ref assignment
469+
- [§12.24.5](expressions.md#12245-compound-assignment) Compound assignment
470+
- [§12.24.6](expressions.md#12246-event-assignment) Event assignment
465471
- [§12.25](expressions.md#1225-expression) Expression
466472
- [§12.26](expressions.md#1226-constant-expressions) Constant expressions
467473
- [§12.27](expressions.md#1227-boolean-expressions) Boolean expressions

standard/arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Elements of arrays created by *array_creation_expression*s are always initialize
114114
115115
Array elements are accessed using the *array access* variant of *element_access* expressions ([§12.8.12.2](expressions.md#128122-array-access)) of the form `A[I₁, I₂, ..., Iₓ]`, where `A` is an expression of an array type and each `Iₑ` is an expression of type `int`, `uint`, `nint`, `nuint`, `long`, `ulong`, or can be implicitly converted to one or more of these types. The result of an array access is a variable reference ([§9.5](variables.md#95-variable-references)) to the array element selected by the indices.
116116
117-
Array elements of single-dimensional arrays can also be accessed using an array access expression where the sole index, `I₁`, is an expression of type `Index`, `Range`, or can be implicitly converted to one or both of these types. If `I₁` is of type `Index`, or has been implicitly converted to that type, then the result of the array access is a variable reference to the array element selected by the index value. If `I₁` is of type `Range`, or has been implicitly converted to that type, then the result of the element access is a new array formed from a shallow copy of the array elements with indices in the `Range`, maintaining the element order.
117+
Array elements of single-dimensional arrays can also be accessed using an array access expression where the sole index, `I₁`, is an expression of type `Index`, `Range`, or can be implicitly converted to one or both of these types. If `I₁` is of type `Index`, or has been implicitly converted to that type, then the result of the array access is a variable reference to the array element selected by the index value. If `I₁` is of type `Range`, or has been implicitly converted to that type, then the result of the array access is a new array formed from a shallow copy of the array elements with indices in the `Range`, maintaining the element order.
118118
119119
The elements of an array can be enumerated using a `foreach` statement ([§13.9.5](statements.md#1395-the-foreach-statement)).
120120

standard/attributes.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ The types of positional and named parameters for an attribute class are limited
156156
157157
## 23.3 Attribute specification
158158
159-
Application of a previously defined attribute to a program entity is called ***attribute specification***. An attribute is a piece of additional declarative information that is specified for a program entity. Attributes can be specified at global scope (to specify attributes on the containing assembly or module) and for *type_declaration*s ([§14.7](namespaces.md#147-type-declarations)), *class_member_declaration*s ([§15.3](classes.md#153-class-members)), *interface_member_declaration*s ([§19.4](interfaces.md#194-interface-members)), *struct_member_declaration*s ([§16.3](structs.md#163-struct-members)), *enum_member_declaration*s ([§20.2](enums.md#202-enum-declarations)), *accessor_declaration*s ([§15.7.3](classes.md#1573-accessors)), *event_accessor_declaration*s ([§15.8](classes.md#158-events)), elements of *parameter_list*s ([§15.6.2](classes.md#1562-method-parameters)), and elements of *type_parameter_list*s ([§15.2.3](classes.md#1523-type-parameters)).
159+
Application of a previously defined attribute to a program entity is called ***attribute specification***. An attribute is a piece of additional declarative information that is specified for a program entity. Attributes can be specified at global scope (to specify attributes on the containing assembly or module) and for *type_declaration*s ([§14.7](namespaces.md#147-type-declarations)), *class_member_declaration*s ([§15.3](classes.md#153-class-members)), *interface_member_declaration*s ([§19.4](interfaces.md#194-interface-members)), *struct_member_declaration*s ([§16.3](structs.md#163-struct-members)), *enum_member_declaration*s ([§20.2](enums.md#202-enum-declarations)), *accessor_declaration*s ([§15.7.3](classes.md#1573-accessors)), *event_accessor_declaration*s ([§15.8](classes.md#158-events)), *local_function_declaration*s ([§13.6.4](statements.md#1364-local-function-declarations)), elements of *parameter_list*s ([§15.6.2](classes.md#1562-method-parameters)), and elements of *type_parameter_list*s ([§15.2.3](classes.md#1523-type-parameters)).
160160
161161
Attributes are specified in ***attribute section***s. An attribute section consists of a pair of square brackets, which surround a comma-separated list of one or more attributes. The order in which attributes are specified in such a list, and the order in which sections attached to the same program entity are arranged, is not significant. For instance, the attribute specifications `[A][B]`, `[B][A]`, `[A, B]`, and `[B, A]` are equivalent.
162162
@@ -252,10 +252,10 @@ The standardized *attribute_target* names are `event`, `field`, `method`, `param
252252

253253
- `event` — an event.
254254
- `field` — a field. A field-like event (i.e., one without accessors) ([§15.8.2](classes.md#1582-field-like-events)) and an automatically implemented property ([§15.7.4](classes.md#1574-automatically-implemented-properties)) can also have an attribute with this target.
255-
- `method` — a constructor; finalizer; method; operator; property get, set, and init accessors; indexer get, set, and init accessors; and event add and remove accessors. A field-like event (i.e., one without accessors) can also have an attribute with this target.
256-
- `param` — property set and init accessors, indexer set and init accessors, event add and remove accessors, and a parameter in a constructor, method, and operator.
255+
- `method` — a constructor, finalizer, method, local function, operator, property get, set, and init accessors, indexer get, set, and init accessors, and event add and remove accessors. A field-like event (i.e., one without accessors) can also have an attribute with this target.
256+
- `param` — property set and init accessors, indexer set and init accessors, event add and remove accessors, and a parameter in a constructor, method, local function, and operator.
257257
- `property` — a property and an indexer.
258-
- `return` — a delegate, method, operator, property get accessor, and indexer get accessor.
258+
- `return` — a delegate, method, local function, operator, property get accessor, and indexer get accessor.
259259
- `type` — a delegate, class, struct, enum, and interface.
260260
- `typevar` — a type parameter.
261261

@@ -267,6 +267,9 @@ Certain contexts permit the specification of an attribute on more than one targe
267267
- For an attribute on a method declaration the default target is the method. Otherwise when the *attribute_target* is equal to:
268268
- `method` — the target is the method
269269
- `return` — the target is the return value
270+
- For an attribute on a local function declaration the default target is the local function. Otherwise when the *attribute_target* is equal to:
271+
- `method` — the target is the local function
272+
- `return` — the target is the return value
270273
- For an attribute on an operator declaration the default target is the operator. Otherwise when the *attribute_target* is equal to:
271274
- `method` — the target is the operator
272275
- `return` — the target is the return value
@@ -670,9 +673,9 @@ The use of conditional methods in an inheritance chain can be confusing. Calls m
670673
671674
#### 23.5.3.3 Conditional local functions
672675
673-
A local function may be made conditional in the same sense as a conditional method ([§23.5.3.2](attributes.md#23532-conditional-methods)).
676+
A static local function may be made conditional in the same sense as a conditional method ([§23.5.3.2](attributes.md#23532-conditional-methods)).
674677
675-
A conditional local function shall have the modifier `static`.
678+
A compile time error occurs if a non-static local function is made conditional.
676679
677680
#### 23.5.3.4 Conditional attribute classes
678681
@@ -843,7 +846,40 @@ For invocations that occur within field or event initializers, the member name u
843846
844847
For invocations that occur within declarations of instance constructors, static constructors, finalizers and operators the member name used is implementation-dependent.
845848
846-
For an invocation that occurs within a local function, the name of the method that calls that local function is used. Consider the following: if method `M` calls local function `F1`, which in turn calls local function `F2`, and `F2` has a parameter marked with this attribute, the method name passed to `F2` is `M`, because a local function is *not* a function member!
849+
For an invocation that occurs within a local function or an anonymous function, the name of the member method that calls that function is used.
850+
851+
> *Example*: Consider the following:
852+
>
853+
> <!-- Example: {template:"standalone-console", name:"CallerMemberName1", inferOutput:true} -->
854+
> ```csharp
855+
> class Program
856+
> {
857+
> static void Main()
858+
> {
859+
> F1();
860+
>
861+
> void F1([CallerMemberName] string? name = null)
862+
> {
863+
> Console.WriteLine($"F1 MemberName: |{name}|");
864+
> F2();
865+
> }
866+
>
867+
> static void F2([CallerMemberName] string? name = null)
868+
> {
869+
> Console.WriteLine($"F2 MemberName: |{name}|");
870+
> }
871+
> }
872+
> }
873+
> ```
874+
>
875+
> which produces the output
876+
>
877+
> ```console
878+
> F1 MemberName: |Main|
879+
> F2 MemberName: |Main|
880+
> ```
881+
>
882+
> This attribute supplies the name of the calling function member, which for local function `F1` is the method `Main`. And even though `F2` is called by `F1`, a local function is *not* a function member, so the reported caller of `F2` is also `Main`. *end example*
847883
848884
### 23.5.7 Code analysis attributes
849885
@@ -1118,7 +1154,7 @@ It is an error if the `System.Runtime.CompilerServices.EnumeratorCancellation` a
11181154
11191155
- The `EnumeratorCancellation` attribute is applied to a parameter of a type other than `CancellationToken`,
11201156
- or if the `EnumeratorCancellation` attribute is applied to a parameter on a method that is not an asynchronous iterator ([§15.15](classes.md#1515-synchronous-and-asynchronous-iterators)),
1121-
- or if the `EnumeratorCancellation` attribute is applied to a parameter on a method that returns an asynchronous enumerable interface ([§15.15.3](classes.md#15153-enumerable-interfaces)) rather than an asynchronous enumerator interface ([§15.15.2](classes.md#15152-enumerator-interfaces)).
1157+
- or if the `EnumeratorCancellation` attribute is applied to a parameter on a method that returns an asynchronous enumerator interface ([§15.15.2](classes.md#15152-enumerator-interfaces)) rather than an asynchronous enumerable interface ([§15.15.3](classes.md#15153-enumerable-interfaces)).
11221158
11231159
The iterator will not have access to the `CancellationToken` argument for `GetAsyncEnumerator` when no attributes have this parameter.
11241160

0 commit comments

Comments
 (0)