This reverts commit af4330d382, relands original e35120cfd14ed09302596e9fa20d8e845e8e2668(in patchset 1) with fixes for the tests(in subsequent patchsets).
Change-Id: I025022d242a75ad94b3616ff78aef28b7b5f372b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180603
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This converts `return e` in async methods in opt-in libraries into
return let v = e in v is Future<FTV> ? await v ; v
where FTV is the future value type of the enclosing function.
Closes#44395Closes#44396Closes#44397Closes#44399
TEST=existing tests
Change-Id: I59687039bfe4a97ffdaa55ac0f193ca4fb208f44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175310
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
The analyzer and CFE now report a warning on calls to
`Pointer<T extends NativeType>.elementAt()` and
`sizeOf<T extends NativeType>()` where `T` is a generic.
Adapted from https://dart-review.googlesource.com/c/sdk/+/178200 to
only deprecate but not error out on generic calls.
Does not roll forward `package:ffi` to a version with the `Allocator`
but keeps the generic `sizeOf` invocation. This causes extra warnings
in the pkg/front_end testcases.
Issue: https://github.com/dart-lang/sdk/issues/38721
TEST=tests/ffi/data_test.dart
TEST=tests/ffi/sizeof_test.dart
TEST=tests/ffi/structs_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart
Change-Id: I8f41c4dc04fc44e7e6c540ba87a3f41604130fe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180560
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Dart2js allows to declare JS-interp members, even if the enclosing library
doesn't have a JS annotation. This relaxes DDC to do the same.
Change-Id: I733d1cbb308692d89b8cd443cbde0ed30637e48e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177780
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This CL changes the semantics of `Pointer<T extends Struct>.ref` to use
the compile-time `T` rather than the runtime `T`.
This enables tree shaking of subtypes of Struct and optimizing `.ref`.
Issue: https://github.com/dart-lang/sdk/issues/38721
TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi/*struct*test_.dart
Change-Id: I3f5b08c08ec0799ef8aab3c4177e2ac70d25501c
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177862
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Recent changes to support native tests in DDC broke 2 tests only in chrome.
These broke because exporting the constructor changed the intent of these tests
in the first place.
This wasn't detected in d8 because we are using a mix of `self` and `window`,
and only in the browser they mapped to the same object.
Change-Id: I795b59ae2c0f34fdd7fc1730fbc3097dae2fee75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179660
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
I will soon be adding functionality to keep track of users' attempts
to promote things that aren't promotable (`this` as well as property
gets), so that we can give the user more useful error messages.
There's some some danger that adding this tracking logic will
accidentally cause side effects on reachability analysis. These tests
should help guard against unintentional behavioral changes.
Change-Id: I8dca901f2702ab7d309c6e12532aabfecd96a8ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178880
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
I will soon be adding functionality to keep track of users' attempts
to promote things that aren't promotable (`this` as well as property
gets), so that we can give the user more useful error messages.
There's some some danger that adding this tracking logic will
accidentally cause such expressions to be promoted. These tests
should help guard against unintentional behavioral changes.
Change-Id: I00d6c964c660602a3589a3efcf0042a11eaea5db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178882
Reviewed-by: Bob Nystrom <rnystrom@google.com>
The `url` argument is changing from `Object`, accepting either `String`
or `Uri` at runtime, to `Uri` for better static help.
https://github.com/dart-lang/http/pull/507
- Switch to using `Uri` for requests. Where sensible push this type into
the signature of the surrounding method.
- Make some updated method private where they were unnecessarily public
which makes it harder to have confidence when looking for usages.
Rename a method with an unnecessary `get` name.
Change-Id: Ibf075741d6b9d292349b15f1dc84004981729aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179368
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Most files are changed in two ways:
* add `self.` so that the code can run with "use strict" (which ddc
does by default when generating code)
* call the js-helper that installs the interceptor/type-extensions in
DDC on each test.
This was mostly done mechanically and gets about 50% of the tests under
dart2js/native running and passing in dartdevc. There are, however,
many tests here that are dart2js-specific or for features we don't want
to prioritize at this time (like custom elements), so after this the
next step should probably be to reoarganize the tests and split them in
general native support vs dart2js-specific.
Change-Id: I37759d854f9f51c185789471454d37b6bc78af90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177821
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This consists of a few combined changes:
* support `@Native` on tests: This entails calling registerExtensions
on user code, but only when running on native tests (which are explicitly
added to an allow list).
* support for invoking external top-level methods also on native tests.
* support for running `applyExtension` later in tests. This is because
tests introduce the JavaScript definitions after the calls to
registerExtensions happen. Note: this wouldn't be necessary if we one
day change how tests are loaded (e.g. if we can load the JavaScript
portion of the test before the module compiled by dartdevc is loaded).
That would entail more infrastructure work and given that this is only
used for ~200 tests, it doesn't seem worthwhile at this time.
* ensure extension symbols are also stored in `dartx.*` from a native
test. This is to ensure dynamic calls are fully supported.
* changes to the dart2js runtime to ensure the test code can run in both
dartdevc and dart2js with the same API.
* one updated test: all native tests need to be updated and I'll follow
up with those, but the changes on this test are included in this CL to
illustrate how this all fits together.
After this change (and parent changes), you can now run:
./tools/test.py -m release -c dartdevk -r d8 dart2js/native/native_checked_arguments1_frog_test
Change-Id: I4c2615a80b0e7611aa6f57abaa55b4e03b42bfe4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177180
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Bug: https://github.com/flutter/flutter/issues/73176
This reverts commit 825f56c6aa.
Both ddc and dart2js keep a set of native class names to make sure
@JS() classes don't conflict. Instead of processing native classes
for every component, this CL caches the set of native classes. This
should address the recompile time issues related to the original
revert.
Change-Id: If8028f0842440e8b9354bec9d7f72d0d42fcd8bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178926
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
commands
- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`
Remaining improvements:
- Add support for providing multiple comma separated values for `dart
run`, `dart`, and `dart2js`
Related issue: https://github.com/dart-lang/sdk/issues/44562
TEST=Updated CLI tests and added new dart2js tests.
Change-Id: I9379c7aee1eab377adb3438393d9ad79c4938cc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178262
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Introduces the Allocator API in `dart:ffi`.
This CL does not yet roll `package:ffi` to use `Allocator`, because that
breaks the checked in Dart in Fluter in g3. Instead, this coppies
`_MallocAllocator` from `package:ffi` into the ffi tests for testing.
This CL does not yet migrate off `allocate` and `free` in the SDK. That
is done in a dependent CL.
Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721
TEST=tests/ffi/allocator_test.dart
TEST=tests/ffi/calloc_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart
Change-Id: I173e213a750b8b3f594bb8d4fc72575f2b6b91f7
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177705
Reviewed-by: Clement Skau <cskau@google.com>
As per planned breaking change to let platforms decide how they and what throw for late initiaization errors,
we no longer need a public `LateInitializationError` class. It's confusing to have one if some platforms throw
something else instead.
Removes the public abstract class. The dart:_internal implementation class `LateError` no longer implements it.
This is the only implementation of the public interface, and the class which platforms either throw directly,
or through front-end lowering of the feature.
Remove mentions in tests. All tests now just expect `Error`, some platform specific tests might test the message.
TEST=rewrote tests referring to LateInitializationError.
Change-Id: I54344a67f89ce101ed770412db134e12354cdcc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174928
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>