-
Notifications
You must be signed in to change notification settings - Fork 50
Conversation
Some clean-ups and simplifications of the code. Should not change any behavior, but differences in future chaining can potentially change timing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Looks like a big improvement
Filed an issue for one of the diagnostics that is showing up: dart-lang/sdk#58677 I'm a little unsure whether the choice to change the |
I'll roll back the visible type changes, just to be sure. |
This change may have broken some tests. I'm going to dig a bit and see if I can figure out why. |
Here is a small repro case that shows the difference in behavior. This test passes before this PR and fails after. test('canceled operation does not call .then callback', () async {
var completer = Completer<void>();
var hasInvokedThen = false;
var operation = CancelableOperation.fromFuture(completer.future).then((_) {
hasInvokedThen = true;
});
operation.cancel();
completer.complete();
await pumpEventQueue();
expect(hasInvokedThen, false);
}); |
} | ||
if (!isCanceled) { | ||
value | ||
.then(onValue, onError: onError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what is causing a few tests to fail. Before the onValue
would not be called if the returned operation is canceled, but now it only matters whether this operation is canceled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll fix that.
* Clean up `CancelableOperation`. Some clean-ups and simplifications of the code. Should not change any behavior, but differences in future chaining can potentially change timing. But don't change `Future` to `Future<void>` today.
Some clean-ups and simplifications of the code.
Should not change any behavior, but differences in future chaining
can potentially change timing.