Skip to content

Commit c38c85a

Browse files
author
Dart CI
committed
Version 3.4.0-190.1.beta
Merge 3.4.0-190.0.dev into beta
2 parents c1205bc + 728fcf0 commit c38c85a

File tree

3,769 files changed

+84667
-67950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,769 files changed

+84667
-67950
lines changed

.github/workflows/scorecards-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
# Upload the results as artifacts (optional).
4545
- name: "Upload artifact"
46-
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8
46+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
4747
with:
4848
name: SARIF file
4949
path: results.sarif

.github/workflows/third-party-deps-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: "extract deps, find commit hash, pass to osv-scanner"
3232
run: python .github/extract_deps.py --output osv-lockfile-${{github.sha}}.json
3333
- name: "upload osv-scanner deps"
34-
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8
34+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
3535
with:
3636
# use github.ref in name to avoid duplicated artifacts
3737
name: osv-lockfile-${{github.sha}}

BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ group("runtime") {
4242

4343
deps = [
4444
"runtime/bin:dart",
45-
"runtime/bin:entrypoints_verification_test",
4645
"runtime/bin:ffi_test_dynamic_library",
4746
"runtime/bin:ffi_test_functions",
4847
"runtime/bin:process_test",
@@ -52,6 +51,10 @@ group("runtime") {
5251
"utils/dartdev:dartdev",
5352
"utils/kernel-service:kernel-service",
5453
]
54+
if (!is_win) {
55+
# The test isn't run on windows
56+
deps += [ "runtime/bin:entrypoints_verification_test" ]
57+
}
5558

5659
# This flag is set in runtime/runtime_args.gni
5760
# The analyze_snapshot tool is only supported on 64 bit AOT builds running

CHANGELOG.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,26 @@
77
type), to align with the specification. This change is not expected
88
to make any difference in practice.
99

10+
- **Breaking Change** [#54828][]: The type schema used by the compiler front end
11+
to perform type inference on the operand of a null-aware spread operator
12+
(`...?`) in map and set literals has been made nullable, to match what
13+
currently happens in list literals. This makes the compiler front end behavior
14+
consistent with that of the analyzer. This change is expected to be very low
15+
impact.
16+
1017
[#54640]: https://github.com/dart-lang/sdk/issues/54640
18+
[#54828]: https://github.com/dart-lang/sdk/issues/54828
19+
20+
### Libraries
21+
22+
#### `dart:io`
23+
24+
- **Breaking change** [#53863][]: `Stdout` has a new field `lineTerminator`,
25+
which allows developers to control the line ending used by `stdout` and
26+
`stderr`. Classes that `implement Stdout` must define the `lineTerminator`
27+
field. The default semantics of `stdout` and `stderr` are not changed.
28+
29+
[#53863]: https://github.com/dart-lang/sdk/issues/53863
1130

1231
### Tools
1332

@@ -23,6 +42,18 @@
2342

2443
### Libraries
2544

45+
#### `dart:async`
46+
47+
- Added option for `ParallelWaitError` to get some meta-information that
48+
it can expose in its `toString`, and the `Iterable<Future>.wait` and
49+
`(Future,...,Future).wait` extension methods now provide that information.
50+
Should make a `ParallelWaitError` easier to log.
51+
52+
#### `dart:ffi`
53+
54+
- Added `Struct.create` and `Union.create` to create struct and union views
55+
of the sequence of bytes stored in a subtype of `TypedData`.
56+
2657
#### `dart:js_interop`
2758

2859
- On dart2wasm, `JSBoxedDartObject` now is an actual JS object that wraps the
@@ -34,10 +65,138 @@
3465

3566
[#54138]: https://github.com/dart-lang/sdk/issues/54138
3667

68+
#### `dart:typed_data`
69+
70+
- **BREAKING CHANGE** [#53218][] [#53785][]: The unmodifiable view classes for
71+
typed data are deprecated.
72+
73+
To create an unmodifiable view of a typed-data object, use the
74+
`asUnmodifiableView()` methods added in Dart 3.3:
75+
76+
```dart
77+
Uint8List data = ...;
78+
final readOnlyView = data.asUnmodifiableView();
79+
// readOnlyView has type Uint8List, and throws if attempted modified.
80+
```
81+
82+
The reason for this change is to allow more flexibility in the implementation
83+
of typed data, so the native and web platforms can use different strategies
84+
to ensure that typed data has good performance.
85+
86+
The deprecated types will be removed in Dart 3.5.
87+
88+
[#53218]: https://github.com/dart-lang/sdk/issues/53218
89+
[#53785]: https://github.com/dart-lang/sdk/issues/53785
90+
91+
### Dart Runtime
92+
- Dart VM flags and options can now be provided to any executable
93+
generated using `dart compile exe` via the `DART_VM_OPTIONS` environment
94+
variable. `DART_VM_OPTIONS` should be set to a list of comma-separated flags
95+
and options with no whitespace. Options that allow for multiple values to be
96+
provided as comma-separated values are not supported
97+
(e.g., `--timeline-streams=Dart,GC,Compiler`).
98+
99+
Example of a valid `DART_VM_OPTIONS` environment variable:
100+
101+
```bash
102+
DART_VM_OPTIONS=--random_seed=42,--verbose_gc
103+
```
104+
37105
## 3.3.0
38106

39107
### Language
40108

109+
Dart 3.3 adds [extension types] to the language. To use them, set your
110+
package's [SDK constraint][language version] lower bound to 3.3 or greater
111+
(`sdk: '^3.3.0'`).
112+
113+
#### Extension types
114+
115+
[extension types]: https://github.com/dart-lang/language/issues/2727
116+
117+
An _extension type_ wraps an existing type with a different, static-only
118+
interface. It works in a way which is in many ways similar to a class that
119+
contains a single final instance variable holding the wrapped object, but
120+
without the space and time overhead of an actual wrapper object.
121+
122+
Extension types are introduced by _extension type declarations_. Each
123+
such declaration declares a new named type (not just a new name for the
124+
same type). It declares a _representation variable_ whose type is the
125+
_representation type_. The effect of using an extension type is that the
126+
_representation_ (that is, the value of the representation variable) has
127+
the members declared by the extension type rather than the members declared
128+
by its "own" type (the representation type). Example:
129+
130+
```dart
131+
extension type Meters(int value) {
132+
String get label => '${value}m';
133+
Meters operator +(Meters other) => Meters(value + other.value);
134+
}
135+
136+
void main() {
137+
var m = Meters(42); // Has type `Meters`.
138+
var m2 = m + m; // OK, type `Meters`.
139+
// int i = m; // Compile-time error, wrong type.
140+
// m.isEven; // Compile-time error, no such member.
141+
assert(identical(m, m.value)); // Succeeds.
142+
}
143+
```
144+
145+
The declaration `Meters` is an extension type that has representation type
146+
`int`. It introduces an implicit constructor `Meters(int value);` and a
147+
getter `int get value`. `m` and `m.value` is the very same object, but `m`
148+
has type `Meters` and `m.value` has type `int`. The point is that `m`
149+
has the members of `Meters` and `m.value` has the members of `int`.
150+
151+
Extension types are entirely static, they do not exist at run time. If `o`
152+
is the value of an expression whose static type is an extension type `E`
153+
with representation type `R`, then `o` is just a normal object whose
154+
run-time type is a subtype of `R`, exactly like the value of an expression
155+
of type `R`. Also the run-time value of `E` is `R` (for example, `E == R`
156+
is true). In short: At run time, an extension type is erased to the
157+
corresponding representation type.
158+
159+
A method call on an expression of an extension type is resolved at
160+
compile-time, based on the static type of the receiver, similar to how
161+
extension method calls work. There is no virtual or dynamic dispatch. This,
162+
combined with no memory overhead, means that extension types are zero-cost
163+
wrappers around their representation value.
164+
165+
While there is thus no performance cost to using extension types, there is
166+
a safety cost. Since extension types are erased at compile time, run-time
167+
type tests on values that are statically typed as an extension type will
168+
check the type of the representation object instead, and if the type check
169+
looks like it tests for an extension type, like `is Meters`, it actually
170+
checks for the representation type, that is, it works exactly like `is int`
171+
at run time. Moreover, as mentioned above, if an extension type is used as
172+
a type argument to a generic class or function, the type variable will be
173+
bound to the representation type at run time. For example:
174+
175+
```dart
176+
void main() {
177+
var meters = Meters(3);
178+
179+
// At run time, `Meters` is just `int`.
180+
print(meters is int); // Prints "true".
181+
print(<Meters>[] is List<int>); // Prints "true".
182+
183+
// An explicit cast is allowed and succeeds as well:
184+
List<Meters> meterList = <int>[1, 2, 3] as List<Meters>;
185+
print(meterList[1].label); // Prints "2m".
186+
}
187+
```
188+
189+
Extension types are useful when you are willing to sacrifice some run-time
190+
encapsulation in order to avoid the overhead of wrapping values in
191+
instances of wrapper classes, but still want to provide a different
192+
interface than the wrapped object. An example of that is interop, where you
193+
may have data that are not Dart objects to begin with (for example, raw
194+
JavaScript objects when using JavaScript interop), and you may have large
195+
collections of objects where it's not efficient to allocate an extra object
196+
for each element.
197+
198+
#### Other changes
199+
41200
- **Breaking Change** [#54056][]: The rules for private field promotion have
42201
been changed so that an abstract getter is considered promotable if there are
43202
no conflicting declarations. There are no conflicting declarations if
@@ -97,6 +256,11 @@
97256
- In addition to functions, `@Native` can now be used on fields.
98257
- Allow taking the address of native functions and fields via
99258
`Native.addressOf`.
259+
- The `elementAt` pointer arithmetic extension methods on
260+
core `Pointer` types are now deprecated.
261+
Migrate to the new `-` and `+` operators instead.
262+
- The experimental and deprecated `@FfiNative` annotation has been removed.
263+
Usages should be updated to use the `@Native` annotation.
100264

101265
#### `dart:js_interop`
102266

@@ -380,6 +544,8 @@ constraint][language version] lower bound to 3.2 or greater (`sdk: '^3.2.0'`).
380544
error if is called after the `NativeCallable` has already been `close`d. Calls
381545
to `close` after the first are now ignored.
382546

547+
[#53311]: https://github.com/dart-lang/sdk/issues/53311
548+
383549
#### `dart:io`
384550

385551
- **Breaking change** [#53005][]: The headers returned by
@@ -1123,6 +1289,11 @@ constraint][language version] lower bound to 3.0 or greater (`sdk: '^3.0.0'`).
11231289
[`Counter`]: https://api.dart.dev/stable/2.18.2/dart-developer/Counter-class.html
11241290
[`Gauge`]: https://api.dart.dev/stable/2.18.2/dart-developer/Gauge-class.html
11251291

1292+
#### `dart:ffi`
1293+
1294+
- The experimental `@FfiNative` annotation is now deprecated.
1295+
Usages should be replaced with the new `@Native` annotation.
1296+
11261297
#### `dart:html`
11271298

11281299
- **Breaking change**: As previously announced, the deprecated `registerElement`

0 commit comments

Comments
 (0)