Skip to content

Commit f9af002

Browse files
committed
Update anchors and tags
1 parent 462d109 commit f9af002

7 files changed

Lines changed: 35 additions & 25 deletions

File tree

standard/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,9 @@
606606
- [§15.6.7](classes.md#1567-abstract-methods) Abstract methods
607607
- [§15.6.8](classes.md#1568-external-methods) External methods
608608
- [§15.6.9](classes.md#1569-partial-methods) Partial methods
609+
- [§15.6.9.1](classes.md#15691-general) General
610+
- [§15.6.9.2](classes.md#15692-optional-partial-methods) Optional partial methods
611+
- [§15.6.9.3](classes.md#15693-required-partial-methods) Required partial methods
609612
- [§15.6.10](classes.md#15610-extension-methods) Extension methods
610613
- [§15.6.11](classes.md#15611-method-body) Method body
611614
- [§15.7](classes.md#157-properties) Properties

standard/basic-concepts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,8 @@ The ***scope*** of a name is the region of program text within which it is possi
790790
- The scope of a parameter declared in an *indexer_declaration* ([§15.9](classes.md#159-indexers)) is the *indexer_body* of that *indexer_declaration*.
791791
- The scope of a parameter declared in an *operator_declaration* ([§15.10](classes.md#1510-operators)) is the *operator_body* of that *operator_declaration*.
792792
- The scope of a parameter declared in a *constructor_declaration* ([§15.11](classes.md#1511-instance-constructors)) is the *constructor_initializer* and *block* of that *constructor_declaration*.
793-
- With the exception of discard parameters12.22.2), the scope of a parameter declared in a *lambda_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *lambda_expression_body* of that *lambda_expression*.
794-
- With the exception of discard parameters12.22.2), the scope of a parameter declared in an *anonymous_method_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *block* of that *anonymous_method_expression*.
793+
- With the exception of discard parameters ([§12.22.2](expressions.md#12222-anonymous-function-signatures)), the scope of a parameter declared in a *lambda_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *lambda_expression_body* of that *lambda_expression*.
794+
- With the exception of discard parameters ([§12.22.2](expressions.md#12222-anonymous-function-signatures)), the scope of a parameter declared in an *anonymous_method_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *block* of that *anonymous_method_expression*.
795795
- The scope of a label declared in a *labeled_statement* ([§13.5](statements.md#135-labeled-statements)) is the *block* in which the declaration occurs.
796796
- The scope of a local variable declared in a *local_variable_declaration* ([§13.6.2](statements.md#1362-local-variable-declarations)) is the *block* in which the declaration occurs.
797797
- The scope of a local variable declared in a *switch_block* of a `switch` statement ([§13.8.3](statements.md#1383-the-switch-statement)) is the *switch_block*.

standard/classes.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,7 +2193,7 @@ A declaration has a valid combination of modifiers if all of the following are t
21932193
- If the declaration includes the `private` modifier, then the declaration does not include any of the following modifiers: `virtual`, `override`, or `abstract`.
21942194
- If the declaration includes the `sealed` modifier, then the declaration also includes the `override` modifier.
21952195
- If the declaration includes the `partial` modifier, then it does not include the modifier `abstract`.
2196-
- If the declaration is for an optional partial method (§optional-partial-methods), then it does not include any of the following modifiers: `new`, `public`, `protected`, `internal`, `private`, `virtual`, `sealed`, `override`, or `extern`.
2196+
- If the declaration is for an optional partial method ([§15.6.9.2](classes.md#15692-optional-partial-methods)), then it does not include any of the following modifiers: `new`, `public`, `protected`, `internal`, `private`, `virtual`, `sealed`, `override`, or `extern`.
21972197

21982198
Methods are classified according to what, if anything, they return:
21992199

@@ -2434,7 +2434,7 @@ For a `struct` type, within an instance method, instance accessor ([§12.2.1](ex
24342434
24352435
A parameter declared with an `out` modifier is an ***output parameter***. For definite-assignment rules, see [§9.2.7](variables.md#927-output-parameters).
24362436
2437-
A method declared as an optional partial method (§optional-partial-methods) shall not have output parameters.
2437+
A method declared as an optional partial method ([§15.6.9.2](classes.md#15692-optional-partial-methods)) shall not have output parameters.
24382438
24392439
> *Note*: Output parameters are typically used in methods that produce multiple return values. *end note*
24402440
<!-- markdownlint-disable MD028 -->
@@ -3098,7 +3098,7 @@ The mechanism by which linkage to an external method is achieved is implementati
30983098
30993099
### 15.6.9 Partial methods
31003100
3101-
#### §partial-methods-general General
3101+
#### 15.6.9.1 General
31023102
31033103
When a *method declaration* includes a `partial` modifier, that method is said to be a ***partial method***. Partial methods may only be declared as members of partial types ([§15.2.7](classes.md#1527-partial-type-declarations)). Partial methods may be defined in one part of a type declaration and implemented in another.
31043104
@@ -3113,10 +3113,10 @@ Across the parts of a type declaration, there shall be exactly one defining part
31133113
31143114
- The declarations shall have the same method name, number of type parameters, and number of parameters.
31153115
- The declarations shall have the same modifiers except for the `async` and `extern` modifiers. The `async` and `extern` modifiers are allowed only on the implementing partial method declaration.
3116-
- Corresponding parameters in the declarations shall have the same modifiers (although not necessarily in the same order) and the same types (modulo differences in type parameter names). Tuple types8.3.11) used as parameters or return types shall have the same item names in both the defining and implementing partial method declarations.
3116+
- Corresponding parameters in the declarations shall have the same modifiers (although not necessarily in the same order) and the same types (modulo differences in type parameter names). Tuple types ([§8.3.11](types.md#8311-tuple-types)) used as parameters or return types shall have the same item names in both the defining and implementing partial method declarations.
31173117
- Corresponding type parameters in the declarations shall have the same constraints. An implementation may choose to issue a warning if the type parameter names are different in the defining and implementing declarations.
31183118
3119-
There are two variations of partial methods: required and optional. A ***required partial method*** (§required-partial-methods) is a partial method that includes one or more explicit access modifiers. An ***optional partial method*** (§optional-partial-methods) has no explicit access modifiers, and is implicitly private.
3119+
There are two variations of partial methods: required and optional. A ***required partial method*** ([§15.6.9.3](classes.md#15693-required-partial-methods)) is a partial method that includes one or more explicit access modifiers. An ***optional partial method*** ([§15.6.9.2](classes.md#15692-optional-partial-methods)) has no explicit access modifiers, and is implicitly private.
31203120
31213121
For a required partial method both the definition and implementation shall exist.
31223122
@@ -3173,7 +3173,7 @@ If an implementing declaration exists for a given partial method, the invocation
31733173
- The `partial` modifier is not included in the combined method declaration.
31743174
- The attributes in the resulting method declaration are the combined attributes of the defining and the implementing partial method declaration in unspecified order. Duplicates are not removed.
31753175
- The attributes on the parameters of the resulting method declaration are the combined attributes of the corresponding parameters of the defining and the implementing partial method declaration in unspecified order. Duplicates are not removed.
3176-
- Any default arguments (§15.6.2) in the implementing declaration are removed.
3176+
- Any default arguments ([§15.6.2](classes.md#1562-method-parameters)) in the implementing declaration are removed.
31773177
31783178
Partial methods are useful for allowing one part of a type declaration to customize the behavior of another part, e.g., one that is generated by a tool. Consider the following partial class declaration:
31793179
@@ -3257,11 +3257,11 @@ class Customer
32573257
}
32583258
```
32593259

3260-
#### §optional-partial-methods Optional partial methods
3260+
#### 15.6.9.2 Optional partial methods
32613261

32623262
An optional partial method shall have a `void` return type, and shall not declare out parameters. There shall be zero or one implementing declaration for each defining declaration. If no part implements the partial method, the partial method declaration and all calls to it are removed from the type declaration resulting from the combination of the parts. Whether or not an implementing declaration is given, invocation expressions may resolve to invocations of the partial method.
32633263

3264-
The implementing member for an optional partial method shall not be an external method (§15.6.8).
3264+
The implementing member for an optional partial method shall not be an external method ([§15.6.8](classes.md#1568-external-methods)).
32653265

32663266
> *Note*: Because an optional partial method always returns `void`, such invocation expressions will always be expression statements. Furthermore, because an optional partial method is implicitly `private`, such statements will always occur within one of the parts of the type declaration within which the partial method is declared. *end note*
32673267
@@ -3274,11 +3274,11 @@ If a defining declaration but not an implementing declaration is given for an op
32743274
- Expressions occurring as part of an invocation of `M` do not affect the definite assignment state ([§9.4](variables.md#94-definite-assignment)), which can potentially lead to compile-time errors.
32753275
- `M` cannot be the entry point for an application ([§7.1](basic-concepts.md#71-application-startup)).
32763276

3277-
#### §required-partial-methods Required partial methods
3277+
#### 15.6.9.3 Required partial methods
32783278

32793279
A required partial method declaration includes an explicit access modifier. There shall be exactly one implementing partial method declaration.
32803280

3281-
The implementing declaration for a required partial method may be an external method (§15.6.8). The `extern` modifier is allowed on an implementing partial declaration. It shall not be present on a defining partial declaration.
3281+
The implementing declaration for a required partial method may be an external method ([§15.6.8](classes.md#1568-external-methods)). The `extern` modifier is allowed on an implementing partial declaration. It shall not be present on a defining partial declaration.
32823282

32833283
> *Note:* The `private` access modifier is required on both the ***defining partial method declaration*** and the ***implementing partial method declaration*** of a private required partial method. *end note*
32843284

standard/expressions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ simple_name
15951595

15961596
A *simple_name* is either of the form `I` or of the form `I<A₁, ..., Aₑ>`, where `I` is a single identifier and `I<A₁, ..., Aₑ>` is an optional *type_argument_list*. When no *type_argument_list* is specified, consider `e` to be zero. The *simple_name* is evaluated and classified as follows:
15971597

1598-
- If `e` is zero and the *simple_name* appears within a local variable declaration space ([§7.3](basic-concepts.md#73-declarations)) that directly contains a local variable, parameter (with the exception of discard parameters (§12.22.2)), or constant with name `I`, then the *simple_name* refers to that local variable, parameter or constant and is classified as a variable or value.
1598+
- If `e` is zero and the *simple_name* appears within a local variable declaration space ([§7.3](basic-concepts.md#73-declarations)) that directly contains a local variable, parameter (with the exception of discard parameters ([§12.22.2](expressions.md#12222-anonymous-function-signatures))), or constant with name `I`, then the *simple_name* refers to that local variable, parameter or constant and is classified as a variable or value.
15991599
- If `e` is zero and the *simple_name* appears within a generic method declaration but outside the *attributes* of its *method_declaration*, and if that declaration includes a type parameter with name `I`, then the *simple_name* refers to that type parameter.
16001600
- Otherwise, for each instance type `T` ([§15.3.2](classes.md#1532-the-instance-type)), starting with the instance type of the immediately enclosing type declaration and continuing with the instance type of each enclosing class or struct declaration (if any):
16011601
- If `e` is zero and the declaration of `T` includes a type parameter with name `I`, then the *simple_name* refers to that type parameter.
@@ -5464,9 +5464,9 @@ If the modifier `static` is present, the anonymous function cannot capture state
54645464
A non-`static` local function or non-`static` anonymous function can capture state from an enclosing `static` anonymous function, but cannot capture state outside the enclosing `static` anonymous function.
54655465

54665466
<!-- markdownlint-disable MD028 -->
5467-
> *Note*: Removing the `static` modifier from an anonymous function in a valid program does not change the meaning of the program, other than possibly affecting delegate instance identity (§10.7.2). *end note*
5467+
> *Note*: Removing the `static` modifier from an anonymous function in a valid program does not change the meaning of the program, other than possibly affecting delegate instance identity ([§10.7.2](conversions.md#1072-evaluation-of-anonymous-function-conversions-to-delegate-types)). *end note*
54685468
5469-
> *Note*: A `static` anonymous function is not required to produce the same delegate instance on each evaluation. See §10.7.2. *end note*
5469+
> *Note*: A `static` anonymous function is not required to produce the same delegate instance on each evaluation. See [§10.7.2](conversions.md#1072-evaluation-of-anonymous-function-conversions-to-delegate-types). *end note*
54705470
<!-- markdownlint-enable MD028 -->
54715471
54725472
When recognising an *anonymous_function_body* if both the *null_conditional_invocation_expression* and *expression* alternatives are applicable then the former shall be chosen.

standard/grammar.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,11 @@ variable_reference
738738
739739
// Source: §11.2.1 General
740740
pattern
741-
: '(' pattern ')'
741+
: logical_pattern
742+
;
743+
744+
primary_pattern
745+
: parenthesized_pattern
742746
| declaration_pattern
743747
| constant_pattern
744748
| var_pattern
@@ -747,7 +751,10 @@ pattern
747751
| discard_pattern
748752
| type_pattern
749753
| relational_pattern
750-
| logical_pattern
754+
;
755+
756+
parenthesized_pattern
757+
: '(' pattern ')'
751758
;
752759
753760
// Source: §11.2.2 Declaration pattern
@@ -818,10 +825,10 @@ type_pattern
818825
819826
// Source: §11.2.9 Relational pattern
820827
relational_pattern
821-
: '<' constant_expression
822-
| '<=' constant_expression
823-
| '>' constant_expression
824-
| '>=' constant_expression
828+
: '<' relational_expression
829+
| '<=' relational_expression
830+
| '>' relational_expression
831+
| '>=' relational_expression
825832
;
826833
827834
// Source: §11.2.10 Logical pattern
@@ -841,7 +848,7 @@ conjunctive_pattern
841848
842849
negated_pattern
843850
: 'not' negated_pattern
844-
| pattern
851+
| primary_pattern
845852
;
846853
847854
// Source: §12.6.2.1 General

standard/patterns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ type_pattern
430430
;
431431
```
432432
433-
A type pattern naming a type `T` is *applicable to* every type `E` for which `E` is *pattern compatible* with `T` (§11.2.2).
433+
A type pattern naming a type `T` is *applicable to* every type `E` for which `E` is *pattern compatible* with `T` ([§11.2.2](patterns.md#1122-declaration-pattern)).
434434

435435
The runtime type of the value is tested against *type* using the same rules specified in the is-type operator ([§12.15.12.1](expressions.md#1215121-the-is-type-operator)). If the test succeeds, the pattern matches that value. It is a compile-time error if the *type* is a nullable type. This pattern form never matches a `null` value.
436436

@@ -522,7 +522,7 @@ In a *conjunctive_pattern*, the *input type* of the second pattern is narrowed b
522522
- If `P` is a type pattern, the *narrowed type* is the type of the type pattern's type.
523523
- Otherwise, if `P` is a declaration pattern, the *narrowed type* is the type of the declaration pattern's type.
524524
- Otherwise, if `P` is a recursive pattern that gives an explicit type, the *narrowed type* is that type.
525-
- Otherwise, if `P` is matched via the rules for `ITuple` in a *positional_pattern* (§11.2.5), the *narrowed type* is the type `System.ITuple`.
525+
- Otherwise, if `P` is matched via the rules for `ITuple` in a *positional_pattern* ([§11.2.5](patterns.md#1125-positional-pattern)), the *narrowed type* is the type `System.ITuple`.
526526
- Otherwise, if `P` is a constant pattern where the constant is not the null constant and where the expression has no *constant expression conversion* to the *input type*, the *narrowed type* is the type of the constant.
527527
- Otherwise, if `P` is a relational pattern where the constant expression has no *constant expression conversion* to the *input type*, the *narrowed type* is the type of the constant.
528528
- Otherwise, if `P` is an `or` pattern, the *narrowed type* is the common type of the *narrowed type* of the subpatterns if such a common type exists. For this purpose, the common type algorithm considers only identity, boxing, and implicit reference conversions, and it considers all subpatterns of a sequence of `or` patterns (ignoring parenthesized patterns).

standard/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ nullable_value_type
217217
;
218218
```
219219

220-
Because the names `nint` and `nuint` are not keywords there is syntactic ambiguity between recognising them as a *type_name* or a *value_type*. If type resolution (§7.8.1) on either of these names succeeds, that name shall be recognised as a *type_name*; otherwise it shall be recognised as a *value_type*.
220+
Because the names `nint` and `nuint` are not keywords there is syntactic ambiguity between recognising them as a *type_name* or a *value_type*. If type resolution ([§7.8.1](basic-concepts.md#781-general)) on either of these names succeeds, that name shall be recognised as a *type_name*; otherwise it shall be recognised as a *value_type*.
221221

222222
Unlike a variable of a reference type, a variable of a value type can contain the value `null` only if the value type is a nullable value type ([§8.3.12](types.md#8312-nullable-value-types)). For every non-nullable value type there is a corresponding nullable value type denoting the same set of values plus the value `null`.
223223

0 commit comments

Comments
 (0)