@@ -4,7 +4,7 @@ Author: Bob Nystrom
4
4
5
5
Status: Accepted
6
6
7
- Version 1.9 (see [ CHANGELOG] ( #CHANGELOG ) at end)
7
+ Version 1.11 (see [ CHANGELOG] ( #CHANGELOG ) at end)
8
8
9
9
## Motivation
10
10
@@ -124,6 +124,8 @@ not captured by the grammar. It is a compile-time error if a record has any of:
124
124
125
125
* A field named ` hashCode ` , ` runtimeType ` , ` noSuchMethod ` , or ` toString ` .
126
126
127
+ * A field name that starts with an underscore.
128
+
127
129
* A field name that collides with the synthesized getter name of a positional
128
130
field. * For example: ` ('pos', $0: 'named') ` since the named field '$0'
129
131
collides with the getter for the first positional field.*
@@ -213,6 +215,8 @@ It is a compile-time error if a record type has any of:
213
215
* A named field named ` hashCode ` , ` runtimeType ` , ` noSuchMethod ` , or
214
216
` toString ` .
215
217
218
+ * A field name that starts with an underscore.
219
+
216
220
* A field name that collides with the synthesized getter name of a positional
217
221
field. * For example: ` (int, $0: int) ` since the named field '$0' collides
218
222
with the getter for the first positional field.*
@@ -264,15 +268,8 @@ structural, not nominal. Records produced in unrelated libraries have the exact
264
268
same static type if they have the same shape and their corresponding fields have
265
269
the same types.
266
270
267
- If a field name starts with an underscore, it is private and is only accessible
268
- in the library where it appears. The records ` (_foo: 1) ` and ` (_foo: 1) `
269
- appearing in different libraries do * not* have the same shape because each
270
- ` _foo ` is considered a distinct name. Likewise, the record types ` ({int _foo}) `
271
- and ` ({int _foo}) ` are not the same type if those annotations appear in
272
- different libraries.
273
-
274
- The order of named fields is not significant. The record types ` ({int a, int b}) `
275
- and ` ({int b, int a}) ` are identical to the type system and the runtime. (Tools
271
+ The order of named fields is not significant. The record types ` {int a, int b} `
272
+ and ` {int b, int a} ` are identical to the type system and the runtime. (Tools
276
273
may or may not display them to users in a canonical form similar to how they
277
274
handle function typedefs.)
278
275
@@ -582,6 +579,10 @@ covariant in their field types.
582
579
583
580
## CHANGELOG
584
581
582
+ ### 1.11
583
+
584
+ - Revert back to disallowing private field names in records.
585
+
585
586
### 1.10
586
587
587
588
- Allow private named fields in records (#2387 ).
0 commit comments