Skip to content

Commit b469714

Browse files
committed
Merge remote-tracking branch 'upstream/alpha-v10' into draft-v11
2 parents 7e0b279 + 4e3b332 commit b469714

85 files changed

Lines changed: 45220 additions & 38477 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"

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
@@ -342,7 +345,7 @@
342345
- [§12.8.3](expressions.md#1283-interpolated-string-expressions) Interpolated string expressions
343346
- [§12.8.4](expressions.md#1284-simple-names) Simple names
344347
- [§12.8.5](expressions.md#1285-parenthesized-expressions) Parenthesized expressions
345-
- [§12.8.6](expressions.md#1286-tuple-expressions) Tuple expressions
348+
- [§12.8.6](expressions.md#1286-tuple-literals) Tuple literals
346349
- [§12.8.7](expressions.md#1287-member-access) Member access
347350
- [§12.8.7.1](expressions.md#12871-general) General
348351
- [§12.8.7.2](expressions.md#12872-identical-simple-names-and-type-names) Identical simple names and type names
@@ -466,9 +469,12 @@
466469
- [§12.24](expressions.md#1224-assignment-operators) Assignment operators
467470
- [§12.24.1](expressions.md#12241-general) General
468471
- [§12.24.2](expressions.md#12242-simple-assignment) Simple assignment
469-
- [§12.24.3](expressions.md#12243-ref-assignment) Ref assignment
470-
- [§12.24.4](expressions.md#12244-compound-assignment) Compound assignment
471-
- [§12.24.5](expressions.md#12245-event-assignment) Event assignment
472+
- [§12.24.3](expressions.md#12243-deconstructing-assignment) Deconstructing assignment
473+
- [§12.24.3.1](expressions.md#122431-general) General
474+
- [§12.24.3.2](expressions.md#122432-abridged-deconstructors) Abridged deconstructors
475+
- [§12.24.4](expressions.md#12244-ref-assignment) Ref assignment
476+
- [§12.24.5](expressions.md#12245-compound-assignment) Compound assignment
477+
- [§12.24.6](expressions.md#12246-event-assignment) Event assignment
472478
- [§12.25](expressions.md#1225-expression) Expression
473479
- [§12.26](expressions.md#1226-constant-expressions) Constant expressions
474480
- [§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: 50 additions & 11 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)), elements of *type_parameter_list*s ([§15.2.3](classes.md#1523-type-parameters)), *lambda_expression*s ([§12.22.1](expressions.md#12221-general)), and elements of *explicit_anonymous_function_parameter*s and *implicit_anonymous_function_parameter*s ([§12.22.1](expressions.md#12221-general)).
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; operator; local function, property get, set, and init accessors; indexer get, set, and init accessors; event add and remove accessors; and lambda expressions. 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 fuction, 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, indexer get accessor, and lambda expression.
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
@@ -285,6 +288,9 @@ Certain contexts permit the specification of an attribute on more than one targe
285288
- In the case of an event declaration that does not omit *event_accessor_declarations* the default target is the method.
286289
- `method` — the target is the associated method
287290
- `param` — the target is the lone parameter
291+
- For an attribute on a *lambda_expression* the default target is the method. Otherwise when the *attribute_target* is equal to:
292+
- `method` — the target is the method
293+
- `return` — the target is the return value
288294

289295
In all other contexts, inclusion of an *attribute_target_specifier* is permitted but unnecessary.
290296

@@ -671,9 +677,9 @@ The use of conditional methods in an inheritance chain can be confusing. Calls m
671677
672678
#### 23.5.3.3 Conditional local functions
673679
674-
A local function may be made conditional in the same sense as a conditional method ([§23.5.3.2](attributes.md#23532-conditional-methods)).
680+
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)).
675681
676-
A conditional local function shall have the modifier `static`.
682+
A compile time error occurs if a non-static local function is made conditional.
677683
678684
#### 23.5.3.4 Conditional attribute classes
679685
@@ -798,13 +804,13 @@ Caller information is only substituted when a function is explicitly invoked in
798804
799805
One exception is query expressions. These are considered syntactic expansions, and if the calls they expand to omit optional parameters with caller-info attributes, caller information will be substituted. The location used is the location of the query clause which the call was generated from.
800806
801-
If more than one caller-info attribute is specified on a given parameter, they are recognized in the following order: `CallerLineNumber`, `CallerFilePath`, `CallerMemberName`. Consider the following parameter declaration:
807+
If more than one caller-info attribute is specified on a given parameter, they are recognized in the following order: `CallerLineNumber`, `CallerFilePath`, `CallerMemberName`, `CallerArgumentExpression`. Consider the following parameter declaration:
802808
803809
```csharp
804810
[CallerMemberName, CallerFilePath, CallerLineNumber] object p = ...
805811
```
806812
807-
`CallerLineNumber` takes precedence, and the other two attributes are ignored. If `CallerLineNumber` were omitted, `CallerFilePath` would take precedence, and `CallerMemberName` would be ignored. The lexical ordering of these attributes is irrelevant.
813+
`CallerLineNumber` takes precedence, and the other three attributes are ignored. If `CallerLineNumber` were omitted, `CallerFilePath` would take precedence, and `CallerMemberName` and `CallerArgumentExpression` would be ignored. The lexical ordering of these attributes is irrelevant.
808814
809815
#### 23.5.6.2 The CallerLineNumber attribute
810816
@@ -844,11 +850,44 @@ For invocations that occur within field or event initializers, the member name u
844850
845851
For invocations that occur within declarations of instance constructors, static constructors, finalizers and operators the member name used is implementation-dependent.
846852
847-
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!
853+
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.
854+
855+
> *Example*: Consider the following:
856+
>
857+
> <!-- Example: {template:"standalone-console", name:"CallerMemberName1", inferOutput:true} -->
858+
> ```csharp
859+
> class Program
860+
> {
861+
> static void Main()
862+
> {
863+
> F1();
864+
>
865+
> void F1([CallerMemberName] string? name = null)
866+
> {
867+
> Console.WriteLine($"F1 MemberName: |{name}|");
868+
> F2();
869+
> }
870+
>
871+
> static void F2([CallerMemberName] string? name = null)
872+
> {
873+
> Console.WriteLine($"F2 MemberName: |{name}|");
874+
> }
875+
> }
876+
> }
877+
> ```
878+
>
879+
> which produces the output
880+
>
881+
> ```console
882+
> F1 MemberName: |Main|
883+
> F2 MemberName: |Main|
884+
> ```
885+
>
886+
> 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*
848887
849888
#### 23.5.6.5 The CallerArgumentExpression attribute
850889
851-
The attribute `System.Runtime.CompilerServices.CallerArgumentExpression` is applied to a *target parameter*, and can result in the capture of the source-code text of a sibling parameter's argument as a string, referred to here as the *captured string*.
890+
The attribute `System.Runtime.CompilerServices.CallerArgumentExpressionAttribute` is applied to a *target parameter*, and can result in the capture of the source-code text of a sibling parameter's argument as a string, referred to here as the *captured string*.
852891
853892
Except when it is the first parameter in an extension method, the target parameter shall have a *default_argument*.
854893
@@ -1192,7 +1231,7 @@ It is an error if the `System.Runtime.CompilerServices.EnumeratorCancellation` a
11921231
11931232
- The `EnumeratorCancellation` attribute is applied to a parameter of a type other than `CancellationToken`,
11941233
- 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)),
1195-
- 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)).
1234+
- 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)).
11961235
11971236
The iterator will not have access to the `CancellationToken` argument for `GetAsyncEnumerator` when no attributes have this parameter.
11981237

0 commit comments

Comments
 (0)