This cl simply adds a missing nullcheck to Math.exp
Change-Id: I5a5a145b1c60e31d956891c530cba2bb9a718b4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134761
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This mostly copies the changes from DDC to the dart2js implementation.
Change-Id: Ib56b607a6cea3df0e319e32cd4afa6b5b55b03d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134463
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Mostly changes to the comment syntax, removing optional `new`, and using the
same kind of quotes on strings.
Change-Id: Ia6d7f38523312f67cfa30cd30cef994759d40ef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134480
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This reverts commit 37f4a44a27.
Reason for revert: Relanding after infra issues cleared
Original change's description:
> Revert "[ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs"
>
> This reverts commit 48808f7dce.
>
> Reason for revert: Unable to approve failures.
>
> Original change's description:
> > [ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs
> >
> > Add support for naming VM service clients which allows for resume
> > permissions to be set for all clients of the same name. If a client
> > name requires resume approval, an isolate won't be resumed until all
> > clients which require resume approval have called the `resume` RPC.
> >
> > Resume approvals can be set for the following pause events:
> > - PauseOnStart
> > - PausePostRequest (issued after `reloadSources(pause: true)`)
> > - PauseOnExit
> >
> > Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
> > Commit-Queue: Ben Konyi <bkonyi@google.com>
> > Reviewed-by: Siva Annamalai <asiva@google.com>
> > Reviewed-by: Gary Roumanis <grouma@google.com>
>
> TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com
>
> Change-Id: I8e60416ad8cbec9ad93f4e34e9bf9af5a516c6dc
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134465
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>
TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com
Change-Id: Ibd9d831774e5c4dd500da026f41b173589a9aefd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134415
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This reverts commit 4cd6243d77.
Reason for revert: Breaks anything using the bazel_worker package (which is used for modular compilation with build_runner). https://travis-ci.org/dart-lang/build/jobs/645748778
Original change's description:
> [dart:io] Backport semantic changes from the dart:io NNBD migration.
>
> The NNBD migration required making subtle changes to some dart:io
> semantics in order to provide a better API. This change backports these
> semantic changes to the unmigrated SDK so any issues can be discovered
> now instead of blocking the future SDK unfork.
>
> The Process class will now throw a StateError if the process is detached
> upon accessing the stdin, stdout, stderr, and exitCode getters.
>
> The Socket class will now throw a SocketException if the socket has been
> destroyed or upgraded to a secure socket upon setting or getting socket
> options.
>
> Change-Id: I956fd07e713e51ebd479ebbfe4790d8d2fdf0744
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133989
> Commit-Queue: Jonas Termansen <sortie@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
TBR=sortie@google.com,lrn@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I744662fcd14ca232bf44a584bb6f3974d48da69a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134361
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
This reverts commit 48808f7dce.
Reason for revert: Unable to approve failures.
Original change's description:
> [ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs
>
> Add support for naming VM service clients which allows for resume
> permissions to be set for all clients of the same name. If a client
> name requires resume approval, an isolate won't be resumed until all
> clients which require resume approval have called the `resume` RPC.
>
> Resume approvals can be set for the following pause events:
> - PauseOnStart
> - PausePostRequest (issued after `reloadSources(pause: true)`)
> - PauseOnExit
>
> Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>
TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com
Change-Id: I8e60416ad8cbec9ad93f4e34e9bf9af5a516c6dc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134465
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Add support for naming VM service clients which allows for resume
permissions to be set for all clients of the same name. If a client
name requires resume approval, an isolate won't be resumed until all
clients which require resume approval have called the `resume` RPC.
Resume approvals can be set for the following pause events:
- PauseOnStart
- PausePostRequest (issued after `reloadSources(pause: true)`)
- PauseOnExit
Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
- List<String> should be List<Object?> because entries in the stack can be either Map or Strings
- _divRem has some cached values which are marked late but are used
before they are initialized resulting in exceptions, these four cached
values are now made nullable.
Bug: 40463
Change-Id: I469692e95bf6ef74665d14209dd3e2cd556c1f06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134408
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Since dart:cli is not in the libraries.yaml/json for ddc and dart2js, imports to
it are not allowed on web code. The patch files were not needed and can be
removed.
Change-Id: I46acf8a540f4b2d0a2aa7dcc50b572adab564b68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134048
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This should fix the breakage in the NNBD on test standalone/io/issue_32052_test
Change-Id: I58192dffa9a9d7f5c492dd58e7f570fabcb69b86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134243
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports these
semantic changes to the unmigrated SDK so any issues can be discovered
now instead of blocking the future SDK unfork.
The Process class will now throw a StateError if the process is detached
upon accessing the stdin, stdout, stderr, and exitCode getters.
The Socket class will now throw a SocketException if the socket has been
destroyed or upgraded to a secure socket upon setting or getting socket
options.
Change-Id: I956fd07e713e51ebd479ebbfe4790d8d2fdf0744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133989
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
The constructor was wrapping the onData handler to hide the type-mismatch. This
copies the same logic to the onData handler.
In non-nnbd code this code was not exercised. The migration of dart:async
made this code reachable on our tests. That's because Stream.first used to
do:
var subscription;
this.listen(() => ... cancel subscription here, ...)
it now avoids making subscription nullable by registering the onData handler
later:
var subscrition = stream.listen(null, ...);
subscription.onData(() => ... cancel subscription here);
This change fixes the following 6 html tests under nnbd:
html/history_test/history/history
html/transferables_test
html/transition_event_test
html/websocket_test
html/worker_test/functional/functional
html/xhr_test
Change-Id: I095ea8d545e65b047504af0367586884bba84d72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134120
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
This reverts commit b2b7337ad4.
Reason for revert: flutter build broke!!
Original change's description:
> [dart:io] Stop forcing lower case on HttpHeaders
>
> This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501
>
> HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.
>
> This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.
>
> The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.
>
> Bug: https://github.com/dart-lang/sdk/issues/33501
> Change-Id: I6f7f2ef907b229773c283140c07f2de4cd500981
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119100
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
TBR=whesse@google.com,sortie@google.com,lrn@google.com,zichangguo@google.com
Change-Id: I4d4299393ad6549b250053df8823e726855e2baf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/33501
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134102
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
The non-nnbd code doesn't have this extra `if`. It appears
that this conditional was added during the migration but
it is accidentally hiding the update to the _state.
This change restores the algorithm to how it was before
the migration and fixes lib_2/convert/base64_test/none
Change-Id: I72dd2e870056bb55158bbd053d8a3c8825a1d144
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134090
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
We now test bounds for mutual subtyping rather than structural equality
up to renaming of bound type variables and equating all top types.
Change-Id: I7dd23a3211a1631e463ea90c3173f3deae46ca23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134042
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501
HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.
This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.
The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.
Bug: https://github.com/dart-lang/sdk/issues/33501
Change-Id: I6f7f2ef907b229773c283140c07f2de4cd500981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119100
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
The least upper bound of _SyncBroadcastStreamController and
_SyncStreamController is StreamController (according to the CFE) leading
to an implicit downcast from StreamController to _StreamControllerBase.
The analyzer and CFE sometimes disagree on the hierarchy depth
computation (see https://github.com/dart-lang/sdk/issues/38377)
which is probably the root cause of this.
Change-Id: I276bdc894d3926eae603b023b29462571c620c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133980
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Generic functions with bounds on the type parameters should be allowed
to differ in that legacy type bound should be considered equivalent to
a nullable or non-nullable version of the same type bound.
Fixes test failures:
lib_2/async/async_await_zones_test
lib_2/async/stream_listen_zone_test
lib_2/async/zone_bind_callback_test
lib_2/async/zone_bind_callback_unary_test
lib_2/async/zone_debug_test
lib_2/async/zone_fork_test
lib_2/async/zone_register_callback_test
lib_2/async/zone_register_callback_unary_test
lib_2/async/zone_run_guarded_test
lib_2/async/zone_run_test
lib_2/async/zone_run_unary_test
Change-Id: I8bbb2ebae20f4e67bdaf8f321609b3307d92c6d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133245
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
The Process class will now throw a StateError if the process is detached
upon accessing the stdin, stdout, stderr, and exitCode getters.
The Socket class will now throw a SocketException if the socket has been
destroyed or upgraded to a secure socket upon setting or getting socket
options.
Bug: https://github.com/dart-lang/sdk/issues/40040
Change-Id: I68e22873932c68a3fac549c0f742dd49d0a60dfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133060
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Turn on the dart:cli tests in the nnbd bot.
Change-Id: I2c521b217300839deb7ad47a820768172b8f0e26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133866
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Several functions did not override their parents' function signatures
correctly for nnbd.
Change-Id: Ibd935ffa39b3175db65bb43d15396134700d2f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129143
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
NNBD will require explicit casts in various locations in the dart:html
libraries. To avoid taking on this overhead in the pre-nnbd dart:html
library, syntax is introduced in the emitter to allow tokens with
arguments.
Test: emitter_test.py
Change-Id: Ie6de714f491e0cda654f33ee389a91b765cacc9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133333
Reviewed-by: Stephen Adams <sra@google.com>
* Some cleanups on http parser.
* When parsing body of the http response/request, errors should not go to _controller, where it is paused. This leads to hanging.
* Fix another bug: (byte < 0x30 && 0x39 < byte)
Bug: https://github.com/dart-lang/sdk/issues/40132
Change-Id: Iaf3fb6a409c92889f50b86220a2c6c2318012c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132964
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
Work towards https://github.com/flutter/flutter/issues/46724
Background:
on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.
An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.
Overview:
This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind 3 times to a non-zero port, update the port selection to 0.
Results:
Tested locally two dart VMs with the same specified port:
```
jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
Observatory server failed to start after 1 tries
Falling back to automatic port selection
vm-service: isolate(2785434094928835) 'main' has no debugger attached and is paused at exit. Connect to Observatory to debug.
Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
```
Change-Id: I582ab402a457330928e5b490f9718fcd52b56720
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133434
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
This reverts commit 6ff7e9ebad.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> [vmservice] allow fallback on port bind failure
>
> Work towards https://github.com/flutter/flutter/issues/46724
>
> Background:
>
> on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.
>
> An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.
>
> Overview:
>
> This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind once to a non-zero port, update the port selection to 0.
>
> Results:
>
> Tested locally two dart VMs with the same specified port:
>
> ```
> jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
> Observatory server failed to start after 1 tries
> Falling back to automatic port selection
> vm-service: isolate(2785434094928835) 'main' has no debugger attached and is paused at exit. Connect to Observatory to debug.
> Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
> ```
>
> Change-Id: I371583edcb603325428f1cb760992e39b9f3b6dc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130441
> Commit-Queue: Jonah Williams <jonahwilliams@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
TBR=bkonyi@google.com,jonahwilliams@google.com
Change-Id: I337b2d549e33ef9c616c276a48ce894a14b1c317
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133327
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Work towards https://github.com/flutter/flutter/issues/46724
Background:
on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.
An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.
Overview:
This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind once to a non-zero port, update the port selection to 0.
Results:
Tested locally two dart VMs with the same specified port:
```
jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
Observatory server failed to start after 1 tries
Falling back to automatic port selection
vm-service: isolate(2785434094928835) 'main' has no debugger attached and is paused at exit. Connect to Observatory to debug.
Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
```
Change-Id: I371583edcb603325428f1cb760992e39b9f3b6dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130441
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
The `moveNext` docs should contain all the information necessary to implement it. There is otherwise no mention that this method is also used to set `current` to the initial element.
Closes https://github.com/dart-lang/sdk/pull/39676https://github.com/dart-lang/sdk/pull/39676
GitOrigin-RevId: c921486f7e104d7fad5b10ba2744f01b0a814dbc
Change-Id: I06736889c6e904e17027f27b7c5831eff495ce1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127455
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
The List constructor has been disallowed in NNBD code, so the NNBD SDK
should not be using it.
This changes all uses, not just in the already migrated libraries.
(Also found some bad typing in the `RegExpMatch` class along the way).
Change-Id: Ic61bd64427c0961c23aaf7ce59af5c2c271890ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132282
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Make it explicit that the allocating constructors allocate precisly the
needed amount of bytes.
Fixes#40261
Bug: http://dartbug.com/40261
Change-Id: I059a9e3e387fee116e2221a0761557aedc948aee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132844
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
For `foo() async* {}` frames we find the "caller" by finding out
what closure is registered as listener on the _AsyncStreamController.
There can be two cases:
a) The caller does a regular `foo().listen((_) {})`:
The stack trace will have the closure as the caller and unwinding stops.
b) The caller uses 'await for (... foo())':
In this case the listener will be a StreamIterator.
This CL changes our unwinding code to get the awaiter of `await it.moveNext()`.
Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I13f76025a15682aaf55fd968088fc2059982d842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132841
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Tests involving breakpoints, stepping, evaluation or coverage are expected to fail.
Tests involving introspection, heap analysis, extensions, timeline events or profiling are expected to pass.
- Fix crash when `debugger` is called.
- Fix crash when metrics are queried.
- Replace unnecessary use of `eval` with `invoke`, allowing more tests to run on AOT, AppJIT and simulators.
Bug: https://github.com/dart-lang/sdk/issues/40274
Bug: https://github.com/dart-lang/sdk/issues/40275
Change-Id: I3023af7cbfda745238c487d9a3a3a99e56a30244
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132942
Reviewed-by: Ben Konyi <bkonyi@google.com>
Our first-pass migration resulted in leftover @notNull checks being
applied to the wrong lines. @notNull applied to a line that
subsequently compares with null emits '===' instead of '==', which
bypassed our undefined to null coercion.
Change-Id: Ia7a5831c1ba42674d9013dc636ab4ea5714c58f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132982
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Created helper for emitting the nullability wrapper around a type. I'm also
using this helper as a way to reduce the number of places we check if the
null safety experiment is enabled to make that easier to cleanup in the near
future.
Change-Id: I928d098b9bdadd96759026f49c58c8fc86cf1aae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132940
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Widen `reflect` and `setField` to accept dynamic. `Object` will soon no longer be a top type, and dynamic is more consistent with other reflective inputs and `reflectee`.
Bug: https://github.com/dart-lang/sdk/issues/40045
Change-Id: Ic1e3a26aaea5de078cc616846cb52417c7975d11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132720
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
The new constructor creates a view of a (sub range) of the elements of another TypedData object.
It works for both typed lists and ByteData.
The advantage over the .view constructors is that it handles other views properly, including their
offsetInBytes in the start computation, which it is easy to forget to do when you call
SomethingList.view(other.buffer)
directly, and that constructor cannot compensate for the information because it only existed on the object
that the buffer was extracted from, not on the buffer itself.
Change-Id: I8abafbf2a81a32ea67f5d4c0f65dcfea08b49bb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127321
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
The List.generate didn't fail on negative values, and could be simpler.
The isEmpty documentation was wrong, and fixed for non-NNBD in a separate CL.
Fixes#40229.
Bug: http://dartbug.com/40229
Change-Id: I2413d44d8be435f4124156cde3ba03d9b1835484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132643
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Since a growable list can be created using `[]`, you never need to call
`List.empty` with anything but `growable: false` or `growable: dynamicValue`.
That means that the default should be non-growable (which also matches
`List.filled` and apparently user expectations - since there is already one bug where
I assumed it would be non-grwowble while migrating List.generate).
Ensure it's implemented by dart2js too and used where there were comments
saying to use it when available.
Change-Id: Ied20d69346ecfb93640ee2cec718e30e6f8980e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132600
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
This is a bit annoying, but our native List (VM and Web) have a looser
type here than the public List. Matching would be a breaking change
on something like:
main() {
List list = <int>[1, 2];
print(list.indexOf('hello'));
print(list.lastIndexOf('hello'));
}
This restores the looser type for nnbd.
Change-Id: I3db45817834279d0c46abf04caae3713bfca89d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132173
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
This tests static analysis on the ddc patch, but not the dart2js one yet.
It also fixes js/null_test.dart to ensure it passes. Note, that test was broken independent of NNBD.
Change-Id: I5a6bfdfaac845eaba6f154d30f2c1e30199574d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131300
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Update/Remove checks of the form:
ReturnType methodName(Type type) {
if (type is! Type) throw ArgumentError(...);
}
Post Dart 2 transition, these checks can now only account for the condition when type is null (though some are redundant with other null checks). Using "is" checks is unnecessary and likely adds a small overhead over a straight null check, in addition to a worse error message.
Since the nnbd SDK declares many of these types to be non-nullable, the checks can be entirely removed. In the regular, SDK I've replaced them with null checks. I'm not sure if this quite follows the intention of the nnbd_sdk.
Change-Id: Icccdd7d7eba4b6c9d08fbc9b6c127ce38cc0b78d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129986
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Currently does not work for function and generic function types.
Type object equality ignores legacy modifiers but preserves other nullability
semantics. This scheme constructs the runtime type object (normalized) at runtime,
caching it if necessary. This avoids the space overhead of emitting canonicalized
normalized types at compile-time but incurs a cost when runtimeType is called
for the first time per recursive subtype.
See: https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#runtime-semantics
Change-Id: I76d714c5e618d77f334d90862bb7d3c9b0b8d305
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130727
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
The `is!` check is causing test failures when null flows through as `value`.
There is still no type promotion in place to make this work without the cast.
`null is! int*` is true while `null as int*` is a safe cast.
Fixes runtime failures in:
- language_2/async/identifier_test
- language_2/await/and_ifnull_test
- language_2/invalid_returns/async_invalid_return_00_test/none
- language_2/invalid_returns/async_invalid_return_01_test/none
- language_2/invalid_returns/async_invalid_return_02_test/none
- language_2/invalid_returns/async_invalid_return_03_test/none
- language_2/invalid_returns/async_invalid_return_04_test/none
- language_2/invalid_returns/async_valid_returns_test
- language_2/regress/regress26668_test
- lib/async/future_foreach_test
- lib/async/futures_test
- lib_2/async/future_foreach_test
Change-Id: I25d0dfb10d558ef7c167f99d1fba11f379cd8815
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131719
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Everything in FFI is nonnullable, because C does not accept null values or return null values (nullptr == 0, not null).
The only thing that needed migration in the FFI api is operator == (dynamic other) --> operator == (Object other).
This CL does not migrate any tests as the VM cannot run any tests yet.
Fixes: https://github.com/dart-lang/sdk/issues/39144
Change-Id: I5efc772b61228bd1bd4d95be1b7bcd969f0c9ac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131380
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Fixes the original CL by restoring files temporarily needed by Flutter (until cleaned
up on Flutter side).
Change-Id: I2561339c797e1d5168646e59782ca0fcd10d79af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131582
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
This reverts commit 2a7789de18.
I forgot to revert the deleted files - this is breaking flutter hhh. Will reland properly tomorrow.
TBR=sigmund@google.com
Change-Id: I76ff774e34167b3a35315dbf4883b22dd1499837
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131560
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
This will permit List.of to be specialize for the different platforms.
Change-Id: I63583566354625b683d0897da619fc8cd23d0b7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131281
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This is prep for nnbd port to ensure APIs remain consistent across DDC and Dart2JS.
Change-Id: I8ec6c5b152eb87868038570f2275e82af3325fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131000
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Now that the LUB has been updated in the CFE we no longer need this workaround
to avoid errors.
Issue: #39534
Change-Id: I570efd0cb92755731572d1ddb4b1b9a018e85750
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130582
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
The information is expressed in the signature now, previously the return
type was implicitly `dynamic`.
Change-Id: Ib4a0106c94dc394e8126773442cd0886f81e0c79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130739
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
- opt-in NNBD all the patch files of core libraries.
- dart:io patch files are not yet opted in.
Change-Id: Iaef21d49f2949406450c41a878ede697f61556d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130820
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
I believe this fixes `language_2/await/await_test`, but there might be other
tests affected.
Change-Id: I573beda1b40540691f58fb38bda56814b70a9343
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130730
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Object -> Object? in the NNBD fork.
Change-Id: Id17827327f77d61266f1a478abb735348dbc7312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130564
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
We are establishing a convention that nullability wrappers will be emitted at the
call sites of 'is', 'as', and '_check' calls (when necessary). Additional wrappers
will be emitted when forward-declaring generic types at the top level - but only
around the generic parameters themselves.
For example, declaring List<int>, List<int?>, List<int>?, and List<int?>? results
in two top-level classes: ListOfInt(int) and ListOfInt$(dart.nullable(int)).
Change-Id: I2d91e170d8e1e911ad9eb70d6b4d67f1cc4cdbc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129921
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This change:
* adds the `--use-old-rti` flag to revert to the old behavior
* enables the new behavior by default
* changes the -rti- builders to run the old rti instead of the new rti
* documents the change in CHANGELOG.md
I've kept around the logic as `useNewRti` to avoid swapping all the conditions
in the compiler.
Change-Id: I773ac33b658cb60f72e0b6beef83375abec31bad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127492
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Fixes#39074
DDC emits Dart code that can usually be called with the same semantics
as JS there is no guarantee that a function passed to JS and then
invoked successfully was wrapped with `allowInterop`. The wrapping is
always required in Dart2JS. To make DDC more strict, add interceptors
that check for the usage of `allowInterop`.
Whenever a JS interop function or setter is passed an argument which is
statically typed as a Function, but not wrapped with `allowInterop` at
the call site, wrap it with `assertInterop` which will check the
argument at call time and fail with a clear error if it was not wrapped.
Whenever a JS interop function is torn off, either at the top level or
from an instance, wrap it with a function that will also inject these
checks at runtime.
There are still holes where we can't catch the mistake:
- An argument which is statically dynamic and a Function at runtime
won't be caught.
- A Function which is stored in a collection won't be caught.
- A JS interop definition where a getter returns a Function which takes
a Function as an argument is not checked.
- A dynamic call through to javascript is not checked.
Changes:
- Refactor `_isJsLibrary` and add `isJsMember`, and `isAllowInterop`
utilities to determine what needs wrapping.
- Update `assertInterop` to give a more clear error when it fails, and
to ignore non function arguments.
- Add `tearoffInterop` to wrap a function an ensure that any function
typed arguments are wrapped.
- Inject `assertInterop` around Function arguments passed to JS methods.
- Inject `assertInterop` around Function arguments passed to static or
instance JS setters.
- Inject a runtime wrapper around static or instance Function tearoffs.
- Add a test covering all flavors of checks that are supported.
- Change the interop expando to an `Expando<dynamic>` in the NNBD SDK to work
around a stricter type check. https://github.com/dart-lang/sdk/issues/39971
Potential improvements:
If the `tearoffInterop` turns out to be too heavy, we could loosen it so
that we only wrap methods if any of their argument types are statically
declared to be a Function.
Change-Id: Ibc92df5b54e1a041b4102a07b8398b774b6bd1d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128462
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
- Removes the load port functionality from the service isolate, this was
used to load sources in Dart 1 and is pretty much dead code in Dart 2
- Moves resolution of URIs and Package URI (based on package map) to the
individual isolates instead of sending a request to the service isolate
- Setups the package map lazily as it is needed only if resolveURI is
called in Dart code, it is not needed for loading/compiling sources
(this is now done in the front end).
- Removed Dart_ServiceWaitForLoadPort() methods from the Dart C API as
it is not used anywhere.
Change-Id: I6c3704bc431bdcd49bf074eb58bee1ed492ccccb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129742
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
It isn't possible to do this with evaluate since we are unable to access
classes from private libraries exposed through dart:io like dart:_http.
Change-Id: I3d4168d919dbcf5008da60b14165fd9b89f22cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129322
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
The remove method needs to delete the reference to the 'bucket' array
to avoid a pathological case of nearly unbounded empty buckets.
Bug: 39638
Change-Id: I5cb85817036f36aeec92f560aa4ec57ee9c88638
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129263
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This continues the work started in https://dart-review.googlesource.com/c/sdk/+/124105
The nnbd mode is now part of the type arguments instantiation cache,
since the resulting vector depends on the mode.
Change-Id: I803c07fa9473024557db8585e87286f16681169a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128307
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
All of these tests are now running under the regular test infrastructure.
The only reason they were created as modular tests was because we wanted more
control over the SDK sources used.
Change-Id: I2ad5aa616ff8bccd10cfac2d49bfaa39ab50c192
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128801
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Legacy and nullable types will get wrapped with their respective wrappers when
compiling applications with null safety enabled.
Change-Id: I1defe4fc9d5d9b5eacf23a479178eca060ea716b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128379
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Bug: https://github.com/dart-lang/sdk/issues/39627
Lists in a future should be typed with dynamic since they come from JS
interop.
Results from running tools/dom/scripts/go.sh
Change-Id: I4ed37d6f5fa570beef71652dcad17c3bcf7560ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128300
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This code is causing an issue when running tests with the NNBD SDK. As I
understand it used to be possible to pass a function to assert but that feature
was removed from the language. We might as well remove it from DDC too :)
Change-Id: Ia62c653ec9d4c98694986b2c326d2b1b027b9ed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128308
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This change fixes the issues causing build failures when using the
forked NNBD SDK sources and trying to build the dartdevc_kernel_sdk
target.
The end result is a dart_sdk.js file that is known to be incorrect
(missing uses of the legacy and nullable type wrapping) but serves
as a baseline for improvement. Some tests of the runtime directly
will correctly pass.
Following changes will turn on the type wrapping and we can start
diagnosing and fixing the issues that appear.
Fixes: #38665
Change-Id: Iddcf31ef2520fa54bf7d9ae6262c2264636b9b10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127780
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
The nullability of runtimeType must be consistent with the nullability of
a class DeclarationType. Currently, it is always kLegacy. However, this
needs to be set to kNonNullable when the NNBD experiment is enabled.
Note that the nullability of the null instance remains kNullable.
Change-Id: I4ba974c2551c3a7fbd190b02175804090f9b48b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125721
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Legacy types are considered equal to their non-nullable variant.
Type hash is modified to be consistent with the new definition.
Change-Id: If90f7f13cf77e519d5b90b57d9dbf4988f71be13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126283
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Arguments to simd type constructors were being checked in the bootstrap
natives entrypoint but not elsewhere. Checking for null in Dart code
ensures that we don't accidentally miss these checks in AOT.
The changes to sdk_nnbd are required in order to ensure the number of
arguments passed to native code match the number of arguments from the
non-NNBD implementation (we needed to remove the implicit type args
parameter).
Fixes https://github.com/dart-lang/sdk/issues/39518
Change-Id: Iaf7d8790c154f1e85db613b6dc84004c8013df9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126905
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This is the simplest fix until we have the DDC build actually working to
make get the analyzer test bot for nnbd working again.
Change-Id: I1357d0ef1509293649f32a01cd83c85398923c1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127540
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This was a case missed when fixing #33891, and fixes#36798
Change-Id: I96e177a7d8020635e191d829afdec45f888658a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127500
Reviewed-by: Alan Knight <alanknight@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
The list being viewed can sometimes itself be a sublist view, but the
default view() constructor doesn't take that into account, and instead the
caller needs to be aware of the case. This change makes all such uses use
offsetInBytes, even in cases that's not needed, so it's trivial to audit
that it's always used correctly. In the cases it's not needed, it just gets
the value 0 and it's a no-operation. In the cases it's needed, it fixes a
bug, such as in _WebSocketProtocolTransformer.add().
Closes#39589
Change-Id: I6e9bd5510f48ce378bdec2c64b56fe789dfb27ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127165
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
The CL also updates a number of pragma annotations to be conditional on
non-product mode.
Change-Id: Ia00b5089d54bbb8f6f6006ef67d65859ab56c132
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127004
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Original change was broken by the fact that DDC expects all types marked as
native have all their superclasses marked as native when the super classes are
compiled.
In this case `MapMixin` from dart:collection was not being marked as native and
the only reason it was working before was that the library dependency enforced
the necessary order.
* Now `MapMixin` is explicitly marked as native.
* Added a test case to use some of the API on `window.localStorage` that is
inherited from the MapMixin class.
Change-Id: I1584bfb86179016ee12c2acc5cfbbe81d086841e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126906
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
NOTE:
Includes a change to RuneIterator.rawIndex that should be considered
breaking when we unfork the SDK.
Change-Id: I91c1be25b7be7afb828b5c92de133a7d6b161363
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126420
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Change-Id: I82ad71f3db9a7c04d87cad62662760f1b104ad68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126733
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
The front end is failing to consistently find the correct LUB for function types
with generic type arguments (especially with nullability).
We should revert this change after it is fixed.
https://github.com/dart-lang/sdk/issues/39534
Change-Id: Ie7f6856ccc269c6b287a1f96f264bdd53a2d1782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126404
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Remove the language version comment from dart:_js_helper but it has not yet
been fully migrated. This only makes the necessary changes to fix errors in
dart:core.
Change-Id: Ib0dafd7838ad46e5e0284cefb751e12504c318b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126401
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
This change breaks the dartdevc_platform target for nnbd because it removes
the language version comment from only some of the part files in the
dart:_js_helper library. At the same time we need to migrate:
* annotations.dart
* linked_hash_map.dart
* identity_hash_map.dart
* custom_hash_map.dart
* native_helper.dart
* regexp_helper.dart
* string_helper.dart
* js_rti.dart
This reverts commit 3e86e8f8fb.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> [dartdevc] Migrating dart:_js_helper to NNBD.
>
> Change-Id: Ic204b43221f876c945cc1b973a2165131a3f40b2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125994
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Mark Zhou <markzipan@google.com>
TBR=sigmund@google.com,nshahan@google.com,markzipan@google.com
Change-Id: Ie199fd5e93c0eb99cbf1bddc4e8588a325922a61
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126300
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This is done by collecting all frames on the current stack until an async/async* frame is hit
which has yielded before (i.e. is not in sync-async case).
From there on it finds the closure of the async/async* frame and starts traversing the listeners:
while (closure != null) {
yield_index = closure.context[Context::kAsyncJumpVarIndex]
pc = closure.function.code.pc_descriptors.LookupPcFromYieldIndex(yield_index);
<emit pc in frame>
closure = closure.context[Context::kAsyncCompleterVarIndex]._future._resultOrListeners.callback;
}
Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I97030d22e529bf8a74ecd30a8a2589cfe57ad330
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122644
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This is a reland of 3c9e924073
Original change's description:
> Revamp patch_sdk.dart mainly to use libraries.json.
>
> This will make it possible to use the script to create a patched sdk
> for dart2js and the vm (some followup needed), which will be useful
> to migrate their libraries to nnbd.
>
> In the future, we should be able to leverage this new logic to
> write tests that ensure our sdk is warning-free (there are > 80 real
> warnings today even on the non-nnbd sdk)
>
> In detail, this CL includes:
>
> * loading the libraries data from libraries.json, this removes the need for a
> hand-crafted libraries.dart that replicates the data in libraries.json.
>
> * auto-generates a libraries.dart in the patched sdk that can be used to run
> dartanalyzer or to compile an sdk with dartdevc-legacy.
>
> * script simplifications in patch_sdk.dart
> * removed tracking of modification stamps. This didn't appeared to be
> used by the ninja rules. I believe it was used to reduce local
> iteration cycles when we were first developing the sdk itself.
>
> * use Uri directly instead of package:path - this simplifies things,
> especially since the libraries_specification is Uri-based as well.
>
> * switch to use package:args for parsing options
>
> * added an option to merge part files in a single file. I've noticed that the
> analyzer provides some false positive errors in part files, but once merged
> they are no longer shown. In particular, we are clearly hitting limitations of
> dartanalyzer on the patched sdk. At this time the old patch-script generated
> an sdk with 1500 warnings, this new script reduces it to 500 (not sure why),
> with merging of part files it goes down to 80.
>
>
> Change-Id: I6bbaf92ef4554f00c8bf6b38d19bf79d44fb3e94
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125780
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Sigmund Cherem <sigmund@google.com>
Change-Id: Ifcb9dbef36452e41e8e96e086761d76b5a3d988e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125998
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
The lack of these imports are breaking the `dartdevc_platform` build target when
using the `--nnbd` flag.
Change-Id: Ib8b8368286c24b5435ad4d141ad68aea8ba6be0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126220
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
This reverts commit 3c9e924073.
This CL was breaking the internal build.
Change-Id: Ic4e6df070f2a87ac88ef97f0e6b07d53c13ceadc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125925
Auto-Submit: Vijay Menon <vsm@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
This will make it possible to use the script to create a patched sdk
for dart2js and the vm (some followup needed), which will be useful
to migrate their libraries to nnbd.
In the future, we should be able to leverage this new logic to
write tests that ensure our sdk is warning-free (there are > 80 real
warnings today even on the non-nnbd sdk)
In detail, this CL includes:
* loading the libraries data from libraries.json, this removes the need for a
hand-crafted libraries.dart that replicates the data in libraries.json.
* auto-generates a libraries.dart in the patched sdk that can be used to run
dartanalyzer or to compile an sdk with dartdevc-legacy.
* script simplifications in patch_sdk.dart
* removed tracking of modification stamps. This didn't appeared to be
used by the ninja rules. I believe it was used to reduce local
iteration cycles when we were first developing the sdk itself.
* use Uri directly instead of package:path - this simplifies things,
especially since the libraries_specification is Uri-based as well.
* switch to use package:args for parsing options
* added an option to merge part files in a single file. I've noticed that the
analyzer provides some false positive errors in part files, but once merged
they are no longer shown. In particular, we are clearly hitting limitations of
dartanalyzer on the patched sdk. At this time the old patch-script generated
an sdk with 1500 warnings, this new script reduces it to 500 (not sure why),
with merging of part files it goes down to 80.
Change-Id: I6bbaf92ef4554f00c8bf6b38d19bf79d44fb3e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125780
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Update DartTime.parse to support arbitrary precision fractional seconds. So it now conforms to ISO8901 and RFC3339 standards.
Closes#24205Closes#39350https://github.com/dart-lang/sdk/pull/39350
GitOrigin-RevId: 66f15b6e646a65b7955c7b617647b8edfd680481
Change-Id: Ife2211e6cce5922b59cdde0d30ed3ef887cffcf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124903
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Change-Id: I5bcb7c40be12ee1dc887620281b4807469d67bbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125729
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Should the type agree with operator on Object?
Change-Id: I4a0257cec08a92898cb302c34e66a2fda4cfce6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125728
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Some preparation for NNBD migration.
This was not part of the public API and only part of the DDC patch. I could not
find any use besides passing null which was the default anyway.
Change-Id: Icab2bb3f24e228afd4f0a57c9a2474121f27a67b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125466
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This is some preparation for the NNBD migration where the existing downcasts and
possible nullable accesses will be errors.
- Downcasts have been replaced with covariant parameters.
- Local variables have either been declared with a specific type or given
initial values so that they can become non-nullable in the future.
- Remove a pointless `is! int` type check. The parameter is an int.
Change-Id: I3a0358d83a181eee5576c2062128d89d197ba3e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125303
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Use a local variable to get type promotion of the nullable Function.
Change-Id: I271a53044afbfb40999706c486dc27b8883190af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125580
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Change-Id: Ie4d5164759c1d4a8c19e216bfac50b116271f1a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125342
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Setting the `enableTimelineLogging` property of `HttpClient` to true results in
timeline events being created for HTTP connections and HTTP requests.
Timeline events contain general connection information, including:
- Request type
- Status code
- Request / response headers
- Cookies
- Non-sensitive proxy information
- Relevent error messages for failed connections
Change-Id: Ibe16a312ab5398c9ae886ea07bea5ca70b63e440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123540
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This is some preparation for the NNBD migration where the existing downcasts and
possible nullable accesses will be errors.
- Downcasts have been replaced with covariant parameters.
- Local variables have either been declared with a specific type or given
initial values so that they can become non-nullable in the future.
Change-Id: Ie871095ee26771833318d1dfce2b5986afaf8c69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125227
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
The goal of this change is to make it possible to start iterating on nnbd tests
for DDC. This keeps the current philosophy of keeping NNBD and non-NNBD build
configurations separate, except that NNBD builds are allowed to consume library
sources from the non-nnbd sdk.
This change addresses the first set of errors that are encountered when trying
to build a fully NNBD configuration:
* CFE has issues with type promotion, for that reason we remove
`--enable-experiment=non-nullable` in vm build rules, and we use a smaller
training data when creating the dartdevc app-jit snapshot.
* We'd hit compile-time errors with nnbd libraries with inconsistent
patchfiles. To avoid that, the libarries.json points to the non-nnbd SDK
sources for most dart:* libraries.
Change-Id: Ie6226b3bd8a92b4a1632dd84a5db2f04238fd4f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125080
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Change-Id: I99fb8004433ac0b518c6da23dfb7d73d2a30e769
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124421
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>