Skip to content

Commit e25f30a

Browse files
RexJaeschkeBillWagner
authored andcommitted
support record structs
1 parent 3bcd6f0 commit e25f30a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

standard/expressions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3901,7 +3901,7 @@ An awaiter’s implementation of the interface methods `INotifyCompletion.OnComp
39013901

39023902
## 12.10 With expressions
39033903

3904-
A *with_expression* allows for ***non-destructive mutation*** by making a new record class instance that is a copy of an existing record class instance, optionally with specified properties and fields modified.
3904+
A *with_expression* allows for ***non-destructive mutation*** by making a new record class, record struct, or non-record struct instance that is a copy of an existing record class, record struct, or non-record struct instance, respectively, optionally with specified properties and fields modified.
39053905

39063906
```ANTLR
39073907
with_expression
@@ -3912,15 +3912,15 @@ with_expression
39123912

39133913
A *with_expression* is not permitted as a statement.
39143914

3915-
The receiver type shall be non-`void` and of some record class type.
3915+
The receiver type shall be non-`void` and of some record class, record struct, or non-record struct type.
39163916

39173917
*identifier* shall be an accessible instance field or property of the receiver's type.
39183918

39193919
All non-positional properties being changed shall have both set and init accessors.
39203920

39213921
This expression is evaluated as follows:
39223922

3923-
- The receiver's clone method ([§15.16.3](classes.md#15163-copy-and-clone-members)) is invoked, and its result is converted to the receiver’s type.
3923+
- For a record class type, the receiver's clone method ([§15.16.3](classes.md#15163-copy-and-clone-members)) is invoked, and its result is converted to the receiver’s type.
39243924
- Each `member_initializer` is processed the same way as an assignment to
39253925
a field or property access of the result of the conversion. Assignments are processed in lexical order. If *member_initializer_list* is omitted, no members are changed.
39263926

0 commit comments

Comments
 (0)