@@ -4,7 +4,7 @@ Author: Bob Nystrom
4
4
5
5
Status: Accepted
6
6
7
- Version 1.12 (see [ CHANGELOG] ( #CHANGELOG ) at end)
7
+ Version 1.13 (see [ CHANGELOG] ( #CHANGELOG ) at end)
8
8
9
9
## Motivation
10
10
@@ -122,6 +122,8 @@ not captured by the grammar. It is a compile-time error if a record has any of:
122
122
123
123
* Only one positional field and no trailing comma.
124
124
125
+ * No fields and a trailing comma. * The expression ` (,) ` isn't allowed.*
126
+
125
127
* A field named ` hashCode ` , ` runtimeType ` , ` noSuchMethod ` , or ` toString ` .
126
128
127
129
* A field name that starts with an underscore.
@@ -138,8 +140,7 @@ var number = (1); // The number 1.
138
140
var record = (1,); // A record containing the number 1.
139
141
```
140
142
141
- There is no syntax for a zero-field record expression. Instead, there is a
142
- static constant ` empty ` on ` Record ` that returns the empty record.
143
+ The expression ` () ` refers to the constant empty record with no fields.
143
144
144
145
### Record type annotations
145
146
@@ -347,8 +348,8 @@ fields are) and collection literals.
347
348
### Constants
348
349
349
350
Record expressions can be constant and potentially constant expressions. A
350
- record expression is a compile-time constant expression if and only if all its
351
- field expressions are compile-time constant expressions.
351
+ record expression is a compile-time constant expression if and only if all of
352
+ its field expressions are compile-time constant expressions.
352
353
353
354
* This is true whether the expression occurs in a constant context or not, which
354
355
means that a record expression can be used directly as a parameter default value
@@ -587,6 +588,10 @@ covariant in their field types.
587
588
588
589
## CHANGELOG
589
590
591
+ ### 1.13
592
+
593
+ - Introduce ` () ` syntax for empty record expressions and remove ` Record.empty ` .
594
+
590
595
### 1.12
591
596
592
597
- Include record types in ` typeNotVoid ` . This allows them to appear in ` is ` and
0 commit comments