Commit Graph

319 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen 3e8bfb1adb Add groupBy to Stream.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2850393003 .
2017-05-08 10:25:17 +02:00
Lasse R.H. Nielsen 8c742bd500 Change Future.doWhile to use a loop for non-future results instead of recursion.
Avoids stack overflow on long sequences of non-future results.

R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2853203002 .
2017-05-02 12:56:55 +02:00
Erik Corry aa6353b6da Dart SDK Spelling b, c, and d.
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2850783002 .
2017-05-01 08:28:10 +02:00
Lasse Reichstein Holst Nielsen 6156495d77 Fix bug in Future.forEach. Add tests.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2851443002 .
2017-04-27 16:11:40 +02:00
Jacob Richman 2dcd56ef43 Format all tests.
There are far too many files here to review everyone carefully.
Spot checking most of the diffs look good as test code is generally written
with less care than application code so lots of ugly formatting get through.
If people notice files where the automated formatting bothers them feel free
to comment indicating file names and I'll move spaces within comments to make
the formatting cleaner and use comments to force block formatting as I have
done for other case where formatting looked bad.

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2771453003 .
2017-04-17 14:53:02 -07:00
Lasse R.H. Nielsen 91e4917735 Fix test that assumed an async function returned a Future<not-dynamic>.
Review-Url: https://codereview.chromium.org/2788103002 .
2017-03-31 13:04:42 +02:00
Lasse R.H. Nielsen d509ddb3fa Use FutureOr more and make Future.sync return the resulting Future directly.
When the computation passed to Future.sync returns a Future of the correct type,
then it's returned directly instead of wrapping it again.
(Until strong mode, we have an extra case for when it returns a Future of an
incorrect type, but that will eventually be removed).

This should improve the performance of Future.sync a bit.

Also adds missing Zone intercept for when the Future.sync computation throws.

Updates documentation for Future.doWhile.

Fixes #29202
BUG= http://dartbug.com/29202
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2790663003 .
2017-03-31 12:41:07 +02:00
Jacob Richman 14531fa62d Re-land "Format all multitests"
Only delta from the original is a bad merge of tests/corelib/list_test.dart

This reverts commit 44d8be0ed3.

BUG=

Review-Url: https://codereview.chromium.org/2774783002 .
2017-03-23 12:40:21 -07:00
Jacob Richman 44d8be0ed3 Revert "Format all multitests"
This reverts commit 312b66dd5f.

BUG=

Review-Url: https://codereview.chromium.org/2770063002 .
2017-03-23 10:49:40 -07:00
Jacob Richman 312b66dd5f Format all multitests
BUG=
R=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2768073002 .
2017-03-23 10:26:44 -07:00
Jacob Richman 88eb557b65 Fix warnings_checker.dart handling of multitests
Update all tests

Support //# multitests for better dartfmt compatibility and fewer multitest false positives

All files under tests were manually updated with

find . -iregex '.*\.dart$' -print0 | xargs -0 perl -pi -e 's/(\S\s+)\/\/\/ /$1\/\/# /'

For now both old and new styles are allowed to accommodate CO19 tests.

R=efortuna@google.com
BUG=

Review-Url: https://codereview.chromium.org/2765693002 .
Review-Url: https://codereview.chromium.org/2765893003 .
2017-03-21 17:29:56 -07:00
Jacob Richman bf2b545150 Revert "Update all tests"
This reverts commit ce76e9c30beaf9a193d3677b88c20a1ebb3fae8c.
2017-03-21 16:33:18 -07:00
Jacob Richman 3c7353d987 Update all tests
Support //# multitests for better dartfmt compatibility and fewer multitest false positives

All files under tests were manually updated with

find . -iregex '.*\.dart$' -print0 | xargs -0 perl -pi -e 's/(\S\s+)\/\/\/ /$1\/\/# /'

For now both old and new styles are allowed to accommodate CO19 tests.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2765693002 .
2017-03-21 12:39:28 -07:00
Jacob Richman 6a7d6c385e Add comments
Add spaces to make sure dartfmt doesn't destroy bespoke indentation

BUG=
R=sra@google.com

Review-Url: https://codereview.chromium.org/2763823002 .
2017-03-20 21:03:12 -07:00
Jennifer Messerly 0e00b3e5c8 fix #28008, fix #28009 implement FutureOr<T>
This implements FutureOr<T> in strong mode, otherwise it's ignored (treated as `dynamic`.

Also fixes strong mode's inference subtype function incorrectly treating `void` as a malformed type. This had the consequence of allowing `void` to be inferred as a type argument.

R=leafp@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2647833002 .
2017-01-25 15:32:57 -08:00
Zachary Anderson 63c4b6b1cb Revert "Remove package:unittest from some tests"
This reverts commit dde47b2aad.

Revert "Update Dartium status for passing test"

This reverts commit d71c70d56d.

Tests failing on dart2js and async_star_pause_test is
passing on Dartium. Need to think about how to update the
status files.

Review-Url: https://codereview.chromium.org/2656503004 .
2017-01-25 11:06:58 -08:00
Zachary Anderson dde47b2aad Remove package:unittest from some tests
package:unittest is deprecated in favor of package:test.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2656743002 .
2017-01-25 08:50:02 -08:00
Florian Loitsch 36c5cea288 Update status file and test.
Fixes red status for dartium/drt.
Also makes one test more precise (and less likely to fail for the wrong
reasons).

Review-Url: https://codereview.chromium.org/2571583006 .
2016-12-13 14:02:25 +01:00
Florian Loitsch 0c3deba6df Add tests for FutureOr<T>.
R=lrn@google.com

Review URL: https://codereview.chromium.org/2564563003 .
2016-12-12 14:54:57 +01:00
Lasse R.H. Nielsen 9ebef9af7c Handle the case of Stream.take(0) better.
The current implementation listens to the stream and waits for it to complete.
The change makes it listen and then immediately cancel, and then return a
subscription that only sends done.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2444363004 .

Committed: https://github.com/dart-lang/sdk/commit/8cead4090cc0b1184a2ad552003ac38cae1e2c77
2016-11-04 15:55:05 +01:00
William Hesse 3bd04426a8 Revert "Handle the case of Stream.take(0) better." This reverts commit 8cead4090c.
The test co19/LibTest/async/Stream/take_A01_t02 was failing after this
commit, on macos and windows, and perhaps everywhere.

BUG=
TBR=lrn@google.com

Review URL: https://codereview.chromium.org/2475303002 .
2016-11-04 15:47:46 +01:00
Lasse R.H. Nielsen 8cead4090c Handle the case of Stream.take(0) better.
The current implementation listens to the stream and waits for it to complete.
The change makes it listen and then immediately cancel, and then return a
subscription that only sends done.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/2444363004 .
2016-11-04 14:54:58 +01:00
Florian Loitsch 70c48b9a2e Don't propagate synchronous Future.wait errors immediately.
Fixes #27249.

R=lrn@google.com

Review URL: https://codereview.chromium.org/2311923002 .
2016-09-06 11:57:43 +02:00
Florian Loitsch 6255638cd0 Return futures on Stream.cancel when possible.
Deprecate returning `null`.

Also, fixes cases where transformations on a stream didn't forward the cancel future

Fixes #26777.

BUG= http://dartbug.com/26777.
R=lrn@google.com

Review URL: https://codereview.chromium.org/2202533003 .

Committed: https://github.com/dart-lang/sdk/commit/395e7aaa696126b82862a9f75e7ebf742c354b56
Reverted: https://github.com/dart-lang/sdk/commit/99e5328eaca7f98641a5c6e523e80b7297792817
Committed: https://github.com/dart-lang/sdk/commit/1905ddafaa242883891e2fb2d706e2dfa059a71b
Reverted: https://github.com/dart-lang/sdk/commit/46a8579c1eb58f6a36a7d094d9b7824c92873de4
2016-09-05 17:41:22 +02:00
Florian Loitsch 33b7b45252 Deal with synchronous errors in Future.wait.
Synchronous errors are caught and piped into the returned future. This makes handling errors in Future.wait uniform.

Fixes #23656
BUG= http://dartbug.com/23656
R=lrn@google.com

Review URL: https://codereview.chromium.org/2252823004 .
2016-08-18 14:09:20 +02:00
Florian Loitsch 46a8579c1e Revert "Return futures on Stream.cancel when possible."
This reverts commit 1905ddafaa.

Review URL: https://codereview.chromium.org/2223133002 .
2016-08-08 19:31:04 +02:00
Florian Loitsch 1905ddafaa Return futures on Stream.cancel when possible.
Deprecate returning `null`.

Also, fixes cases where transformations on a stream didn't forward the cancel future

Fixes #26777.

BUG= http://dartbug.com/26777.
R=lrn@google.com

Committed: https://github.com/dart-lang/sdk/commit/395e7aaa696126b82862a9f75e7ebf742c354b56

Review URL: https://codereview.chromium.org/2202533003 .

Reverted: https://github.com/dart-lang/sdk/commit/99e5328eaca7f98641a5c6e523e80b7297792817
2016-08-08 17:30:36 +02:00
Florian Loitsch 99e5328eac Revert "Return futures on Stream.cancel when possible."
This reverts commit 395e7aaa69.

Review URL: https://codereview.chromium.org/2213193004 .
2016-08-05 14:32:14 +02:00
Florian Loitsch 395e7aaa69 Return futures on Stream.cancel when possible.
Deprecate returning `null`.

Also, fixes cases where transformations on a stream didn't forward the cancel future

Fixes #26777.

BUG= http://dartbug.com/26777.
R=lrn@google.com

Review URL: https://codereview.chromium.org/2202533003 .
2016-08-05 13:58:45 +02:00
Alan Knight 30b489578d Revert "Reapply zone tasks."
This reverts commit 6a7c037aa6.

BUG=

Review URL: https://codereview.chromium.org/2162643002 .
2016-07-18 13:12:36 -07:00
Florian Loitsch 6a7c037aa6 Reapply zone tasks.
This reverts commit 34d3c37233.

Committed: https://github.com/dart-lang/sdk/commit/f746f8f77e93fd93cb4ff3b4ed644c96a432947a

R=lrn@google.com

Review URL: https://codereview.chromium.org/2119243002 .

Reverted: https://github.com/dart-lang/sdk/commit/dae392291595fa394d601d2d0baa77b66d85533f
2016-07-05 17:33:09 +02:00
Florian Loitsch dae3922915 Revert "Reapply zone tasks."
This reverts commit f746f8f77e.

Review URL: https://codereview.chromium.org/2123593002 .
2016-07-04 21:58:15 +02:00
Florian Loitsch f746f8f77e Reapply zone tasks.
This reverts commit 34d3c37233.

Review URL: https://codereview.chromium.org/2119243002 .
2016-07-04 19:55:58 +02:00
Florian Loitsch 34d3c37233 Revert zone tasks.
Revert "Add tasks to zones."

This reverts commit 85cccde717.

Revert "Make Dom events run through zone tasks."

This reverts commit 6d1f6b2af6.

Revert "Add zone task support for request-anim."

This reverts commit 726b9f8dc7.

Revert "Add zone task support to http-requests."

This reverts commit b40cfcb57f.

Revert "Update status file for jsshell."

This reverts commit 5e05ee9b5f.

Review URL: https://codereview.chromium.org/2120063002 .
2016-07-01 22:36:52 -07:00
Florian Loitsch 85cccde717 Add tasks to zones.
R=lrn@google.com, misko@google.com

Review URL: https://codereview.chromium.org/1848933002 .
2016-07-01 19:42:22 -07:00
Florian Schneider 60cba24f86 Make timer test more robust.
This would fail, if the cancel() call would not be executed in time.

Give it a little extra time to make intermittent failures go away.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2075793002 .
2016-06-16 14:30:11 -07:00
Lasse R.H. Nielsen 06676c4719 Implement everything in test Future-class to avoid analyzer warnings.
Review URL: https://codereview.chromium.org/1968033002 .
2016-05-11 13:43:51 +02:00
Lasse R.H. Nielsen 63b71b4c24 Make _Future._chainForeignFuture not cause an assert.
If the foreign future completes with a future, the following call to
_Future._completeWithValue would hit an assert in checked mode
(value is! Future). This change makes the _Future._completeWithValue flatten
incoming nesting futures before completing the _Future, ensuring that a
_Future never has a Future as value.

An alternative is to throw if the value of a future is another future.
That's what the assert does in checked mode, but we shouldn't be able to hit
an assert.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/1966523003 .
2016-05-11 13:10:46 +02:00
Florian Loitsch 257272fd42 Use internal const-constructor.
BUG= http://dartbug.com/25760
R=lrn@google.com

Review URL: https://codereview.chromium.org/1696453002 .
2016-02-12 20:29:41 +01:00
Todd Turnidge be3acab294 Use Stopwatch instead of DateTime to measure elapsed time in tests.
Improve timer_repeat_test.dart to not totally punt on testing the timing.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1683233003 .
2016-02-10 11:21:40 -08:00
Florian Loitsch 963f653b12 Make generic type of timeout-future the same as the one from the original.
R=lrn@google.com

Review URL: https://codereview.chromium.org//1299443002 .
2016-02-09 18:57:25 +01:00
Lasse R.H. Nielsen 8487d57e48 Add Future.any and Stream.fromFutures.
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1563223002 .
2016-01-08 10:17:34 +01:00
Lasse R.H. Nielsen 5363e5c945 Make dart2js code retain the original stack trace for uncaught async errors.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1383213002 .
2015-11-17 15:17:04 +01:00
Lasse R.H. Nielsen 5009e57524 If computation of Stream.periodic throws, forward the error to the stream.
Fixes issue #24766
BUG= http://dartbug.com/24766
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1415533015.
2015-11-04 10:27:49 +01:00
Florian Schneider eb3186b7bd Fix flaky async test.
Replacing > with >= since finishing in 10 to 11 ms is to be expected.

BUG=dartbug.com/24788
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1415413012 .
2015-11-03 23:30:00 +01:00
Florian Loitsch debf1d6f7c Don't zone-register async callbacks for every await call in the VM.
This has the nice side-effect that the stack_trace package provides nicer chains.
Fixes issue 23394.

R=hausner@google.com

Committed: https://github.com/dart-lang/sdk/commit/4dae43d63727268f2e0cc45d6020246eb49177b8
Reverted: https://github.com/dart-lang/sdk/commit/cb4f9fc925c5a92c6cf756751e38296383f66507

Review URL: https://codereview.chromium.org//1274133002 .
2015-08-17 19:26:50 +02:00
Florian Loitsch cb4f9fc925 Revert "Don't zone-register async callbacks for every await call in the VM."
This reverts commit 4dae43d637.

Review URL: https://codereview.chromium.org//1296973002 .
2015-08-17 16:43:35 +02:00
Florian Loitsch 4dae43d637 Don't zone-register async callbacks for every await call in the VM.
This has the nice side-effect that the stack_trace package provides nicer chains.
Fixes issue 23394.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1274133002 .
2015-08-17 15:58:19 +02:00
Florian Loitsch 410b181e13 The return-value of 'asFuture' isn't necessarily related to the Stream's type.
R=lrn@google.com

Review URL: https://codereview.chromium.org//1295843002 .
2015-08-17 14:44:31 +02:00
Florian Loitsch 00aaf1708d Accept a computation that returns a Future for Future.delayed.
R=lrn@google.com

Review URL: https://codereview.chromium.org//1296623004 .
2015-08-17 11:34:43 +02:00