This reverts commit 49f85335d5.
Reason for revert: Fixes the original breakage by adding an explicit
cast for the map function that's used to compute positional args
of the stub. Adds refactoring to better separate out the logic
between procedure-level and invocation-level lowering configs.
Also refactors optional argument functions so that they can use the
invocation-level lowering configs created in this CL. Also fixes
a small issue where object literal constructors wouldn't work in
dart2js if the surrounding library didn't have a @JS annotation.
Original change's description:
> Revert "[dart:js_interop] Add literal constructors for inline classes"
>
> This reverts commit 1f6d4ae1a8.
>
> Reason for revert: Broke Flutter with dart2wasm
>
> Original change's description:
> > [dart:js_interop] Add literal constructors for inline classes
> >
> > Adds @ObjectLiteral annotation to denote object literal constructors,
> > and implements it in all the backends. For dart2js, this involves
> > modifying the SSA and for dart2wasm, we create a one-per-shape
> > forwarding procedure to a specialized JS method that returns the
> > literal. This also modifies @anonymous semantics in dart2wasm to
> > be consistent with the other backends.
> >
> > CoreLibraryReviewExempt: Backend-specific, just adding annotation.
> > Change-Id: I4d7a9ea9ed097f4f378709b40f8bd74f02e26b23
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283922
> > Commit-Queue: Srujan Gaddam <srujzs@google.com>
> > Reviewed-by: Joshua Litt <joshualitt@google.com>
>
> Change-Id: Ifce611e1150d8aa275f9e312743bded56a572176
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285342
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
CoreLibraryReviewExempt: Reland.
Change-Id: Iac52e9ff152dc06788d78b7b18549c7005921b74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285346
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This dill is a duplicate of the one emitted during closed world since the Kernel AST is not modified any more.
In case someone were to want to run the closed world and global inference phases together (e.g. `dart2js --write-data-uri=global.data main.dart`), keep the option to write the dill file with global inference results by allowing them to manually provide the `--out` flag.
Change-Id: Icac6a510ed74a6d095b54ba398897818f1a1efe6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289581
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
The Windows and MacOS file system can be case insensitive, so the following
two URIs can be equivalent:
- file:///c:/foo/bar
- file:///C:/Foo/Bar
Since it's possible for tooling to request a mapping for a URI that
isn't an exact case-sensitive match to that found in the URI mappings
cache, requesting a mapping for the inexact match will fail even though
the paths are potentially equivalent.
This change allows for lookupPackageUris and lookupResolvedPackageUris
to correctly handle paths that are not case-sensitive matches to entries
in the URI mappings cache on Windows and MacOS.
TEST=uri_mappings_lookup_test.dart
Change-Id: I35134c47bf3bd04bc452373b31b4eb5893ba1435
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288821
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
The documentation of IOSync states that calling flush on a closed IOSink may have no effect:
https://github.com/dart-lang/sdk/blob/main/sdk/lib/io/io_sink.dart#L109
The future returned by close in the new implementation does not complete until after
a call to flush has completed.
The previous implementation of File.open did not throw when calling flush after close.
CoreLibraryReviewExempt: IO only, restoring previous semantics
Bug: b/274405250
Change-Id: I56bbe02e886085cc8156e60264f5b77593c8a075
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289823
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
The usual approach:
Pure interfaces marked `interface`.
Pure implementation classes marked `final`.
Base classes marked `base` or nothing, and `mixin class` if reasonable.
Combined X/XBase/XMixin where possible.
CoreLibraryReviewExempt: Aske is away
Change-Id: I927f9bd488fb385ff9c17c8fc94920a1f5076347
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289200
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
The only exported type is `BytesBuilder`, which is a pure `interface`.
CoreLibraryReviewExempt: Aske is away
Change-Id: I1756e066689192ac4ea8485c3e1259d79473c583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289320
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
* Pure interfaces marked `interface`. That's most public classes.
* `Stream` made `mixin class`, as a proper skeleton/base implementation.
* `Zone` classes made all `final`.
Added some `<void>` to raw `Future` types.
CoreLibraryReviewExempt: Aske is away.
Tested: No functionality change, only added restrictions.
Change-Id: I91d09fbcdba7d0dfdff3887bc7c9d54364c88b05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289221
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This reverts commit 1755f89092.
Reason for revert: This is a breaking change and is blocking the Dart -> Flutter roll. See https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20Unopt/26896/overview.
Original change's description:
> [vm/ffi] Add class modifiers
>
> Adds class modifiers to `dart:ffi`.
>
> Migrates all user-defined subclasses of `Struct`, `Union`, `Opaque`,
> and `AbiSpecificInteger` to be `final class`es.
>
> Does not remove the manual error checking, so some errors will show up
> twice now in language version 3.0. In language version <3.0, only the
> FFI-specific error will show up.
>
> In a follow-up CL, we will try to make the language-errors to show up
> also <3.0 so that we can remove the FFI-specific errors.
>
> Examples of duplicated errors:
> pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
>
> TEST=pkg/analyzer/test/ (for the analyzer)
> TEST=pkg/front_end/testcases/ (for the CFE)
> TEST=test/ffi/ (for the VM)
>
> CoreLibraryReviewExempt: No need for dart2js to review.
> Bug: https://github.com/dart-lang/sdk/issues/51683
> Change-Id: I2964ceccb7db59fbdaf6be5319f5e4ec2dabe0f3
> Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289223
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Jackson Gardner <jacksongardner@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: Ie5b8a08aea6d64b1991ace4814322b21ffb670c7
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289640
Commit-Queue: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The runtime should only call this in non-product mode, we should be able
to tree shake it in product mode.
TEST=ci
Change-Id: Ic8628b1e239f123894efc5a79253b8d6a9b56a73
CoreLibraryReviewExempt: Doesn't change API
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289780
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Compiler can see an unreachable code like this:
v1 <- Constant(Record (C, C))
if v1 is (C, C, C) {
v2 <- LoadField (v1.$3)
}
So it should check that record type of the receiver has enough fields
before querying field type in LoadField.
TEST=co19/LanguageFeatures/Patterns/matching_record_*
Fixes https://github.com/dart-lang/sdk/issues/51767
Issue https://github.com/dart-lang/sdk/issues/49755
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: Iac42c8edf3d22dce0061b6d75e8bdf51b7bf88e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289540
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Switch statements on ints aren't required to be exhaustive.
Change-Id: I85701b098cacf9d01241dab821ae4c70f04a0710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289450
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
All calls on records are no longer treated as essentially dynamic calls. So a call to `record.foo` will not pull all `foo` members into the program (including unused ones). For example in the below test the getter `any` was causing `JSArray.any` to be included in the program. After this change it is no longer pulled in.
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Records/members_A04_t02.dart#L39
Change-Id: If1f9eac1abadeeed80dca917a8912129d090643e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287681
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This implements all the subtyping relationships for records as well as any other predicates needed for the abstract value domain.
In the next CL we make use of this new mask when constructing the types for record literals and when accessing fields of a record.
Change-Id: Ibf12b95e439e2c12be9e4db51f5023df379d48f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288101
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Updates imports in `tests/lib_2` from `tests/language` to use the
version in `tests/language_2` instead.
I think it is also a little awkward to import libraries across
tests suites period but that is an issue for another day.
Change-Id: Ib61bb1e1790926f92ee2650a6497916f2edce7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289407
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Although the true branch of `x != null` and the false branch of `x ==
null` promote `x` to non-nullable, the opposing branches do not promote
`x` to `Null` in the current flow analysis spec, which applies to the
CFE.
When switching from the dart2js static type computation to the CFE
static type computation, attempting to use `x` in these branches may
generate an unintended type check, which can overflow the stack if this
occurs in code responsible for performing type checks. The fix is fairly
straightforward - we can simply use an unchecked cast (via `JS`) instead.
See https://github.com/dart-lang/language/issues/1505 for discussion on
why the expected promotion does not (yet) occur.
Change-Id: Ia9cca4e1aa8e9c67b42c60189f0d3811afb61360
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289061
Reviewed-by: Stephen Adams <sra@google.com>
Adds class modifiers to `dart:ffi`.
Migrates all user-defined subclasses of `Struct`, `Union`, `Opaque`,
and `AbiSpecificInteger` to be `final class`es.
Does not remove the manual error checking, so some errors will show up
twice now in language version 3.0. In language version <3.0, only the
FFI-specific error will show up.
In a follow-up CL, we will try to make the language-errors to show up
also <3.0 so that we can remove the FFI-specific errors.
Examples of duplicated errors:
pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
TEST=pkg/analyzer/test/ (for the analyzer)
TEST=pkg/front_end/testcases/ (for the CFE)
TEST=test/ffi/ (for the VM)
CoreLibraryReviewExempt: No need for dart2js to review.
Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: I2964ceccb7db59fbdaf6be5319f5e4ec2dabe0f3
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289223
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Recent changes that made migration tool more conservative affected
functions used in Angular's DI: functions annotated with `@Injectable`
must have non-nullable non-annotated arguments. Previously that
worked just because there was no reason to make them nullable.
Make such functions' arguments explicitly non-nullable.
Bug: b/250862403
Change-Id: I27207994b058ba845aafd7776d14380e8104e8f8
Tested: added a test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289505
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
This changes the analyzer and CFE to use the real exhaustiveness
checking algorithm. The fallback algorithm is kept and will be
removed once we know that the real exhaustiveness algorithm sticks.
Change-Id: Ic9df92c1ca9f7dec4cbdfa138dc6ed39ef2d4df5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288703
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Update the dart2js and kernel worker steps themselves to run
with sound null safety. This is separate from the code being compiled
in the step which will be migrated in another change.
Change-Id: Idbaaeb255209e79bb34aa34aedeb020be097c1c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289408
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
http (805a147..74f9d3d):
74f9d3d 2023-03-09 Brian Quinlan Add conformances test that verify that the Client works in Isolates (#889)
ee03604 2023-03-09 Brian Quinlan Add a flag to allow the default Client to be tree shaken away. (#868)
2039fb3 2023-03-09 Brian Quinlan Fix a reference count race with forwarded delegates. (#888)
Change-Id: I56faf5cf41ad16f6a365db66265b02e66adbc59f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289502
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
This is less than half of them, will send some other chunks later.
Bug:51557
Change-Id: I4e80812a689fde99e23c34b6405aaf57cd431ce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289261
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
This uses the context type when creating the space for a cast pattern
to include the implicitly covered subtypes in the space. This is done
when the context type is a sealed type which means that we can reason
about which of the subtypes of the sealed type that are implicitly
handled by the throw of the cast.
Change-Id: I3a4f14bf6ca82f59a2c2a3c27bb472a8f38c1613
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289222
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>