Skip to content

Commit feb15f5

Browse files
committed
2 parents 0f689e4 + da01894 commit feb15f5

File tree

9 files changed

+67
-48
lines changed

9 files changed

+67
-48
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
)
2727
2828
steps:
29-
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
29+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
3030
- name: Install latex tools
3131
run: |
3232
sudo apt-get update -qq

.github/workflows/dart.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
analyze:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
16+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
1717
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
1818
with:
1919
sdk: main
@@ -34,7 +34,7 @@ jobs:
3434
test:
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
37+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
3838
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
3939
with:
4040
sdk: main

accepted/2.15/constructor-tearoffs/feature-specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ _The syntax without type arguments is currently allowed by the language grammar,
6161

6262
A named constructor tear-off expression of one of the forms above evaluates to a function value which could be created by tearing off a *corresponding constructor function*, which would be a static function defined on the class denoted by *C*, with a fresh name here represented by adding `$tearoff`:
6363

64-
> <code>static *C* *name*$tearoff\<*typeParams*>(*params*) => *C*\<*typeArgs*>.*name*(*args*);</code>
64+
> <code>static *C*\<*typeArgs*> *name*$tearoff\<*typeParams*>(*params*) => *C*\<*typeArgs*>.*name*(*args*);</code>
6565
6666
If *C* is not generic, then <code>\<*typeParams*\></code> and <code>\<*typeArgs*\></code> are omitted. Otherwise <code>\<*typeParams*\></code> are exactly the same type parameters as those of the class declaration of *C* (including bounds), and <code>\<*typeArgs*></code> applies those type parameter variables directly as type arguments to *C*.
6767

accepted/2.3/unified-collections/feature-specification.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Unified Collections
22

3+
## Status
4+
5+
**This document serves to document the background and history of the unified
6+
collections feature. The source of truth on this topic at this time is the
7+
'Collection Literals' section of the [language specification][]
8+
([PDF][language specification PDF]).**
9+
10+
[language specification]: https://github.com/dart-lang/language/blob/master/specification/dartLangSpec.tex
11+
[language specification PDF]: https://spec.dart.dev/DartLangSpecDraft.pdf
12+
313
The Dart team is concurrently working on three proposals that affect collection
414
literals:
515

@@ -16,10 +26,10 @@ To make things easier on implementers and anyone else trying to understand the
1626
entire set of changes, this specification unifies and subsumes all three of
1727
those proposals.
1828

19-
**This document is now the source of truth for these language changes.** The
29+
**This document is a further development of the documents about spread collections
30+
and control flow collections, and it supersedes those documents.** The
2031
other three proposals are useful because they contain motivation and other
2132
context, but the precise syntax and semantics may be out of date in those docs.
22-
This is where you should be looking if you're an implementer.
2333

2434
## Grammar
2535

accepted/future-releases/extension-types/feature-specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ A compile-time error occurs if the extension type declaration declares any
432432
instance variables, unless they are `external`.
433433

434434
*An external instance variable is just a convenient notation for an external
435-
getter and (if not `final`) an external setter. They are allowed.*
435+
getter and (if not `final`) an external setter, which are both allowed.*
436436

437437
The _name of the representation_ in an extension type declaration with a
438438
representation declaration of the form `(T id)` is the identifier `id`, and

working/1426-extension-types/feature-specification-inline-classes.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
44

5-
Status: Accepted.
5+
Status: Obsolete
66

7+
**This proposal is now obsolete. The mechanism has been renamed to
8+
_extension types_. Please see the [extension types specification][] for the
9+
accepted specification proposal.**
10+
11+
[extension types specification]: https://github.com/dart-lang/language/blob/main/accepted/future-releases/extension-types/feature-specification.md
712

813
## Change Log
914

working/1426-extension-types/feature-specification-views.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Author: [email protected]
44

55
Status: Obsolete
66

7-
**This proposal is now obsolete. The mechanism has been renamed to _inline
8-
classes_. Please see the [inline classes specification][2] for the most recent proposed
9-
specification.**
7+
**This proposal is now obsolete. The mechanism has been renamed to
8+
_extension types_. Please see the [extension types specification][] for the
9+
accepted specification proposal.**
1010

11-
[2]: https://github.com/dart-lang/language/blob/master/accepted/future-releases/inline-classes/feature-specification.md
11+
[extension types specification]: https://github.com/dart-lang/language/blob/main/accepted/future-releases/extension-types/feature-specification.md
1212

1313

1414
## Change Log

working/1426-extension-types/feature-specification.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
44

5-
Status: Draft
5+
Status: Obsolete
6+
7+
**This proposal is now obsolete. The mechanism has been renamed multiple times, and the
8+
current name is again _extension types_. Please see the new
9+
[extension types specification][] for the accepted specification proposal.**
10+
11+
[extension types specification]: https://github.com/dart-lang/language/blob/main/accepted/future-releases/extension-types/feature-specification.md
612

713

814
## Change Log

working/2364 - primary constructors/feature-specification.md

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ with two fields and a constructor:
4141

4242
```dart
4343
// Current syntax.
44-
4544
class Point {
4645
int x;
4746
int y;
@@ -54,7 +53,6 @@ concisely:
5453

5554
```dart
5655
// A declaration with the same meaning, using a primary constructor.
57-
5856
class Point(int x, int y);
5957
```
6058

@@ -66,12 +64,14 @@ library, so we should read the examples as "you can write this _or_ you can
6664
write that". So the example above would be shown as follows:
6765

6866
```dart
67+
// Current syntax.
6968
class Point {
7069
int x;
7170
int y;
7271
Point(this.x, this.y);
7372
}
7473
74+
// Using a primary constructor.
7575
class Point(int x, int y);
7676
```
7777

@@ -114,12 +114,14 @@ initializing formal anyway, so they will just need to be declared using a
114114
normal `external` variable declaration.
115115

116116
```dart
117+
// Current syntax.
117118
class ModifierClass {
118119
late int x;
119120
external double d;
120121
ModifierClass(this.x);
121122
}
122123
124+
// Using a primary constructor.
123125
class ModifierClass(this.x) {
124126
late int x;
125127
external double d;
@@ -132,6 +134,7 @@ class ModifierClass(this.x) {
132134
Super parameters can be declared in the same way as in a body constructor:
133135

134136
```dart
137+
// Current syntax.
135138
class A {
136139
final int a;
137140
A(this.a);
@@ -141,19 +144,22 @@ class B extends A {
141144
B(super.a);
142145
}
143146
147+
// Using a primary constructor.
144148
class A(final int a);
145149
class B(super.a) extends A;
146150
```
147151

148152
Next, the constructor can be named, and it can be constant:
149153

150154
```dart
155+
// Current syntax.
151156
class Point {
152157
final int x;
153158
final int y;
154159
const Point._(this.x, this.y);
155160
}
156161
162+
// Using a primary constructor.
157163
class const Point._(final int x, final int y);
158164
```
159165

@@ -182,16 +188,14 @@ declaration is an `extension type` or an `enum` declaration, the modifier
182188
from the formal parameter in the primary constructor:
183189

184190
```dart
185-
extension type I.name(int x); // Must use a primary constructor.
191+
// Current syntax.
186192
187193
class Point {
188194
final int x;
189195
final int y;
190196
const Point(this.x, this.y);
191197
}
192198
193-
class const Point(int x, int y);
194-
195199
enum E {
196200
one('a'),
197201
two('b');
@@ -200,7 +204,14 @@ enum E {
200204
const E(this.s);
201205
}
202206
207+
// Using a primary constructor.
208+
209+
class const Point(int x, int y);
210+
203211
enum E(String s) { one('a'), two('b') }
212+
213+
extension type I.name(int x); // Must use a primary constructor.
214+
204215
```
205216

206217
This mechanism follows an existing pattern, where `const` modifiers can be
@@ -218,78 +229,63 @@ Optional parameters can be declared as usual in a primary constructor, with
218229
default values that must be constant as usual:
219230

220231
```dart
232+
// Current syntax.
221233
class Point {
222234
int x;
223235
int y;
224236
Point(this.x, [this.y = 0]);
225237
}
226238
239+
// Using a primary constructor.
227240
class Point(int x, [int y = 0]);
228241
```
229242

230243
Similarly for named parameters, required or not:
231244

232245
```dart
246+
// Current syntax.
233247
class Point {
234248
int x;
235249
int y;
236250
Point(this.x, {required this.y});
237251
}
238252
253+
// Using a primary constructor.
239254
class Point(int x, {required int y});
240255
```
241256

242257
In this declaration it is possible to omit the modifier `required` on the
243258
named parameter `y`, because it is implied by the fact that the type of `y`
244259
is non-nullable (potentially non-nullable is enough).
245260

246-
The current scope for the default values in the primary constructor is the
247-
enclosing library scope. This means that a naive copy/paste operation on
248-
the source code could change the meaning of the default value. In that case
249-
a new way to denote the given value is established. For example, consider
250-
this class using a primary constructor:
251-
252-
```dart
253-
static const d = 42;
254-
255-
class Point(int x, [int y = d]) {
256-
void d() {}
257-
}
258-
```
259-
260-
This corresponds to the following class without a primary constructor:
261-
262-
```dart
263-
static const d = 42;
264-
static const _freshName = d; // Eliminate the name clash.
265-
266-
class Point {
267-
int x;
268-
int y;
269-
Point(this.x, [this.y = _freshName]);
270-
void d() {}
271-
}
272-
```
273-
274261
The class header can have additional elements, just like class headers
275262
where there is no primary constructor:
276263

277264
```dart
265+
// Current syntax.
278266
class D<TypeVariable extends Bound> extends A with M implements B, C {
279267
final int x;
280268
final int y;
281269
const D.named(this.x, [this.y = 0]);
282270
}
283271
272+
// Using a primary constructor.
284273
class const D<TypeVariable extends Bound>.named(int x, [int y = 0])
285274
extends A with M implements B, C;
286275
```
287276

288277
In the case where the header gets unwieldy it is possible to declare the
289-
primary constructor in the body of the class, which is also equivalent to
290-
the previous examples:
278+
primary constructor in the body of the class using the `primary` keyword:
291279

292280
```dart
281+
// Current syntax.
282+
class D<TypeVariable extends Bound> extends A with M implements B, C {
283+
final int x;
284+
final int y;
285+
const D.named(this.x, [this.y = 0]);
286+
}
287+
288+
// Using a primary constructor.
293289
class D<TypeVariable extends Bound> extends A with M implements B, C {
294290
primary const D.named(int x, [int y = 0]);
295291
}
@@ -303,6 +299,7 @@ same way as a primary constructor in the header of the declaration. For
303299
example:
304300

305301
```dart
302+
// Current syntax.
306303
class A {
307304
A(String _);
308305
}
@@ -337,6 +334,7 @@ class E extends A {
337334
}
338335
}
339336
337+
// Using a primary constructor.
340338
class E extends A {
341339
external int y;
342340
int z;

0 commit comments

Comments
 (0)