Commit Graph

21307 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen bb5b0ff0ce Fix typed data views throwing.
Fixes #43204

BUG= http://dartbug.com/43204

Change-Id: I93ee6931900b79ac6755431c90d2b203ccf94ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181401
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-29 09:24:45 +00:00
Daco Harkes 7fbbe4fca3 [vm/ffi] Migrate off .addressOf in tests
Removes invocations of `.addressOf` in tests.

Removes the constructor from the Coordinate testing class which
has become useless with no access to the underlying pointer.

Removes the bare variant of Coordinate because it is identical to the
non-bare variant.

Issue: https://github.com/dart-lang/sdk/issues/40667

Change-Id: Ie26fa3a9cac38e794e93f5fadfec2562a814c1ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181403
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-28 21:40:15 +00:00
Lasse R.H. Nielsen 4a484c88e1 Make ListMixin.take check that the argument is not null.
Fixes #41743, #30155
BUG= http://dartbug.com/41743

Change-Id: I223905a92b7353cdc50498d265a6dfe2f2f614d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160640
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-28 17:19:35 +00:00
asiva 35b31654ed [VM / Tests] Fix tests to use '-verbosity=warning'
Fix tests to use '--verbosity=warning' so they don't produce
extraneous output.

Fixes https://github.com/dart-lang/sdk/issues/44738

TEST=Updating tests

Change-Id: I5a02dca2efabd392ba690a4b13aa0dc4ba25dedb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181360
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-01-27 19:06:39 +00:00
Alexander Aprelev 6b3abe0a98 [vm/concurrency] Add --experimental_enable_isolate_groups_jit flag, make --enable_isolate_groups AOT only.
Issue b/177800357.

TEST=existing test suite
Change-Id: Id6b113932ab7014b8fa6c105845c5c490b60f5e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181320
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-27 17:11:29 +00:00
Daco Harkes 8ad5b515cd [vm/ffi] Migrate off .addressOf struct by value tests
Instead, keep the pointers around in various places.

Issue: https://github.com/dart-lang/sdk/issues/40667

Change-Id: I0d661dc74fa4d9745baa03da059f2233eb0d08d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181382
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-27 15:13:34 +00:00
Daco Harkes bc5952d8e8 [analyzer/ffi] Stop non-const warnings on ..ref
Closes: https://github.com/dart-lang/sdk/issues/44782

TEST=pkg/analyzer/test/src/diagnostics/non_constant_type_argument_test.dart

Change-Id: I434b9e68fb07e37cad03b1418897ea2295f81fc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181204
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-01-26 23:12:00 +00:00
Alexander Aprelev eccff3bc4d [io/http] Fix http_parser_header_add_test so it doesn't depend on external web server.
This is follow-up to https://dart.googlesource.com/sdk/+/60bea3003de2ea030a1970924d5af7b4a53f3a72.

Issue: https://github.com/dart-lang/sdk/issues/44756

Change-Id: I3c76fe0d15e4aba26540a95c63ccba8480dc8315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180722
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-01-23 06:07:21 +00:00
Alexander Aprelev 60bea3003d Reland "[tests] rewrite and format several tests on http"
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>
2021-01-22 23:49:17 +00:00
Paul Berry d4fb6b320c Set BinaryExpression.staticInvokeType properly for extension overrides.
Fixes #43114.

Bug: https://github.com/dart-lang/sdk/issues/43114
Change-Id: Ib0adf67c5ac5189732960a5925d7cdbcff0c4102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180441
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-01-22 20:53:24 +00:00
Johnni Winther 14032a6209 [cfe] Handle conditional await in CFE
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 #44395
Closes #44396
Closes #44397
Closes #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>
2021-01-22 19:12:24 +00:00
Alexander Aprelev ee37fff58c [io/http] Have http parser reply with error if Content-Length and Transfer-Encoding are both specified on http request.
Issue b/150476984

Change-Id: Iafc7154c84682678e4d7e3d614b74942b0d259b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180485
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-01-22 18:32:43 +00:00
Daco Harkes d74b2f4672 [vm/ffi] Deprecate Pointer.elementAt and sizeOf generic calls
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>
2021-01-22 13:58:09 +00:00
Daco Harkes f74c9d43d3 [vm/ffi] Deprecate Pointer<T extends Struct>.ref generic calls
The analyzer and CFE now report a warning on calls to
`Pointer<T extends Struct>.ref` and `Pointer<T extends Struct>.[]`
where `T` is a generic.

Adapted from https://dart-review.googlesource.com/c/sdk/+/180190 to
only deprecate but not error out on generic calls to `.ref` and `[]`.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I81353089d59f093730d63792e9dbcd0b2ff0c432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180365
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Daco Harkes c3b30df798 [vm/ffi] Deprecate empty Structs
The analyzer and CFE now report a warning on subclasses of `Struct`
which have no native fields.

Adapted from https://dart-review.googlesource.com/c/sdk/+/180189 to
only deprecate, but not disallow empty structs.

Rolls `package:ffi` forward to migrate `Utf8` and `Utf16` to `Opaque`
to prevent tests from failing on those generating warnings for empty
structs.

Issue: https://github.com/dart-lang/sdk/issues/43974

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ia364e31da66cb195570c2e2b729d03dd261f28a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180361
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Lasse R.H. Nielsen 726904ac17 Add onError extension method to Future.
Provides better typing than `catchError`.

Change-Id: If0d4487b7c3a499160fb719740a1d65c0545024d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151512
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-21 23:13:56 +00:00
Erik Ernst c9e24eee9f Add test for upper bound with greatest closure
Change-Id: I59d20c1b4c874fb24a67f15296654d54a0d0dc1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179541
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-21 08:51:53 +00:00
Sigmund Cherem 0845ebaad8 [ddc] Do not require a @JS annotation at the library level.
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>
2021-01-20 22:11:23 +00:00
Daco Harkes 3cfcc5a8e5 Revert "[vm/ffi] Roll package:ffi to Allocator and Opaque"
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: I128e7b096faea650e0ba0850a411eed3e97c00e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180185
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00
Daco Harkes 1fe4597638 Revert "[vm/ffi] Disallow empty structs"
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: Ibe9e8200dbdafe0ee684a6a0ea19e06214edf5e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180184
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00
Daco Harkes 49ec189fb3 Revert "[vm/ffi] Change Pointer<T extends Struct>.ref to use s..."
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: I1bfe4d70a5f7f35039b8a01d599d33542872574c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180183
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00
Sam Rawlins cddd44e1e9 analyzer: Add separate code for concrete implementation override check
Erik wrote a great explanation for this check here:
https://github.com/dart-lang/sdk/issues/37993#issuecomment-757976910

Fixes https://github.com/dart-lang/sdk/issues/37993

Change-Id: I6fb0bd530fac495115314838ec0bb2168d5e9ad7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180088
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-20 21:27:43 +00:00
Stephen Adams 80fabc81fb [test] Test for late-variable mis-optimization
Change-Id: I3d155759063901474cb26115712ec14257242974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179401
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-01-20 21:13:23 +00:00
Daco Harkes 2e8f9b85a6 [vm/ffi] Change Pointer<T extends Struct>.ref to use static type
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>
2021-01-20 18:08:25 +00:00
Daco Harkes 1a71f94998 [vm/ffi] Disallow empty structs
Closes: https://github.com/dart-lang/sdk/issues/43974

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I6141c193b6ac71e0dce2735322c62ffd84554cef
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/+/177710
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-20 18:08:25 +00:00
Daco Harkes 7d648e3ae7 [vm/ffi] Roll package:ffi to Allocator and Opaque
This can only be landed when `Allocator` and `Opaque` have rolled into
Flutter/engine, that into Flutter/flutter, and that into g3.
flutter/flutter/commit/a706cd211240f27be3b61f06d70f958c7a4156fe

Deletes all the copies of `_CallocAllocator` and uses the one from
`package:ffi` instead.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974
Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I50b3b4c31a2b839b35e3e057bd54f463b90bc55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179540
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-20 18:08:25 +00:00
Johnni Winther 07a6f9511d Revert "Makes _propagateToListeners not recurse unboundedly."
This reverts commit 073f792b59.

Reason for revert: Some g3 test failures, needs more investigation to figure out how to land. b/177972603

TEST=revert

Original change's description:
> Makes `_propagateToListeners` not recurse unboundedly.
>
> Change-Id: I85818282276e8a5ab4a639e98c238c2a822cab9e
> TEST=Added regression test.
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179770
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

TBR=lrn@google.com,johnniwinther@google.com

Change-Id: If3b6a2ee5511a13fa2de19e70a3c52321007b1ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180142
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
2021-01-20 09:27:47 +00:00
Sigmund Cherem dbf73fa842 [web] fix regression on two native tests.
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>
2021-01-19 20:38:23 +00:00
Johnni Winther fabf3efda4 [cfe] Refactor ClassHierarchyBuilder to use Tuple for computation
Change-Id: I8055552313786814bde6f66214a013a8bedb2078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177500
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-01-19 19:52:13 +00:00
Lasse R.H. Nielsen 073f792b59 Makes _propagateToListeners not recurse unboundedly.
Change-Id: I85818282276e8a5ab4a639e98c238c2a822cab9e
TEST=Added regression test.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179770
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-19 16:47:32 +00:00
jonahwilliams d4d3e3698c [dart:io] ensure Process.start throws with a stack trace
Change-Id: I8b5d585b10752a873632b3a7b9447214e2d38954
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179640
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2021-01-16 01:36:02 +00:00
Paul Berry c053638eb5 Don't promote this inside extension methods.
This fix addresses legacy code.  The corresponding null safety fix has
already landed--see
https://dart-review.googlesource.com/c/sdk/+/178920.

Bug: https://github.com/dart-lang/sdk/issues/44652
Change-Id: I1d546f59e2ce91256e8da419670cb151a8b6efd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178922
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-15 20:22:52 +00:00
Paul Berry bd67e3453b Test that is/equality checks on nonpromotable expressions doesn't affect reachability.
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>
2021-01-15 16:43:06 +00:00
Paul Berry 62596baeda Test that is/equality checks cannot promote various nonpromotable expressions.
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>
2021-01-15 16:43:06 +00:00
Nate Bosch 58e7e7eb26 Prepare for breaking change in package:http
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>
2021-01-15 16:35:01 +00:00
Daco Harkes 3a0a33f35f [vm/ffi] Add fields to Structs which should not be empty
This CL adds fields to `Struct`s which should not be empty or removes
the structs.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I4a684bd96e3ed16a3fd0dd17019aeabf64ef074a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179182
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-15 12:24:13 +00:00
Daco Harkes ac805dff54 [vm/ffi] Migrate to empty Structs to Opaque
This CL migrates empty `Struct`s to `Opaque` native types.
It stops using `.ref` on `Pointer`s to these types.
And stops using `.ref` on `Pointer<Utf8>` which will be migrated in
`package:ffi`.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

Change-Id: I3aa256af7d4ceaa8ee37b1b2ada71f870f43617b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179181
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-15 10:52:53 +00:00
Sigmund Cherem 9837afa509 [web] partial migration of native tests to support dartdevc
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>
2021-01-15 02:16:42 +00:00
Sigmund Cherem 90e6fd4734 [web] Support for running native tests in dartdevc.
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>
2021-01-15 02:16:42 +00:00
Srujan Gaddam 787ec114e1 [pkg:js] Revert revert of @Native/@JS conflicts and cache native
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>
2021-01-15 01:18:02 +00:00
Daco Harkes 0bfbdfad78 [vm/ffi] Migrate tests/ffi(_2) to CallocAllocator
This CL does not yet roll `package:ffi` to use `Allocator`, because that
breaks the checked in Dart in Flutter in g3. Instead, this uses the copy
of `_CallocAllocator` from `package:ffi` in `calloc.dart`.

New API landed in: https://dart-review.googlesource.com/c/sdk/+/177705

Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I10e53a363cd87c4c11e7042989e6957b82ae2a09
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178992
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-14 12:36:27 +00:00
Ben Konyi e49937769f Revert "[ CLI ] Improved consistency of -D and --define across tools and"
This reverts commit e83e78431f.

Reason for revert: Failing on SIMARM and AOT bots

Original change's description:
> [ CLI ] Improved consistency of -D and --define across tools and
> 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>

TBR=bkonyi@google.com,asiva@google.com,sigmund@google.com

Change-Id: I1c594ae7db551619cc3191ff7f832c4fc61a4171
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179081
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-01-14 01:05:29 +00:00
Ben Konyi e83e78431f [ CLI ] Improved consistency of -D and --define across tools and
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>
2021-01-13 23:33:17 +00:00
Konstantin Shcheglov e5d5a0f345 Don't report INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_* when null safety.
https://github.com/dart-lang/language/pull/1389/files#diff-2f9dda5244b707ca3b6d5988c6e5257d6025a99a5fa08ce0dc171c94bdc8ce0dR665

Change-Id: Iccc90f8f9bb877da604d5a5774a931b71a185b91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178928
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-01-13 21:19:04 +00:00
Daco Harkes 5d40d52fca [vm/ffi] Add Opaque type
Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

TEST=samples/ffi/sqlite/lib/src/bindings/types.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ib9e72df6a07b1bc2b72a7db66f945652814baf51
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/+/178984
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-01-13 17:04:08 +00:00
Daco Harkes 4e2343c290 [vm/ffi] Introduce Allocator API
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>
2021-01-13 17:04:08 +00:00
Paul Berry 10917ffd55 Don't promote this inside extension methods.
Bug: https://github.com/dart-lang/sdk/issues/44652
Change-Id: I05e5acfbff1d498fa3ad513d956510909ec7d24f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178920
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-13 16:48:08 +00:00
Sigmund Cherem b461400e5a [tests] Add regression test for mixin+super+initializer.
This change adds a test to ensure we properly handle super calls in mixin that
override initializers.

This is a regression test for https://github.com/dart-lang/sdk/issues/44636,
which happened to trigger a stack-overflow in ddc.  The issue existed for a long
time, but was fixed in a recent CFE change
https://github.com/dart-lang/sdk/commit/52db62dd65284192755906691baf66c47a43f47e

Change-Id: I7d4aceb8e313f0000e32d9550f301792a9ab84cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178900
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-01-12 22:48:44 +00:00
Lasse R.H. Nielsen ef8cc2c1cf Remove LateInitializationError.
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>
2021-01-12 20:21:33 +00:00
Brian Wilkerson 11e7cdcfd1 Unify two error codes for documentation purposes
Change-Id: I730a0ee287e7d54bace9fdf84a02be5c3f4da017
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-01-11 23:12:20 +00:00