Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion standard/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1240,11 +1240,11 @@

This attribute may can be applied to any `ref` and it changes the ref-safe-context to be one level wider than its default. For example:

| UnscopedRef applied to | Original ref-safe-context | New ref-safe-context |

Check failure on line 1243 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1243:77 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected trailing pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md

Check failure on line 1243 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1243:1 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected leading pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md
| --- | --- | --- |

Check failure on line 1244 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1244:19 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected trailing pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md

Check failure on line 1244 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1244:1 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected leading pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md
| instance member | function-member | return-only |

Check failure on line 1245 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1245:51 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected trailing pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md

Check failure on line 1245 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1245:1 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected leading pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md
| `in` / `ref` parameter | return-only | caller-context |

Check failure on line 1246 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1246:57 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected trailing pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md

Check failure on line 1246 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1246:1 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected leading pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md
| `out` parameter | function-member | return-only |

Check failure on line 1247 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1247:51 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected trailing pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md

Check failure on line 1247 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / lint

Table pipe style

standard/attributes.md:1247:1 MD055/table-pipe-style Table pipe style [Expected: no_leading_or_trailing; Actual: leading_and_trailing; Unexpected leading pipe] https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md

When applying this attribute to an instance method of a struct it modifies the implicit `this` parameter; that is, `this` acts as an unannotated `ref` of the same type.

Expand Down Expand Up @@ -1510,7 +1510,7 @@

#### 23.5.11.1 The SetsRequiredMembers attribute

This attribute indicates that the constructor it decorates sets all required members for the current type, so callers do not need to set any required members themselves. However, the compiler doesn't verify that the constructor actually initializes all required members.
This attribute indicates that the constructor it decorates sets all required members for the current type, so callers do not need to set any required members themselves. However, the compiler doesnt verify that the constructor actually initializes all required members.

> *Example*:
>
Expand Down
14 changes: 7 additions & 7 deletions standard/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6298,17 +6298,17 @@ If a record class is derived directly from `object`, the record class type has a
System.Type EqualityContract { get; };
```

The property is `private` if the record class type is `sealed`. Otherwise, the property is `virtual` and `protected`. The property may be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or if the explicit declaration doesn't allow overriding in a derived type and the record class type is not `sealed`.
The property is `private` if the record class type is `sealed`. Otherwise, the property is `virtual` and `protected`. The property may be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or if the explicit declaration doesnt allow overriding in a derived type and the record class type is not `sealed`.

If the record class type is derived from some base record class type `Base`, the record class type includes a provided property declared as follows:

```csharp
protected override System.Type EqualityContract { get; };
```

The property may be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or if the explicit declaration doesn't allow overriding in a derived type and the record class type is not `sealed`. It is an error if either the provided or the explicitly declared property doesn't override a property with this signature in the record class type `Base` (for example, if the property is missing in the `Base`, or is sealed, or is not virtual). The provided property returns `typeof(R)` where `R` is the record class type.
The property may be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or if the explicit declaration doesnt allow overriding in a derived type and the record class type is not `sealed`. It is an error if either the provided or the explicitly declared property doesnt override a property with this signature in the record class type `Base` (for example, if the property is missing in the `Base`, or is sealed, or is not virtual). The provided property returns `typeof(R)` where `R` is the record class type.

The record class type implements `System.IEquatable<R>` and includes a provided, strongly-typed overload of `Equals(R? other)` where `R` is the record class type. The method is `public`, and the method is `virtual` unless the record class type is `sealed`. The method can be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or the explicit declaration doesn't allow overriding in a derived type and the record class type is not `sealed`.
The record class type implements `System.IEquatable<R>` and includes a provided, strongly-typed overload of `Equals(R? other)` where `R` is the record class type. The method is `public`, and the method is `virtual` unless the record class type is `sealed`. The method can be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or the explicit declaration doesnt allow overriding in a derived type and the record class type is not `sealed`.

If `Equals(R? other)` is user-defined but `GetHashCode` is not, a warning shall be issued.

Expand Down Expand Up @@ -6338,23 +6338,23 @@ If the record class type is derived from some base record class type, `Base`, th
public sealed override bool Equals(Base? other);
```

It is an error if the override is declared explicitly. It is an error if the method doesn't override a method with the same signature in record class type `Base` (for example, if the method is missing in the `Base`, or is sealed, or is not virtual). The provided override returns `Equals((object?)other)`.
It is an error if the override is declared explicitly. It is an error if the method doesnt override a method with the same signature in record class type `Base` (for example, if the method is missing in the `Base`, or is sealed, or is not virtual). The provided override returns `Equals((object?)other)`.

The record class type includes a provided override declared as follows:

```csharp
public override bool Equals(object? obj);
```

It is an error if the override is declared explicitly. It is an error if the method doesn't override `object.Equals(object? obj)` (for example, due to shadowing in intermediate base types). The provided override returns `Equals(other as R)` where `R` is the record class type.
It is an error if the override is declared explicitly. It is an error if the method doesnt override `object.Equals(object? obj)` (for example, due to shadowing in intermediate base types). The provided override returns `Equals(other as R)` where `R` is the record class type.

The record class type includes a provided override method declared as follows:

```csharp
public override int GetHashCode();
```

The method may be declared explicitly. It is an error if the explicit declaration doesn't allow overriding it in a derived type and the record class type is not `sealed`. It is an error if either the provided, or the explicitly declared, method doesn't override `object.GetHashCode()` (for example, due to shadowing in intermediate base types).
The method may be declared explicitly. It is an error if the explicit declaration doesnt allow overriding it in a derived type and the record class type is not `sealed`. It is an error if either the provided, or the explicitly declared, method doesnt override `object.GetHashCode()` (for example, due to shadowing in intermediate base types).

A warning shall be issued if one of `Equals(R?)` and `GetHashCode()` is explicitly declared, but the other is not.

Expand Down Expand Up @@ -6464,7 +6464,7 @@ A record class type contains two copying members:
- A copy constructor ([§15.11.6](classes.md#15116-copy-constructors))
- A provided public, parameter-less, instance clone method having an unspecified reserved name

The copy constructor shall not execute any instance field/property initializers present in the record class declaration. If the constructor is not explicitly declared, it shall be provided by the implementation. If the provided record class is sealed, the constructor shall be private; otherwise; it shall be protected. An explicitly declared copy constructor shall be either public or protected, unless the record class is sealed. The first thing the constructor shall do, is to call a copy constructor of the base class, or a parameter-less `object` constructor if the record inherits from `object`. It is an error for a user-defined copy constructor to use an implicit or explicit *constructor_initializer* that doesn't fulfill this requirement. After a base copy constructor is invoked, a provided copy constructor shall copy values for all instance fields implicitly or explicitly declared within the record class type. The sole presence of a copy constructor, whether explicit or implicit, shall not prevent an automatic addition of a default instance constructor.
The copy constructor shall not execute any instance field/property initializers present in the record class declaration. If the constructor is not explicitly declared, it shall be provided by the implementation. If the provided record class is sealed, the constructor shall be private; otherwise; it shall be protected. An explicitly declared copy constructor shall be either public or protected, unless the record class is sealed. The first thing the constructor shall do, is to call a copy constructor of the base class, or a parameter-less `object` constructor if the record inherits from `object`. It is an error for a user-defined copy constructor to use an implicit or explicit *constructor_initializer* that doesn’t fulfill this requirement. After a base copy constructor is invoked, a provided copy constructor shall copy values for all instance fields implicitly or explicitly declared within the record class type. The sole presence of a copy constructor, whether explicit or implicit, shall not prevent an automatic addition of a default instance constructor.

If a virtual clone method is present in the base record class, the provided clone method shall override it, and the return type of the clone method shall be the current containing type if the covariant-returns feature is supported, and the override return type otherwise. It is an error if the base record class clone method is sealed. If a virtual clone method is not present in the base record class, the return type of the clone method shall be the containing type and the method shall be virtual, unless the record class is sealed or abstract. If the containing record class is abstract, the provided clone method shall also be abstract. If the clone method is not abstract, it shall return the result of a call to a copy constructor.

Expand Down
2 changes: 1 addition & 1 deletion standard/conversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ An implicit enumeration conversion permits a *constant_expression* ([§12.26](ex

### 10.2.5 Implicit interpolated string conversions

For any type `T` that is an applicable interpolated string handler type ([§23.5.10.1.1](attributes.md#2351011-declaring-a-custom-handler)), there exists an implicit interpolated string handler conversion to `T` from a non-constant *ISE* ([§12.8.3](expressions.md#1283-interpolated-string-expressions)). This conversion exists, regardless of whether errors are found later when attempting to lower the interpolation using the handler pattern. This ensures that there are predictable and useful errors, and that runtime behavior doesn't change based on the content of an interpolated string.
For any type `T` that is an applicable interpolated string handler type ([§23.5.10.1.1](attributes.md#2351011-declaring-a-custom-handler)), there exists an implicit interpolated string handler conversion to `T` from a non-constant *ISE* ([§12.8.3](expressions.md#1283-interpolated-string-expressions)). This conversion exists, regardless of whether errors are found later when attempting to lower the interpolation using the handler pattern. This ensures that there are predictable and useful errors, and that runtime behavior doesnt change based on the content of an interpolated string.

### 10.2.6 Implicit nullable conversions

Expand Down
4 changes: 2 additions & 2 deletions standard/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5463,7 +5463,7 @@ local_variable_type
;
```

'scoped' shall only be permitted with *local_variable_type* if *local_variable_type* is 'var' or a ref struct type, and *identifer* is not a discard.
scoped shall only be permitted with *local_variable_type* if *local_variable_type* is var or a ref struct type, and *identifer* is not a discard.

The *simple_name* `_` is also considered a declaration expression if simple name lookup did not find an associated declaration ([§12.8.4](expressions.md#1284-simple-names)). When used as a declaration expression, `_` is called a *simple discard*. It is semantically equivalent to `var _`, but is permitted in more places.

Expand Down Expand Up @@ -5746,7 +5746,7 @@ The behavior of *lambda_expression*s and *anonymous_method_expression*s is the s
- *lambda_expression*s permit parameter types to be omitted and inferred whereas *anonymous_method_expression*s require parameter types to be explicitly stated.
- The body of a *lambda_expression* can be an expression or a block whereas the body of an *anonymous_method_expression* shall be a block.
- Only *lambda_expression*s have conversions to compatible expression tree types ([§8.6](types.md#86-expression-tree-types)).
- Only *lambda_expression* parameters may contain 'scoped'.
- Only *lambda_expression* parameters may contain scoped.
- Only *lambda_expression*s may have *attributes* and explicit return types.

The contextual keyword `var` shall not be used as an explicit return type in a *lambda_expression*.
Expand Down
2 changes: 1 addition & 1 deletion standard/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ argument_value
: expression
| 'in' 'scoped'? variable_reference
| 'ref' 'scoped'? variable_reference
| 'out' 'scoped'? declaration_expression
| 'out' 'scoped'? variable_reference
;

Expand Down Expand Up @@ -1804,7 +1805,6 @@ compound_assignment
compound_assignment_operator
: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '??='
| right_shift_assignment
| unsigned_right_shift_assignment
;

// Source: §12.25 Expression
Expand Down
4 changes: 2 additions & 2 deletions standard/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ For the purpose of these rules, a given argument `expr` passed to parameter `p`:

A property invocation (either `get` or `set`) is treated as a method invocation of the underlying method by the above rules.

> *Example*: The following illustrates how `scoped` affects the safe-context of a method's return value:
> *Example*: The following illustrates how `scoped` affects the safe-context of a methods return value:
>
> <!-- Example: {template:"standalone-lib-without-using", name:"MethodInvocationSafeContext", expectedErrors:["CS8347"]} -->
> ```csharp
Expand Down Expand Up @@ -1111,7 +1111,7 @@ The safe-context of a declaration variable from an `out` argument (`M(x, out var

- caller-context.
- If the out variable is marked `scoped`, then declaration-block (i.e., function-member or narrower).
- If the out variable's type is a `ref struct`, consider all arguments to the containing invocation, including the receiver:
- If the out variables type is a `ref struct`, consider all arguments to the containing invocation, including the receiver:
- The safe-context of any argument where its corresponding parameter is not `out` and has safe-context of return-only or wider.
- The ref-safe-context of any argument where its corresponding parameter has ref-safe-context of return-only or wider.

Expand Down
Loading