Skip to content

Commit

Permalink
[create-pull-request] automated change (#1224)
Browse files Browse the repository at this point in the history
Co-authored-by: BillWagner <[email protected]>
  • Loading branch information
github-actions[bot] and BillWagner authored Dec 2, 2024
1 parent f4debe3 commit 4e64ae0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion standard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@
- [§9.2.7](variables.md#927-output-parameters) Output parameters
- [§9.2.8](variables.md#928-input-parameters) Input parameters
- [§9.2.9](variables.md#929-local-variables) Local variables
- [§9.2.9.1](variables.md#9291-discards) Discards
- [§9.2.9.1](variables.md#9291-general) General
- [§9.2.9.2](variables.md#9292-discards) Discards
- [§9.3](variables.md#93-default-values) Default values
- [§9.4](variables.md#94-definite-assignment) Definite assignment
- [§9.4.1](variables.md#941-general) General
Expand Down
4 changes: 2 additions & 2 deletions standard/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4892,7 +4892,7 @@ A declaration expression that is a simple discard or where the *local_variable_t

Otherwise, the declaration expression is classified as an *explicitly typed* variable, and the type of the expression as well as the declared variable shall be that given by the *local_variable_type*.

A declaration expression with the identifier `_` is a discard ([§9.2.9.1](variables.md#9291-discards)), and does not introduce a name for the variable. A declaration expression with an identifier other than `_` introduces that name into the nearest enclosing local variable declaration space ([§7.3](basic-concepts.md#73-declarations)).
A declaration expression with the identifier `_` is a discard ([§9.2.9.2](variables.md#9292-discards)), and does not introduce a name for the variable. A declaration expression with an identifier other than `_` introduces that name into the nearest enclosing local variable declaration space ([§7.3](basic-concepts.md#73-declarations)).

> *Example*:
>
Expand Down Expand Up @@ -5227,7 +5227,7 @@ Any local variable, value parameter, or parameter array whose scope includes the
#### 12.19.6.2 Captured outer variables
When an outer variable is referenced by an anonymous function, the outer variable is said to have been ***captured*** by the anonymous function. Ordinarily, the lifetime of a local variable is limited to execution of the block or statement with which it is associated (§local-var-general). However, the lifetime of a captured outer variable is extended at least until the delegate or expression tree created from the anonymous function becomes eligible for garbage collection.
When an outer variable is referenced by an anonymous function, the outer variable is said to have been ***captured*** by the anonymous function. Ordinarily, the lifetime of a local variable is limited to execution of the block or statement with which it is associated ([§9.2.9.1](variables.md#9291-general)). However, the lifetime of a captured outer variable is extended at least until the delegate or expression tree created from the anonymous function becomes eligible for garbage collection.
> *Example*: In the example
>
Expand Down
2 changes: 1 addition & 1 deletion standard/lexical-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ Two identifiers are considered the same if they are identical after the followin
The semantics of an identifier named `_` depends on the context in which it appears:
- It can denote a named program element, such as a variable, class, or method, or
- It can denote a discard ([§9.2.9.1](variables.md#9291-discards)).
- It can denote a discard ([§9.2.9.2](variables.md#9292-discards)).
Identifiers containing two consecutive underscore characters (`U+005F`) are reserved for use by the implementation; however, no diagnostic is required if such an identifier is defined.
Expand Down
4 changes: 2 additions & 2 deletions standard/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The runtime type of the value is tested against the *type* in the pattern using

> *Note*: The is-type expression `e is T` and the declaration pattern `e is T _` are equivalent when `T` isn’t a nullable type. *end note*
Given a pattern input value ([§11.1](patterns.md#111-general)) *e*, if the *simple_designation* is the *identifier* `_`, it denotes a discard ([§9.2.9.1](variables.md#9291-discards)) and the value of *e* is not bound to anything. (Although a declared variable with the name `_` may be in scope at that point, that named variable is not seen in this context.) If *simple_designation* is any other identifier, a local variable (§local-var-general) of the given type named by the given identifier is introduced. That local variable is assigned the value of the pattern input value when the pattern *matches* the value.
Given a pattern input value ([§11.1](patterns.md#111-general)) *e*, if the *simple_designation* is the *identifier* `_`, it denotes a discard ([§9.2.9.2](variables.md#9292-discards)) and the value of *e* is not bound to anything. (Although a declared variable with the name `_` may be in scope at that point, that named variable is not seen in this context.) If *simple_designation* is any other identifier, a local variable ([§9.2.9.1](variables.md#9291-general)) of the given type named by the given identifier is introduced. That local variable is assigned the value of the pattern input value when the pattern *matches* the value.

Certain combinations of static type of the pattern input value and the given type are considered incompatible and result in a compile-time error. A value of static type `E` is said to be ***pattern compatible*** with the type `T` if there exists an identity conversion, an implicit or explicit reference conversion, a boxing conversion, or an unboxing conversion from `E` to `T`, or if either `E` or `T` is an open type ([§8.4.3](types.md#843-open-and-closed-types)). A declaration pattern naming a type `T` is *applicable to* every type `E` for which `E` is pattern compatible with `T`.

Expand Down Expand Up @@ -160,7 +160,7 @@ designation
;
```
Given a pattern input value ([§11.1](patterns.md#111-general)) *e*, if *designation* is the *identifier* `_`, it denotes a discard ([§9.2.9.1](variables.md#9291-discards)), and the value of *e* is not bound to anything. (Although a declared variable with that name may be in scope at that point, that named variable is not seen in this context.) If *designation* is any other identifier, at runtime the value of *e* is bound to a newly introduced local variable (§local-var-general) of that name whose type is the static type of *e*, and the pattern input value is assigned to that local variable.
Given a pattern input value ([§11.1](patterns.md#111-general)) *e*, if *designation* is the *identifier* `_`, it denotes a discard ([§9.2.9.2](variables.md#9292-discards)), and the value of *e* is not bound to anything. (Although a declared variable with that name may be in scope at that point, that named variable is not seen in this context.) If *designation* is any other identifier, at runtime the value of *e* is bound to a newly introduced local variable ([§9.2.9.1](variables.md#9291-general)) of that name whose type is the static type of *e*, and the pattern input value is assigned to that local variable.

It is an error if the name `var` would bind to a type where a *var_pattern* is used.

Expand Down
6 changes: 3 additions & 3 deletions standard/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Input parameters are discussed further in [§15.6.2.3.2](classes.md#156232-input
### 9.2.9 Local variables
#### §local-var-general General
#### 9.2.9.1 General
A ***local variable*** is declared by a *local_variable_declaration*, *declaration_expression*, *foreach_statement*, or *specific_catch_clause* of a *try_statement*. A local variable can also be declared by certain kinds of *pattern*s ([§11](patterns.md#11-patterns-and-pattern-matching)). For a *foreach_statement*, the local variable is an iteration variable ([§13.9.5](statements.md#1395-the-foreach-statement)). For a *specific_catch_clause*, the local variable is an exception variable ([§13.11](statements.md#1311-the-try-statement)). A local variable declared by a *foreach_statement* or *specific_catch_clause* is considered initially assigned.
Expand Down Expand Up @@ -157,7 +157,7 @@ A local variable introduced by a *local_variable_declaration* or *declaration_ex
>
> *end note*
#### 9.2.9.1 Discards
#### 9.2.9.2 Discards
A ***discard*** is a local variable that has no name. A discard is introduced by a declaration expression ([§12.17](expressions.md#1217-declaration-expressions)) with the identifier `_`; and is either implicitly typed (`_` or `var _`) or explicitly typed (`T _`).
Expand Down Expand Up @@ -1075,7 +1075,7 @@ For any variable, the ***ref-safe-context*** of that variable is the context whe
There are three ref-safe-contexts:
- ***declaration-block***: The ref-safe-context of a *variable_reference* to a local variable (§local-var-general) is that local variables scope ([§13.6.2](statements.md#1362-local-variable-declarations)), including any nested *embedded-statement*s in that scope.
- ***declaration-block***: The ref-safe-context of a *variable_reference* to a local variable (9.2.9.1](variables.md#9291-general)) is that local variables scope ([§13.6.2](statements.md#1362-local-variable-declarations)), including any nested *embedded-statement*s in that scope.
A *variable_reference* to a local variable is a valid referent for a reference variable only if the reference variable is declared within the ref-safe-context of that variable.
Expand Down

0 comments on commit 4e64ae0

Please sign in to comment.