1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-05 09:20:04 +00:00
Commit Graph

1243 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen
a1783a9c34 String.fromCharCodes allows start and end after end of iterable.
The current `String.fromCharCodes` behavior, throwing if `start`
or `end` is larger than the length of the `charCodes` iterable,
is inconsistent with the argument being an `Iterable<int>`,
which the user is not expected to know the length of.

Most other operations that accepts or produces an `Iterable` and
restricts it to a range, will allow the range to exceed the length
of the iterable, acting like `.take(end).skip(start)`, just without
needing to create wrappers that hide the original value.

(`List.setRange` is another exception, and should probably be fixed
by allowing the range to be partially filled, since it's too hard
to change it to require a `List` argument.)

Fixes #50253, #53937

Tested: Added to `corelib/string_fromcharcodes_test.dart`
Bug: https://dartbug.com/53937, https://dartbug.com/50253, https://dartbug.com/23282
Change-Id: Ie19c5fa8e715ea1c58c9c77c247f2a563654c1aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333921
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-11-17 13:34:22 +00:00
Parker Lougheed
4830c96420 [linter] Add changelog entries for removed unrelated type lints
Change-Id: Ia55b403ef35e6ee252d36c9a86f797e0e39de1f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335540
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-11-10 19:06:42 +00:00
Nicholas Shahan
406e92dba6 [ddc] Remove implements text from custom formatter
Change-Id: I814dfc5b80ae3d59ad3ad53d22c4d40866c6d926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334004
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-11-07 00:38:34 +00:00
Nicholas Shahan
c50fcf8828 [ddc] Show "any" for type args of package js types
Ensures that `toString()` of types that contain embedded js types 
will appear the same in the old and new runtime type systems.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I71ec0e13943281e745bcf05e10aa36d093cbc0c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334003
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-11-06 22:13:17 +00:00
Daco Harkes
acad65713c [vm] Mark NativeFieldWrapperClasses as base
TEST=build SDK (modified patch files)
TEST=tests/ffi/*
TEST=runtime/vm/*_test.cc
TEST=runtime/tests/vm/dart/*

Closes: https://github.com/dart-lang/sdk/issues/51896
CoreLibraryReviewExempt: VM only.
Change-Id: I349849001adf8f3a62f3d4f94d4bdd295c36ef4d
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,vm-aot-linux-debug-x64c-try,vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291761
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-10-31 10:23:12 +00:00
Kevin Chisholm
844fe6d955 [docs] Merge stable changes into main changelog
Change-Id: Ibd756739a08fd7e44b32ec7f5d8eccf29c666895
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332182
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-10-25 12:22:12 +00:00
Stephen Adams
0a436b7005 Reapply "[typed_data] Deprecate UnmodifiableUint8ListView and friends"
This reverts commit 4918d3ef8c.

`@Deprecated` annotations have been commented out.

CoreLibraryReviewExempt: reviewed as https://dart-review.googlesource.com/c/sdk/+/321922
TEST=ci
Bug: #53785
Change-Id: I3239251c2aba5f188aa947f0ff0208271d6be5cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331741
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-10-23 18:14:33 +00:00
Derek Xu
4918d3ef8c Revert "[typed_data] Deprecate UnmodifiableUint8ListView and friends"
This reverts commit b657773d58.

Reason for revert: blocking Dart SDK -> Engine roll (https://github.com/flutter/flutter/issues/137054)

Original change's description:
> [typed_data] Deprecate UnmodifiableUint8ListView and friends
>
> This is the first of several steps to remove the unmodifiable views for typed data classes. The end goal is that dart2js has only one class implementing `Uint8List` so that `Uint8List` accesses can always be compiled down to JavaScript code that directly uses indexed property accesses (`a[i]`).
>
> This first step deprecates the unmodifiable view classes to help prevent their use in new code, and adds `asUnmodifiableView()` methods as a replacement for the small number of places that use the classes.
>
> The next steps (see #53785) are to remove uses of the unmodifiable view classes from the SDK. Once this is complete the classes themselves can be removed.
>
> TEST=ci
>
> Issue: #53218
> Issue: #53785
>
> Change-Id: I04d4feb0d9f1619e6eee65236e559f5e6adf2661
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321922
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ömer Ağacan <omersa@google.com>

Issue: #53218
Issue: #53785
Change-Id: I0bb042269f9ff8e5cd69619cf97b60c79ea98cbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331680
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-10-23 15:03:25 +00:00
Stephen Adams
b657773d58 [typed_data] Deprecate UnmodifiableUint8ListView and friends
This is the first of several steps to remove the unmodifiable views for typed data classes. The end goal is that dart2js has only one class implementing `Uint8List` so that `Uint8List` accesses can always be compiled down to JavaScript code that directly uses indexed property accesses (`a[i]`).

This first step deprecates the unmodifiable view classes to help prevent their use in new code, and adds `asUnmodifiableView()` methods as a replacement for the small number of places that use the classes.

The next steps (see #53785) are to remove uses of the unmodifiable view classes from the SDK. Once this is complete the classes themselves can be removed.

TEST=ci

Issue: #53218
Issue: #53785

Change-Id: I04d4feb0d9f1619e6eee65236e559f5e6adf2661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321922
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-10-20 17:14:48 +00:00
Parker Lougheed
8225ddeae6 [dartdev] Use package:lints v3 in dart create templates
Change-Id: Ia282ec3c0eca1a5ef8c3405238d0fce422962d8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330997
Reviewed-by: Devon Carew <devoncarew@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-10-19 14:41:50 +00:00
Parker Lougheed
83af1aa405 Include links to DevTools release notes in changelog
Closes https://github.com/dart-lang/sdk/issues/53230

Change-Id: If4147575e6ef2262c3b24c0dcdf0342aa9a09484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325140
Reviewed-by: Marya Belanger <mbelanger@google.com>
Commit-Queue: Marya Belanger <mbelanger@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2023-10-18 23:00:17 +00:00
Parker Lougheed
5ce1da0df3 [dartdev] Mention new cli template for dart create in changelog
Bug: https://github.com/dart-lang/sdk/issues/53126
Change-Id: I510bac89a10f30370f52c78869f7b9bf2d7c66c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329861
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-10-11 14:52:34 +00:00
Parker Lougheed
41808b7735 [changelog] Clarify JS compiler header text in 3.2 changelog entries
The dart2js and DDC names are no longer exposed to most users, and either behind `dart compile js`, `webdev`, or the `flutter` tool.

To make it easier for users to identify changes relevant to them, adjust their changelog sections by using "development" or "production" in their names.

Change-Id: I4fb2f12a26d6bf91f48c1958fcab9b0c3fbca26b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329862
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Marya Belanger <mbelanger@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
2023-10-10 18:04:45 +00:00
Parker Lougheed
47474c695e [linter] Add 3.2 linter changes to changelogs
Change-Id: Ib918b6bb1ebb527933672c5a598aacb4b3835769
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-10 04:13:12 +00:00
Vyacheslav Egorov
f8086ed78c [vm] Enable waitFor for 3.2 release
We are going to enable waitFor in 3.2 release
and disable it in 3.3.

This makes migration smoother for users that need
to use Isolate.resolvePackageUriSync which is
only added in 3.2.

The actual removal timeline remains the same:
we will remove waitFor in 3.4.

TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/52121
Change-Id: I1ab7d07f874b3d914f070f1c358fcffaa96da28b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329420
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-10-05 13:24:34 +00:00
Liam Appelbe
82ff34d775 [ffi] Make nativeFunction throw if already closed
This is a *breaking change*. See
https://github.com/dart-lang/sdk/issues/53311

Make nativeFunction throw a StateError if the NativeCallable is already
closed. Also make close and keepIsolateAlive not throw.

I'm not adding an isClosed getter, as discussed on the bug.

Bug: https://github.com/dart-lang/sdk/issues/53311
Fixes: https://github.com/dart-lang/sdk/issues/53311
Change-Id: Ib0066352d3cfc01d31df8ae8fd61be426fcdf6e1
CoreLibraryReviewExempt: The FFI package is VM-only
TEST=async_void_function_callbacks_test and isolate_local_function_callbacks_test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328280
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-09-27 22:18:47 +00:00
Srujan Gaddam
74c407da2f [dart:js_interop] Add/fix some js_interop helpers
Minus all the operator-related functionalities, members that
can be worked around using static interop e.g. getPrototypeOf,
and createDartExport/createStaticInteropMock, this bridges the
gap of js_util.

Adds:
- instanceOfString from js_util as an extension methods
- JSObject constructor to replace js_util.newObject
- Unnamed factory constructor to JSAny so users can't extend it

Fixes:
- JSArray.withLength to take an int
- typeofEquals to take a String and return a bool
- instanceof to return a bool

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I7db1651f641a4fc84392957dfa7ad64904f110e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326691
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-23 18:32:59 +00:00
Srujan Gaddam
e130bb36ce [dart:js_interop] Make isUndefined and isNull throw on dart2wasm
null and undefined cannot be distinguished on dart2wasm in its
current state, so these helpers should only work on the JS
compilers. Some comments are updated to reflect the current state
of this internalization. Also fixes a pending TODO in isNull and
isUndefined on the JS backends.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: Ic56e8aa346af99cb99d01fe3c7ac5e37e965db23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326690
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-09-23 01:46:50 +00:00
Srujan Gaddam
76193718d2 Reland "[dart:js_interop] Re-enable type checks on external APIs"
This is a reland of commit 2a669c571f.

External APIs when using dart:js_interop should only allow
primitives, JS types, and other static interop types. This
was previously checked in a more restrictive mode called
"strict mode" but is not checked everywhere where dart:js_interop
APIs exist.

Change-Id: I1a8d04071a519c4965b266eb2800bcc3c3bb8393
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325961
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-18 19:53:40 +00:00
Kevin Chisholm
a744a03491 Update CHANGELOG.md to add release date to 3.1.0 release.
Change-Id: I17720269d12431e2ba705ee709414d77a6621d6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326660
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
2023-09-18 14:14:09 +00:00
Kevin Chisholm
07c5092444 [docs][release] Merge stable Changelog to main and update broken links.
Change-Id: Iba25e89e98332ccd8b0f4e18213cebc39bbe7f0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326141
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
2023-09-14 17:56:08 +00:00
Vyacheslav Egorov
9900af07d4 Add CHANGELOG.md for waitFor
R=kustermann@google.com

Change-Id: I64d09f62790790bc1f35a565a5ecf6ebbc109377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326061
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-09-14 10:58:14 +00:00
Paul Berry
7c38351cbb Improve explanation of noSuchMethod / field promotion interaction in CHANGELOG.
Fixes #53510.

Bug: https://github.com/dart-lang/sdk/issues/53510
Change-Id: I25b9bb4c59a4c438c7d4f48cf955e388c22378f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325740
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-09-13 17:56:25 +00:00
Robert Nystrom
b35c645302 Roll the latest dart_style into the SDK.
There are a couple of small format changes, but they are minimal
enough that we might not need to land a pre-built SDK with this.

Change-Id: I1d258c8a782e5db24c2048f407a8b7cf7b948eef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325580
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-09-13 01:44:57 +00:00
Liam Appelbe
d5555377ed Add changelog entry for NativeCallable
Bug: https://github.com/dart-lang/sdk/issues/53322
Change-Id: I458ea1a920f68e3de23008649748a24602bb5e0e
Fixes: https://github.com/dart-lang/sdk/issues/53322
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324180
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Auto-Submit: Liam Appelbe <liama@google.com>
2023-09-11 22:25:06 +00:00
Brian Quinlan
8a91749e42 Fix parsing of folded header field values.
Bug: https://github.com/dart-lang/sdk/issues/53227
Bug: https://github.com/dart-lang/sdk/issues/53185
Change-Id: Ibbdbdf9c8f2875e8f687244982810fffee20e69c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320920
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-09-11 21:13:58 +00:00
Jackson Gardner
db214e8c81 Revert "[dart:js_interop] Re-enable type checks on external APIs"
This reverts commit 2a669c571f.

Reason for revert: Failing dart -> Flutter Engine roller. We need to make some changes on the engine side to prepare for re-enabling these checks.

Original change's description:
> [dart:js_interop] Re-enable type checks on external APIs
>
> External APIs when using dart:js_interop should only allow
> primitives, JS types, and other static interop types. This
> was previously checked in a more restrictive mode called
> "strict mode" but is not checked everywhere where dart:js_interop
> APIs exist.
>
> Change-Id: Ic82a3ec0bf6062c25d7f8933e503820a21bc191f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316867
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: I54caf06976e215b2b576cedfc0013ee79c6682f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324902
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-09-11 19:31:20 +00:00
Srujan Gaddam
2a669c571f [dart:js_interop] Re-enable type checks on external APIs
External APIs when using dart:js_interop should only allow
primitives, JS types, and other static interop types. This
was previously checked in a more restrictive mode called
"strict mode" but is not checked everywhere where dart:js_interop
APIs exist.

Change-Id: Ic82a3ec0bf6062c25d7f8933e503820a21bc191f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316867
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-05 16:05:08 +00:00
Sigurd Meldgaard
22c467636f Bump pub to be6868ba132c782d9835b1638a634ecb73428579
Changes:
```
> git log --format="%C(auto) %h %s" 42819a1..be6868b
 https://dart.googlesource.com/pub.git/+/be6868ba Improve precompilation (4005)
 https://dart.googlesource.com/pub.git/+/1ff7ed9f `upgrade --tighten` (3957)
 https://dart.googlesource.com/pub.git/+/a2ff15af Bump actions/checkout from 3.5.3 to 3.6.0 (4007)
 https://dart.googlesource.com/pub.git/+/9c041f97 Revert "Validate pubspec names after resolution, instead of when parsing (3956)" (4006)
 https://dart.googlesource.com/pub.git/+/62981e8c Switch vendor to a dev dependency (3997)
 https://dart.googlesource.com/pub.git/+/edcd5c2a Don't display detailed errors from credentials file (4004)
 https://dart.googlesource.com/pub.git/+/bddb0b8a Fix test expectation (4000)
 https://dart.googlesource.com/pub.git/+/c5541b33 Fix spelling errors (3999)
 https://dart.googlesource.com/pub.git/+/ee3f0ff7 Log missing compilation output (3992)
 https://dart.googlesource.com/pub.git/+/57e5d581 Remove remaining remnants of old packages folder and .packages file (3989)
 https://dart.googlesource.com/pub.git/+/edc76a1c Cleanup meta annotation usage (3990)
 https://dart.googlesource.com/pub.git/+/d619b373 Replace Pair usage with records (3988)
 https://dart.googlesource.com/pub.git/+/923cb7bd Enable lints to use new language features (3987)
 https://dart.googlesource.com/pub.git/+/78a39b05 Fix some type related lints (3986)
 https://dart.googlesource.com/pub.git/+/f41c6c80 Update Dart spec reserved words (3984)
 https://dart.googlesource.com/pub.git/+/6c267643 Fix and increase flexibility of language version override test (3985)
 https://dart.googlesource.com/pub.git/+/037138e6 Validate pubspec names after resolution, instead of when parsing (3956)
 https://dart.googlesource.com/pub.git/+/4d4ff446 Show dependency type changes in report (3954)
 https://dart.googlesource.com/pub.git/+/996fdcfd `pub add` Rely on git sources validation of --git-url (3951)
 https://dart.googlesource.com/pub.git/+/d7647400 Update tar (3976)
 https://dart.googlesource.com/pub.git/+/98565c3e Bump actions/checkout from 3.5.2 to 3.5.3 (3960)
 https://dart.googlesource.com/pub.git/+/f323772e Summary for `pub get`, don't show unchanged in `pub upgrade` (3952)

```

Diff: https://dart.googlesource.com/pub.git/+/42819a1e10f803eb7f6296692c5a976e1c647360..be6868ba132c782d9835b1638a634ecb73428579/
Change-Id: I4b4f42790bb50ad4b17bdf2ac195494a241a63f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324101
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2023-09-04 14:56:52 +00:00
Paul Berry
0428501a59 Add a CHANGELOG entry for private field promotion.
Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: Iab3ab8fc3656941e7df91681b14a7d4e2355fb3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323502
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-08-30 20:57:25 +00:00
Parker Lougheed
9e761d5a10 [linter] Account for new lints in 3.1.0 release
Bug: https://github.com/dart-lang/linter/pull/4678#issuecomment-1685125753
Change-Id: I8fe1bcea8cc0db26b1375cb95ebe6ec51b6b63ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322380
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-08-23 20:36:05 +00:00
Parker Lougheed
b199896be5 Mark packageConfigSync and resolvePackageUriSync as released in 3.2
Closes https://github.com/dart-lang/sdk/issues/53285

Bug: https://github.com/dart-lang/sdk/issues/53285
CoreLibraryReviewExempt: dart:isolate is only supported on the VM and this CL only changes a Since annotation.
Change-Id: If525aed83d3ccd69558f348e6a4a287a35b1d2ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322040
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-08-22 08:05:19 +00:00
Srujan Gaddam
a38fb595cf [dart:js_interop] Add JS types for Symbol/BigInt
Adds JSSymbol and JSBigInt and erases to either their respective
interceptor types in the JS backends or JSValue in dart2wasm.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: Ib2c70d22a70c6308733cd170b91eafa8ec3b3aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321749
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-08-21 21:54:15 +00:00
Srujan Gaddam
c738fe1d7b [ddc] Add BigInt and Symbol interceptors
Adds the same interceptors from dart2js as JsPeerInterfaces
and handles typeof differences in getReifiedType. These must
be JsPeerInterfaces so that Object members can be stored in
their prototype. Tests are added so that dart2js and ddc are
consistent.

Change-Id: Iadc3dd26957c0a21b4039c49c1c1ff162ae286e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321748
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-21 21:54:15 +00:00
Nicholas Shahan
7b6d9fb46e [ddc] Cleanup temporary fix in strSafe
Fix allowed it to accept null but it should never be called with a
nullable value.

Change-Id: I03b5d9b4906e9e4557a4f2720350c0c8176fec53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320841
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Nicholas Shahan <nshahan@google.com>
2023-08-21 17:42:33 +00:00
Parker Lougheed
70310b06d0 [changelog] Move utf8 return type change to 3.2
The change (81df36216f) landed after the cut off and isn't in 3.1: https://api.dart.dev/stable/3.1.0/dart-convert/Utf8Codec-class.html#:~:text=inherited-,encode,-(String%20input

Change-Id: I4394c546e07727bfd54e2f397b755b7460833985
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321260
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-08-21 07:38:02 +00:00
Parker Lougheed
7289baece5 [changelog] Fix link definition in http trailing whitespace breaking change
Change-Id: I5943176c7142ba09b3ce5463f6fc410015c2c0a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321240
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-08-17 19:03:08 +00:00
Lasse R.H. Nielsen
4a38cb09f5 Fix behavior of Stream.empty.
The underlying subscription would invoke the `onDone` handler even
after a `cancel`.
It also forgot to register the `onDone` callback in the zone before
running it.

Tweaked the behavior of `pause` and `resume` to make sure they make
no difference after `cancel` or after a done event has been omitted.
(Test now checks that the behavior matches other streams.)

Fixes #53201

Bug: https://dartbug.com/53201
Change-Id: Iba35be2c4b44b5c4ec97d5a4dbcd3aff7fee8b75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320561
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-17 15:26:59 +00:00
Derek Xu
f6bc011b37 [dart:developer] Improve documentation of Service.getIsolateId and Service.getObjectId
This CL addresses https://dart-review.googlesource.com/c/sdk/+/317220/comment/7e05218f_882e21cd/

CoreLibraryReviewExempt: This CL does not change any APIs, it just adds
an @Since annotation to a method.
Change-Id: I4187c50498668553806bb2eee6584114363b417a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320900
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-08-16 15:13:47 +00:00
Srujan Gaddam
ad62f6033b [dart:js_interop] Relabel globalJSObject as globalContext and point to object used in static interop lowerings
This is likely more useful than returning globalThis always. It
allows users to workaround issues with lowerings without having
to worry about browser compatibility differences.

CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I01479211fe6b573c845de5b134d36338c40fc10d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319301
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-08-15 20:57:17 +00:00
Srujan Gaddam
66b511fa6c [dart:js_interop] Use compiler-dependent global context
Fixes https://github.com/dart-lang/sdk/issues/52955

Instead of globalThis, dart2js and DDC will now use the same global
context that they did for non-static interop. dart2wasm will
continue to use globalThis.

Change-Id: Iec899fc73ed35c50cd688d9b45b980e94f101c0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318520
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-08-15 20:57:17 +00:00
Brian Quinlan
ce0d051c9c Remove trailing whitespace from header values.
Bug: https://github.com/dart-lang/sdk/issues/53005
Bug: https://github.com/dart-lang/sdk/issues/51532
Change-Id: I8a2fc04f48d50103819d655ccd300e73d59fbecc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319903
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-08-15 16:58:12 +00:00
Parker Lougheed
9ac6332c67 [release] Minor fixes and cleanup to recent changelog entries
- Updates a few broken links
- Fixes a few spelling mistakes
- Standardizes formatting in recent entries
- Provides a few more details where helpful

Change-Id: I8d5376dfe2dec11b53cb38081f0e268c3cee51ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320140
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-08-15 01:03:19 +00:00
Paul Berry
907e705307 Flow analysis: use a more precise split point for refutable patterns.
Previously, the flow control logic for patterns didn't use the
`FlowModel.split` or `FlowModel.unsplit` methods at all. This meant
that if a control flow join point occurred in pattern logic, flow
analysis would consider the split point to be whatever split point was
established by the enclosing expression or statement. In the case of
an if-case statement, it would consider the split point to be at the
beginning of the scrutinee expression.

Split points are used by flow analysis for the sole purpose of
ensuring that joins propagate type promotions the same way in dead
code as they do in live code (so that users introducing temporary
`throw` expressions or `return` statements into their code do not have
to deal with nuisance compile errors in the (now dead) code that
follows. The consequence of flow analysis considering the split point
to be at the beginning of the scrutinee expression is that if the
scrutinee expression is proven to always throw, then joins that arise
from the pattern or guard may not behave consistently with how they
would have behaved otherwise. For example:

    int getInt(Object o) => ...;
    void consumeInt(int i) { ... }
    test(int? i) {
      if (
          // (1)
          getInt('foo')
          case
              // (2)
              int()
          // (3)
          when i == null) {
      } else {
        // (4)
        consumeInt(i);
      }
    }

In the above code, there is a join point at (4), joining control flows
from (a) the situation where the pattern `int()` failed to match, and
(b) the situation where `i == null` evaluated to `false` (and hence
`i` is promoted to non-nullable `int`). Since the return type of
`getInt` is `int`, it's impossible for the pattern `int()` to fail, so
at the join point, control flow path (a) is considered
unreacable. Therefore the promotion from control flow path (b) is
kept, and so the call to `consumeInt` is valid.

In order to decide whether to preserve promotions from one of the
control flow paths leading up to a join, flow analysis only considers
reachability relative to the corresponding split point. Prior to this
change, the split point in question occurred at (1), so if the
expression `getInt('foo')` had been replaced with `getInt(throw
UnimplementedError())`, flow analysis would have considered both
control flow paths (a) and (b) to be unreachable relative to the split
point, so it would not have preserved the promotion from (b), and
there would have been a compile time error in the (now dead) call to
`consumeInt`.

This change moves the split point from (1) to (2), so that changing
`getInt('foo')` to `getInt(throw UnimplementedError())` no longer
causes any change in type promotion behavior.

The implementation of this change is to add calls to `FlowModel.split`
and `FlowModel.unsplit` around all top-level patterns. At first glance
this might appear to affect the behavior of all patterns, but actually
the only user-visible effect is on patterns in if-case statements,
because:

- In switch statements and switch expressions, there is already a
  split point before each case.

- In irrefutable patterns, there is no user-visible effect, because
  irrefutable patterns cannot fail to match, and therefore don't do
  any control flow joins.

This change allows the split points for patterns to be determined by a
simple syntactic rule, which will facilitate some refactoring of split
points that I am currently working on.

Change-Id: I55573ba5c28b2f2e6bba8731f9e3b02613b6beb2
Bug: https://github.com/dart-lang/sdk/issues/53167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-08-11 17:09:49 +00:00
Parker Lougheed
0360930dbc [changelog] Add optional named parameter separator breaking change
Fixes https://github.com/dart-lang/sdk/issues/52491

Bug: https://github.com/dart-lang/sdk/issues/52491
Change-Id: Ief94acb7a3ba75ea555718e017e39ce2c418b41e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320020
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-08-11 14:49:32 +00:00
Parker Lougheed
80fb7b3f9d [release] Update changelog with stable patch notes
Change-Id: I5bbf530c55be59c0a7b23d5d035d266d19eecd5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320040
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
2023-08-11 14:43:13 +00:00
Srujan Gaddam
86eb49ac19 [dart:js_interop] Disallow user @staticInterop classes from subtyping most dart:_js_types types
Since user @staticInterop types are erased to JavaScriptObject, they
should only be able to subtype other types that are :> JavaScriptObject,
which are just JSObject and JSAny. Eventually all the other JS types
will move to extension types and we can remove this check.

Change-Id: If56b6770e141238b583937880ca87496780c8fac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316865
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-08-08 19:17:25 +00:00
Robert Nystrom
d6b9e42f2e Update CHANGELOG to clarify there are no language changes.
Change-Id: I4a722ab4b78ffcc751d04e0b06ba879093ee6b02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318749
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-08-07 23:33:45 +00:00
Parker Lougheed
99745598cd Update old linter site links to dart.dev
Bug: https://github.com/dart-lang/linter/issues/4460 and https://github.com/dart-lang/site-www/issues/4499
Change-Id: Ieb90512aac4e476b922765c6ee191085a2ad2c9b
CoreLibraryReviewExempt: Only updates a link in documentation comments.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311880
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-04 19:45:23 +00:00
Srujan Gaddam
7d6414a6d5 [dart:js_interop] Restrict external members from using type parameters that don't extend static interop types
Since external APIs can only use primitives and JS types in static interop,
we should require that all type parameters on static interop APIs extend
another static interop type. This is the minimum required to ensure all
type parameters can be erased to JSValue. This only affects dart:js_interop
users and replaces the previous type parameter static error check.

Change-Id: Ia546874da73c808aa25deb8d54d581db783987df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316140
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-07-31 17:40:56 +00:00