Commit graph

31 commits

Author SHA1 Message Date
Mark Zhou 44a4f366e2 [sdk] Updating Stream.contains to accept null values.
Change-Id: Icdb4e3fb04625b8e0ffabe1214b196cd7a9eb1ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138888
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-03-10 15:58:26 +00:00
Lasse R.H. Nielsen 93ff9530aa Document difference between Stream.transform and Stream.map.
Fixes #36351

Bug: http://dartbug.com/36351
Change-Id: I75f98b8fdc3a34578adab96e9993089ea69e84bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98346
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-03-06 13:19:34 +00:00
David Morgan b59dad38df Revert "[vm/tfa] Convert named and optional parameters to required parameters where possible."
This reverts commit 9ab51b8012.

Reason for revert: Test failure in google3; please see internal b/150195057.

Original change's description:
> [vm/tfa] Convert named and optional parameters to required parameters where possible.
> 
> Flutter Gallery code size (total):
> ARM64: -2.31%
> ARM32: -2.38%
> 
> Change-Id: Ide7764afb06bf6f8387015de612cd4798b301541
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135305
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,sjindel@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ib198c7cf265384c336d9db6776742db23fb4e999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137102
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-02-25 15:12:01 +00:00
Samir Jindel 9ab51b8012 [vm/tfa] Convert named and optional parameters to required parameters where possible.
Flutter Gallery code size (total):
ARM64: -2.31%
ARM32: -2.38%

Change-Id: Ide7764afb06bf6f8387015de612cd4798b301541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135305
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-24 14:09:27 +00:00
Joshua Litt e34299101c Add back null check to _StreamIterator constructor in NNBD.
This check is necessary to make 'for await (var i in null) {} ' throw at runtime.

Change-Id: Id68c3d422671decbe4cb3e3326d9597ad7153d84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134871
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-02-12 18:55:47 +00:00
Alexander Markov dfeb306171 [nnbd/corelib] Restore null test in Stream.asyncExpand
Stream.asyncExpand used to test result of 'convert' callback for null.
Moreover, this is a documented behavior: "If the call returns `null`,
no further action is taken for the elements." This ability was lost
when dart:async was migrated to NNBD as return type of 'convert'
becomes non-nullable. This change restores this behavior and changes
return type of 'convert' callback to be nullable.

Fixes the following tests with unforked SDK:
 co19_2/LibTest/async/Stream/Stream.fromFutures_A04_t01
 co19_2/LibTest/async/Stream/Stream.fromIterable_A03_t01
 co19_2/LibTest/async/Stream/Stream.periodic_A04_t01
 co19_2/LibTest/async/StreamController/StreamController.broadcast_A09_t01
 co19_2/LibTest/async/StreamController/StreamController.broadcast_A10_t01
 co19_2/LibTest/async/StreamController/stream_A02_t01
 co19_2/LibTest/async/StreamController/stream_A03_t01

Change-Id: I7c9236475dc27eb2ada5bdd57cfb27fc84f72592
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135200
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-02-11 17:49:24 +00:00
Robert Nystrom 688801cb27 Migrate language_2/assert to NNBD.
Change-Id: I4daa09afa52f76076374591b3e3f3420a46b169b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134240
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2020-02-06 22:47:25 +00:00
Johnni Winther 906c6ea21c Avoid implicit downcast in nnbd sdk
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>
2020-01-31 11:58:31 +00:00
Lasse Reichstein Holst Nielsen 95511b314c Stop using List() constructor in NNBD code.
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>
2020-01-24 15:59:29 +00:00
Clement Skau da1e42a11c [SDK] Fixes async* stack unwinding.
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>
2020-01-24 09:04:56 +00:00
Lasse R.H. Nielsen 8a52941c2e Clean-up. Fixes List.generate and Stream.isEmpty documentation.
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>
2020-01-21 12:11:51 +00:00
Nicholas Shahan a5a8ea008b [dart:async] Fix error in NNBD fork
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>
2020-01-15 18:25:04 +00:00
Lasse R.H. Nielsen af75314a9b Fix bug in NNBD stream controller.
Add regression test.

Change-Id: I8c6501cbac86122f9a0441c5e0155a823ce99028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130862
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-01-14 09:17:45 +00:00
Vijay Menon f4848eb112 [dartdevc,nnbd] fix static async errors
Change-Id: I903f4483f33f737aea877a49999d02a82558dd1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130923
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-01-10 18:32:24 +00:00
Nicholas Shahan 0a13661c55 [dart:async] Cleanup workaround in NNBD fork
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>
2020-01-10 17:53:57 +00:00
Mark Zhou 96cea64fa6 Cleaning up NNBD tests and migrations.
Change-Id: I0a63a6864c568491ad5e20b6eb490760e620a889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130200
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-01-09 17:11:46 +00:00
Nate Bosch 1daaee444d Remove redundant detail from doc comment
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>
2020-01-09 09:09:08 +00:00
Sigmund Cherem 83850274fe Fix typo from migrating stream_controller
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>
2020-01-08 23:37:25 +00:00
Martin Kustermann 72f4a831aa Revert "[SDK] Switch to is_sync to identify sync/async running."
This reverts commit 886615d0f9.

Reason for revert:

There was an unexpected slowdown in some async benchmarks, e.g. Calls.AwaitAsyncCall.

Will revert for now and investigate next year.


Original change's description:
> [SDK] Switch to is_sync to identify sync/async running.
> 
> This should address the regression introduced by https://dart-review.googlesource.com/c/sdk/+/124988
> 
> Bug: https://github.com/dart-lang/sdk/issues/39525
> Change-Id: Id163b649bdd0363297c186559fa84ff87f908e4b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129062
> Reviewed-by: Clement Skau <cskau@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=kustermann@google.com,cskau@google.com

Change-Id: I5cda795cbccc01f22e0f8192473c171a4e9fca4b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/39525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129285
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-20 19:06:54 +00:00
Clement Skau 886615d0f9 [SDK] Switch to is_sync to identify sync/async running.
This should address the regression introduced by https://dart-review.googlesource.com/c/sdk/+/124988

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Id163b649bdd0363297c186559fa84ff87f908e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129062
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-20 11:07:10 +00:00
Mark Zhou 4589145939 [dartdevc] Cleaning up analysis errors.
Change-Id: I5af7281af4500f939b335a1df97abefe9386f347
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128080
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-12-13 17:40:49 +00:00
Clement Skau f9327d3bac [SDK] Adds --lazy-async-stack support for async*.
Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I53cd334243649901ea8e0f9799d9f41c126e3627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126729
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-04 12:47:48 +00:00
Nicholas Shahan 96e7a4ff30 [dart:async] Temporarily work around compilation errors
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>
2019-11-27 16:09:30 +00:00
Clement Skau d5dbf10672 [SDK] Adds non-eager async stack frame collector.
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>
2019-11-26 11:51:27 +00:00
Kevin Moore 8342ec2c71 Fix pub.dev URLs throughout SDK repo
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>
2019-11-20 11:30:48 +00:00
Mark Zhou c825038296 [dartdevc] Migrating dart:async patch files for DDC to be nnbd-compliant.
Change-Id: I822fc9db7ddfe95a6f561ef1acfc88f96f2635dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125060
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-11-18 22:16:55 +00:00
Lasse Reichstein Holst Nielsen 4ebc1e3fe7 Migrate dart:async to NNBD.
Change-Id: I044f1c4070d14a297c4434618bd94270efc277ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122786
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-11-05 12:02:01 +00:00
Sam Rawlins 09b08f7b0e Add comment on non-negativity of periodic Timer and Stream.
Fixes #30122

Change-Id: Idde67193fb671aa7fb0d277f8ec81193421d8c21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112276
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-10-18 13:22:48 +00:00
Sam Rawlins 9a829cc0b3 Remove 'strong' comments from Future.
Fixes #36458

Change-Id: I4b4f4c0666b6dee166459875881b798c44e7d65c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122040
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2019-10-18 08:11:55 +00:00
Lasse R.H. Nielsen e88057fe04 Add non-NNBD language version marker on all sdk_nnbd files.
Change-Id: I2ab3d4b1efe0f3c79f4b770e79476153380220f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118040
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2019-09-19 19:44:37 +00:00
Paul Berry 004d49bd6b Make a fork of sdk/lib for use by NNBD.
Change-Id: I7f5892d66f9e7bd08ca064fb2df329794a56faf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116527
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-10 19:20:12 +00:00