You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard/classes.md
+46-15Lines changed: 46 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2073,7 +2073,7 @@ ref_kind
2073
2073
;
2074
2074
2075
2075
ref_method_modifiers
2076
-
:ref_method_modifier*
2076
+
:ref_method_modifier*'partial'?
2077
2077
;
2078
2078
2079
2079
method_header
@@ -2150,15 +2150,16 @@ A declaration has a valid combination of modifiers if all of the following are t
2150
2150
- The declaration may include the `abstract` and `override` modifiers so that an abstract member may override a virtual member.
2151
2151
- If the declaration includes the `private` modifier, then the declaration does not include any of the following modifiers: `virtual`, `override`, or `abstract`.
2152
2152
- If the declaration includes the `sealed` modifier, then the declaration also includes the `override` modifier.
2153
-
- If the declaration includes the `partial` modifier, then it does not include any of the following modifiers: `new`, `public`, `protected`, `internal`, `private`, `virtual`, `sealed`, `override`, `abstract`, or `extern`.
2153
+
- If the declaration includes the `partial` modifier, then it does not include the modifier `abstract`.
2154
+
- If the declaration is for a restricted partial method ([§15.6.9](classes.md#1569-partial-methods)), then it does not include any of the following modifiers: `new`, `public`, `protected`, `internal`, `private`, `virtual`, `sealed`, `override`, or `extern`.
2154
2155
2155
2156
Methods are classified according to what, if anything, they return:
2156
2157
2157
2158
- If `ref` is present, the method is ***returns-by-ref*** and returns a *variable reference*, that is optionally read-only;
2158
2159
- Otherwise, if *return_type* is `void`, the method is ***returns-no-value*** and does not return a value;
2159
2160
- Otherwise, the method is ***returns-by-value*** and returns a value.
2160
2161
2161
-
The *return_type* of a returns-by-value or returns-no-value method declaration specifies the type of the result, if any, returned by the method. Only a returns-no-value method may include the `partial` modifier ([§15.6.9](classes.md#1569-partial-methods)). If the declaration includes the `async` modifier then *return_type* shall be `void` or the method returns-by-value and the return type is a *task type* ([§15.14.1](classes.md#15141-general)).
2162
+
The *return_type* of a returns-by-value or returns-no-value method declaration specifies the type of the result, if any, returned by the method. Only a returns-no-value method may include the `partial` modifier ([§15.6.9](classes.md#1569-partial-methods)). If the declaration includes the `async` modifier then *return_type*for a restricted partial method shall be `void` or the method returns-by-value and the return type is a *task type* ([§15.14.1](classes.md#15141-general)).
2162
2163
2163
2164
The *ref_return_type* of a returns-by-ref method declaration specifies the type of the variable referenced by the *variable_reference* returned by the method.
2164
2165
@@ -2387,7 +2388,7 @@ For a `struct` type, within an instance method, instance accessor ([§12.2.1](ex
2387
2388
2388
2389
A parameter declared with an `out` modifier is an ***output parameter***. For definite-assignment rules, see [§9.2.7](variables.md#927-output-parameters).
2389
2390
2390
-
A method declared as a partial method ([§15.6.9](classes.md#1569-partial-methods)) shall not have output parameters.
2391
+
A method declared as a restricted partial method ([§15.6.9](classes.md#1569-partial-methods)) shall not have output parameters.
Overtime, thespecificationfor partial methods has evolved, resulting in restricted and unrestricted versions. A ***restricted partial method*** has no explicit access modifiers (and is implicitlyprivate), hasa `void` returntype, andhasnooutparameters. An***unrestrictedpartialmethod***isapartialmethodthathasexplicitaccessmodifiers, anon-`void` returntype, oranyoutparameters.
> *Note*:Thedefinitionofmatchingdefiningandimplementingpartialmethoddeclarationsdoesnotrequireparameternamestomatch. Thiscanproduce*surprising*, albeit*welldefined*, behaviourwhennamedarguments ([§12.6.2.1](expressions.md#12621-general)) areused. Forexample, giventhedefiningpartialmethoddeclarationfor `M` in one file, and the implementing partial method declaration in another file:
Ifanimplementingdeclarationexistsforagivenpartialmethod, theinvocationsofthepartialmethodsareretained. Thepartialmethodgivesrisetoamethoddeclarationsimilartotheimplementingpartialmethoddeclarationexceptfor the following:
3069
3100
@@ -3073,7 +3104,7 @@ If an implementing declaration exists for a given partial method, the invocation
3073
3104
3074
3105
- 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.
0 commit comments