File tree 4 files changed +6
-25
lines changed 4 files changed +6
-25
lines changed Original file line number Diff line number Diff line change @@ -195,11 +195,7 @@ class _AsyncAwaitCompleter<T> implements Completer<T> {
195
195
assert (! _future._isComplete);
196
196
_future._chainFuture (value);
197
197
} else {
198
- // TODO(40014): Remove cast when type promotion works.
199
- // This would normally be `as T` but we use `as dynamic` to make the
200
- // unneeded check be implicit to match dart2js unsound optimizations in
201
- // the user code.
202
- _future._completeWithValue (value as dynamic );
198
+ _future._completeWithValue (value);
203
199
}
204
200
}
205
201
Original file line number Diff line number Diff line change @@ -303,12 +303,7 @@ abstract interface class Future<T> {
303
303
factory Future .sync (FutureOr <T > computation ()) {
304
304
try {
305
305
var result = computation ();
306
- if (result is Future <T >) {
307
- return result;
308
- } else {
309
- // TODO(40014): Remove cast when type promotion works.
310
- return new _Future <T >.value (result as dynamic );
311
- }
306
+ return result is Future <T > ? result : _Future <T >.value (result);
312
307
} catch (error, stackTrace) {
313
308
var future = new _Future <T >();
314
309
AsyncError ? replacement = Zone .current.errorCallback (error, stackTrace);
@@ -713,8 +708,7 @@ abstract interface class Future<T> {
713
708
result.then (nextIteration, onError: doneSignal._completeError);
714
709
return ;
715
710
}
716
- // TODO(40014): Remove cast when type promotion works.
717
- keepGoing = result as bool ;
711
+ keepGoing = result;
718
712
}
719
713
doneSignal._complete (null );
720
714
});
Original file line number Diff line number Diff line change @@ -630,11 +630,7 @@ class _Future<T> implements Future<T> {
630
630
}
631
631
} else {
632
632
_FutureListener ? listeners = _removeListeners ();
633
- // TODO(40014): Remove cast when type promotion works.
634
- // This would normally be `as T` but we use `as dynamic` to make the
635
- // unneeded check be implicit to match dart2js unsound optimizations in
636
- // the user code.
637
- _setValue (value as dynamic ); // Value promoted to T.
633
+ _setValue (value);
638
634
_propagateToListeners (this , listeners);
639
635
}
640
636
}
@@ -673,11 +669,7 @@ class _Future<T> implements Future<T> {
673
669
_chainFuture (value);
674
670
return ;
675
671
}
676
- // TODO(40014): Remove cast when type promotion works.
677
- // This would normally be `as T` but we use `as dynamic` to make the
678
- // unneeded check be implicit to match dart2js unsound optimizations in the
679
- // user code.
680
- _asyncCompleteWithValue (value as dynamic ); // Value promoted to T.
672
+ _asyncCompleteWithValue (value);
681
673
}
682
674
683
675
/// Internal helper function used by the implementation of `async` functions.
Original file line number Diff line number Diff line change @@ -810,8 +810,7 @@ abstract mixin class Stream<T> {
810
810
subscription.pause ();
811
811
newValue.then (add, onError: addError).whenComplete (resume);
812
812
} else {
813
- // TODO(40014): Remove cast when type promotion works.
814
- controller.add (newValue as dynamic );
813
+ controller.add (newValue);
815
814
}
816
815
});
817
816
controller.onCancel = subscription.cancel;
You can’t perform that action at this time.
0 commit comments