Skip to content

Commit 8421309

Browse files
RexJaeschkeBillWagner
authored andcommitted
Apply suggestions from code review
Tweaks I made when comparing this PR with what I researched 2+ years ago.
1 parent d232863 commit 8421309

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

standard/classes.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,13 @@ class_body
779779
;
780780
```
781781
782+
A non-record class shall not have a *class_body* of `;`.
783+
782784
For a record class, the *class_body*s `{}`, `{};`, and `;` are equivalent. They all indicate that the only members are those synthesized by the compiler (§synth-members).
783785

784786
### 15.2.7 Partial type declarations
785787

786-
The modifier `partial` is used when defining a class, struct, or interface type in multiple parts. The `partial` modifier is a contextual keyword ([§6.4.4](lexical-structure.md#644-keywords)) and has special meaning immediately before the keywords `class`, `struct`, and `interface`. (A partial type may contain partial method declarations ([§15.6.9](classes.md#1569-partial-methods)).
787-
788-
A non-record class shall not have a *class_body* of `;`.
788+
The modifier `partial` is used when defining a class, struct, or interface type in multiple parts. The `partial` modifier is a contextual keyword ([§6.4.4](lexical-structure.md#644-keywords)) and has special meaning in a *class_declaration*, a *struct_declaration*, or an *interface_declaration*. (A partial type may contain partial method declarations ([§15.6.9](classes.md#1569-partial-methods)).
789789

790790
Each part of a ***partial type*** declaration shall include a `partial` modifier and shall be declared in the same namespace or containing type as the other parts. The `partial` modifier indicates that additional parts of the type declaration might exist elsewhere, but the existence of such additional parts is not a requirement; it is valid for the only declaration of a type to include the `partial` modifier. It is valid for only one declaration of a partial type to include the base class or implemented interfaces. However, all declarations of a base class or implemented interfaces shall match, including the nullability of any specified type arguments.
791791

@@ -5757,8 +5757,7 @@ The synthesized `Equals(R?)` returns `true` if and only if each of the following
57575757

57585758
- `other` is not `null`, and
57595759
- For each instance field `fieldN` in the record class type that is not inherited, the value of `System.Collections.Generic.EqualityComparer<TN>.Default.Equals(fieldN, other.fieldN)` where `TN` is the field type, and
5760-
- If there is a base record class type, the value of `base.Equals(other)` (a non-virtual call to `public virtual bool Equals(Base? other)`); otherwise
5761-
the value of `EqualityContract == other.EqualityContract`.
5760+
- If there is a base record class type, the value of `base.Equals(other)` (a non-virtual call to `public virtual bool Equals(Base? other)`); otherwise the value of `EqualityContract == other.EqualityContract`.
57625761

57635762
The record class type includes synthesized `==` and `!=` operators equivalent to operators declared as follows:
57645763

@@ -5799,8 +5798,7 @@ A warning shall be issued if one of `Equals(R?)` and `GetHashCode()` is explicit
57995798
The synthesized override of `GetHashCode()` returns an `int` result of combining the following values:
58005799

58015800
- For each instance field `fieldN` in the record class type that is not inherited, the value of `System.Collections.Generic.EqualityComparer<TN>.Default.GetHashCode(fieldN)` where `TN` is the field type, and
5802-
- If there is a base record class type, the value of `base.GetHashCode()`; otherwise
5803-
the value of `System.Collections.Generic.EqualityComparer<System.Type>.Default.GetHashCode(EqualityContract)`.
5801+
- If there is a base record class type, the value of `base.GetHashCode()`; otherwise the value of `System.Collections.Generic.EqualityComparer<System.Type>.Default.GetHashCode(EqualityContract)`.
58045802

58055803
> *Example*: Consider the following record class types:
58065804
>

standard/expressions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3826,7 +3826,6 @@ with_expression
38263826
: switch_expression
38273827
| switch_expression 'with' '{' member_initializer_list? '}'
38283828
;
3829-
38303829
```
38313830

38323831
A *with_expression* is not permitted as a statement.

0 commit comments

Comments
 (0)