Skip to content

Commit 5f8ba23

Browse files
authored
Apply suggestions from code review
Tweaks I made when comparing this PR with what I researched 2+ years ago.
1 parent 940bce7 commit 5f8ba23

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
@@ -778,13 +778,13 @@ class_body
778778
;
779779
```
780780
781+
A non-record class shall not have a *class_body* of `;`.
782+
781783
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).
782784

783785
### 15.2.7 Partial type declarations
784786

785-
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)).
786-
787-
A non-record class shall not have a *class_body* of `;`.
787+
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)).
788788

789789
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.
790790

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

57555755
- `other` is not `null`, and
57565756
- 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
5757-
- 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
5758-
the value of `EqualityContract == other.EqualityContract`.
5757+
- 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`.
57595758

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

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

57985797
- 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
5799-
- If there is a base record class type, the value of `base.GetHashCode()`; otherwise
5800-
the value of `System.Collections.Generic.EqualityComparer<System.Type>.Default.GetHashCode(EqualityContract)`.
5798+
- 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)`.
58015799

58025800
> *Example*: Consider the following record class types:
58035801
>

standard/expressions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3849,7 +3849,6 @@ with_expression
38493849
: switch_expression
38503850
| switch_expression 'with' '{' member_initializer_list? '}'
38513851
;
3852-
38533852
```
38543853

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

0 commit comments

Comments
 (0)