Remove references to the deprecated CastError. (#118)
diff --git a/lib/src/delegate/event_sink.dart b/lib/src/delegate/event_sink.dart
index 33d88e9..c011af5 100644
--- a/lib/src/delegate/event_sink.dart
+++ b/lib/src/delegate/event_sink.dart
@@ -20,7 +20,7 @@
///
/// Unlike [new DelegatingEventSink], this only requires its argument to be an
/// instance of `EventSink`, not `EventSink<T>`. This means that calls to
- /// [add] may throw a [CastError] if the argument type doesn't match the
+ /// [add] may throw a [TypeError] if the argument type doesn't match the
/// reified type of [sink].
@Deprecated(
'Use StreamController<T>(sync: true)..stream.cast<S>().pipe(sink)')
diff --git a/lib/src/delegate/future.dart b/lib/src/delegate/future.dart
index 1155452..2179de6 100644
--- a/lib/src/delegate/future.dart
+++ b/lib/src/delegate/future.dart
@@ -16,7 +16,7 @@
///
/// This soundly converts a [Future] to a `Future<T>`, regardless of its
/// original generic type, by asserting that its value is an instance of `T`
- /// whenever it's provided. If it's not, the future throws a [CastError].
+ /// whenever it's provided. If it's not, the future throws a [TypeError].
@Deprecated('Use future.then((v) => v as T) instead.')
static Future<T> typed<T>(Future future) =>
future is Future<T> ? future : future.then((v) => v as T);
diff --git a/lib/src/delegate/sink.dart b/lib/src/delegate/sink.dart
index 57ef2a0..e0b03c5 100644
--- a/lib/src/delegate/sink.dart
+++ b/lib/src/delegate/sink.dart
@@ -18,7 +18,7 @@
///
/// Unlike [new DelegatingSink], this only requires its argument to be an
/// instance of `Sink`, not `Sink<T>`. This means that calls to [add] may
- /// throw a [CastError] if the argument type doesn't match the reified type of
+ /// throw a [TypeError] if the argument type doesn't match the reified type of
/// [sink].
@Deprecated(
'Use StreamController<T>(sync: true)..stream.cast<S>().pipe(sink)')
diff --git a/lib/src/delegate/stream.dart b/lib/src/delegate/stream.dart
index 1585eab..6c2031a 100644
--- a/lib/src/delegate/stream.dart
+++ b/lib/src/delegate/stream.dart
@@ -20,7 +20,7 @@
/// This soundly converts a [Stream] to a `Stream<T>`, regardless of its
/// original generic type, by asserting that its events are instances of `T`
/// whenever they're provided. If they're not, the stream throws a
- /// [CastError].
+ /// [TypeError].
@Deprecated('Use stream.cast instead')
static Stream<T> typed<T>(Stream stream) => stream.cast();
}
diff --git a/lib/src/delegate/stream_consumer.dart b/lib/src/delegate/stream_consumer.dart
index 6b92006..0dad5ff 100644
--- a/lib/src/delegate/stream_consumer.dart
+++ b/lib/src/delegate/stream_consumer.dart
@@ -20,7 +20,7 @@
///
/// Unlike [new StreamConsumer], this only requires its argument to be an
/// instance of `StreamConsumer`, not `StreamConsumer<T>`. This means that
- /// calls to [addStream] may throw a [CastError] if the argument type doesn't
+ /// calls to [addStream] may throw a [TypeError] if the argument type doesn't
/// match the reified type of [consumer].
@Deprecated(
'Use StreamController<T>(sync: true)..stream.cast<S>().pipe(sink)')
diff --git a/lib/src/delegate/stream_sink.dart b/lib/src/delegate/stream_sink.dart
index ad76e90..f18d501 100644
--- a/lib/src/delegate/stream_sink.dart
+++ b/lib/src/delegate/stream_sink.dart
@@ -23,7 +23,7 @@
///
/// Unlike [new StreamSink], this only requires its argument to be an instance
/// of `StreamSink`, not `StreamSink<T>`. This means that calls to [add] may
- /// throw a [CastError] if the argument type doesn't match the reified type of
+ /// throw a [TypeError] if the argument type doesn't match the reified type of
/// [sink].
@Deprecated(
'Use StreamController<T>(sync: true)..stream.cast<S>().pipe(sink)')
diff --git a/lib/src/delegate/stream_subscription.dart b/lib/src/delegate/stream_subscription.dart
index 45b1134..581404a 100644
--- a/lib/src/delegate/stream_subscription.dart
+++ b/lib/src/delegate/stream_subscription.dart
@@ -22,7 +22,7 @@
/// This soundly converts a [StreamSubscription] to a `StreamSubscription<T>`,
/// regardless of its original generic type, by asserting that its events are
/// instances of `T` whenever they're provided. If they're not, the
- /// subscription throws a [CastError].
+ /// subscription throws a [TypeError].
@Deprecated('Use Stream.cast instead')
// TODO - Remove `TypeSafeStreamSubscription` and tests when removing this.
static StreamSubscription<T> typed<T>(StreamSubscription subscription) =>
diff --git a/lib/src/stream_sink_transformer.dart b/lib/src/stream_sink_transformer.dart
index bdcb196..de48d39 100644
--- a/lib/src/stream_sink_transformer.dart
+++ b/lib/src/stream_sink_transformer.dart
@@ -51,7 +51,7 @@
/// This soundly converts a [StreamSinkTransformer] to a
/// `StreamSinkTransformer<S, T>`, regardless of its original generic type.
/// This means that calls to [StreamSink.add] on the returned sink may throw a
- /// [CastError] if the argument type doesn't match the reified type of the
+ /// [TypeError] if the argument type doesn't match the reified type of the
/// sink.
@deprecated
// TODO remove TypeSafeStreamSinkTransformer
diff --git a/lib/src/typed_stream_transformer.dart b/lib/src/typed_stream_transformer.dart
index c1af93f..8a39228 100644
--- a/lib/src/typed_stream_transformer.dart
+++ b/lib/src/typed_stream_transformer.dart
@@ -9,7 +9,7 @@
/// This soundly converts a [StreamTransformer] to a `StreamTransformer<S, T>`,
/// regardless of its original generic type, by asserting that the events
/// emitted by the transformed stream are instances of `T` whenever they're
-/// provided. If they're not, the stream throws a [CastError].
+/// provided. If they're not, the stream throws a [TypeError].
@Deprecated('Use Stream.cast after binding a transformer instead')
StreamTransformer<S, T> typedStreamTransformer<S, T>(
StreamTransformer transformer) =>
diff --git a/test/typed_wrapper/stream_subscription_test.dart b/test/typed_wrapper/stream_subscription_test.dart
index 33d28a8..74195ba 100644
--- a/test/typed_wrapper/stream_subscription_test.dart
+++ b/test/typed_wrapper/stream_subscription_test.dart
@@ -79,7 +79,7 @@
wrapper = TypeSafeStreamSubscription<int>(controller.stream.listen(null));
});
- group('throws a CastError for', () {
+ group('throws a TypeError for', () {
test('onData()', () {
expect(() {
// TODO(nweiz): Use the wrapper declared in setUp when sdk#26226 is
@@ -90,11 +90,11 @@
wrapper.onData(expectAsync1((_) {}, count: 0));
controller.add('foo');
- }, throwsZonedCastError);
+ }, throwsZonedTypeError);
});
});
- group("doesn't throw a CastError for", () {
+ group("doesn't throw a TypeError for", () {
test('onError()', () {
wrapper.onError(expectAsync1((error) {
expect(error, equals('oh no'));
diff --git a/test/utils.dart b/test/utils.dart
index 4cc743e..2ddecc4 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -38,10 +38,10 @@
/// A matcher that runs a callback in its own zone and asserts that that zone
/// emits a [TypeError].
-final throwsZonedCastError = throwsZoned(TypeMatcher<TypeError>());
+final throwsZonedTypeError = throwsZoned(TypeMatcher<TypeError>());
/// A matcher that matches a callback or future that throws a [TypeError].
-final throwsCastError = throwsA(TypeMatcher<TypeError>());
+final throwsTypeError = throwsA(TypeMatcher<TypeError>());
/// A badly behaved stream which throws if it's ever listened to.
///