Revert "Fail synchronously if null is passed as an error to async APIs."

This reverts commit bef363bfb7d6364ddbaabd691c0fdc963cff8cc6.

Reason for revert: Breaks google3 tests, see b/151204525.

Original change's description:
> Fail synchronously if null is passed as an error to async APIs.
> 
> The first patchset is Lasse's original changes.
> 
> Change-Id: Ic5f24bcfc0ef4e82edee68d61e015b095cb5916e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138605
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=leafp@google.com,rnystrom@google.com

Change-Id: Ie17c35e9d23c70a7aecd1ef292962154cf6f007d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138925
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
diff --git a/sdk/lib/_http/websocket_impl.dart b/sdk/lib/_http/websocket_impl.dart
index ce015bb..35ee68b 100644
--- a/sdk/lib/_http/websocket_impl.dart
+++ b/sdk/lib/_http/websocket_impl.dart
@@ -115,7 +115,6 @@
   }
 
   void addError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
     _eventSink.addError(error, stackTrace);
   }
 
@@ -724,7 +723,6 @@
   }
 
   void addError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
     _eventSink.addError(error, stackTrace);
   }
 
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart
index 6dd9546..ef0a652 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart
@@ -419,7 +419,6 @@
   }
 
   void addError(Object error, StackTrace stackTrace) {
-    ArgumentError.checkNotNull(error, "error");
     if (cancellationCompleter != null && !cancellationCompleter.isCompleted) {
       // If the stream has been cancelled, complete the cancellation future
       // with the error.
diff --git a/sdk/lib/_internal/vm/lib/async_patch.dart b/sdk/lib/_internal/vm/lib/async_patch.dart
index 85de9dc..0192bfe 100644
--- a/sdk/lib/_internal/vm/lib/async_patch.dart
+++ b/sdk/lib/_internal/vm/lib/async_patch.dart
@@ -209,7 +209,6 @@
   }
 
   void addError(Object error, StackTrace stackTrace) {
-    ArgumentError.checkNotNull(error, "error");
     if ((cancellationFuture != null) && cancellationFuture._mayComplete) {
       // If the stream has been cancelled, complete the cancellation future
       // with the error.
diff --git a/sdk/lib/async/broadcast_stream_controller.dart b/sdk/lib/async/broadcast_stream_controller.dart
index 09ab783..c18a682 100644
--- a/sdk/lib/async/broadcast_stream_controller.dart
+++ b/sdk/lib/async/broadcast_stream_controller.dart
@@ -253,7 +253,7 @@
   }
 
   void addError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
+    error = _nonNullError(error);
     if (!_mayAddEvent) throw _addEventError();
     AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
     if (replacement != null) {
@@ -480,7 +480,6 @@
   }
 
   void addError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
     if (!isClosed && _isFiring) {
       _addPendingEvent(new _DelayedError(error, stackTrace));
       return;
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index ac6f2ba..7aeee47 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -266,12 +266,12 @@
    * If an error handler isn't added before the future completes, the error
    * will be considered unhandled.
    *
-   * The [error] must not be `null`.
+   * If [error] is `null`, it is replaced by a [NullThrownError].
    *
    * Use [Completer] to create a future and complete it later.
    */
   factory Future.error(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
+    error = _nonNullError(error);
     if (!identical(Zone.current, _rootZone)) {
       AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
       if (replacement != null) {
@@ -874,7 +874,7 @@
    * Completing a future with an error indicates that an exception was thrown
    * while trying to produce a value.
    *
-   * The [error] must not be `null`.
+   * If [error] is `null`, it is replaced by a [NullThrownError].
    *
    * If `error` is a `Future`, the future itself is used as the error value.
    * If you want to complete with the result of the future, you can use:
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index e2b548b..4481da5 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -19,7 +19,7 @@
   void complete([FutureOr<T> value]);
 
   void completeError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
+    error = _nonNullError(error);
     if (!future._mayComplete) throw new StateError("Future already completed");
     AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
     if (replacement != null) {
@@ -94,8 +94,8 @@
       this.result, _FutureOnValue<S, T> onValue, Function errorCallback)
       : callback = onValue,
         errorCallback = errorCallback,
-        state = ((errorCallback == null) ? stateThen : stateThenOnerror) |
-            stateIsAwait;
+        state = ((errorCallback == null) ? stateThen : stateThenOnerror)
+              | stateIsAwait ;
 
   _FutureListener.catchError(this.result, this.errorCallback, this.callback)
       : state = (callback == null) ? stateCatcherror : stateCatcherrorTest;
@@ -293,7 +293,8 @@
   /// The system created liseners are not registered in the zone,
   /// and the listener is marked as being from an `await`.
   /// This marker is used in [_continuationFunctions].
-  Future<E> _thenAwait<E>(FutureOr<E> f(T value), Function onError) {
+  Future<E> _thenAwait<E>(
+      FutureOr<E> f(T value), Function onError) {
     _Future<E> result = new _Future<E>();
     _addListener(new _FutureListener<T, E>.thenAwait(result, f, onError));
     return result;
@@ -811,5 +812,5 @@
       errorHandler,
       "onError",
       "Error handler must accept one Object or one Object and a StackTrace"
-          " as arguments, and return a a valid result");
+      " as arguments, and return a a valid result");
 }
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 794282a..ed95a05 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -132,7 +132,6 @@
    *
    * This stream emits a single error event of [error] and [stackTrace]
    * and then completes with a done event.
-   * The [error] must not be `null`.
    *
    * Example:
    * ```dart
@@ -153,13 +152,11 @@
    * stack trace as well.
    */
   @Since("2.5")
-  factory Stream.error(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
-    return (_AsyncStreamController<T>(null, null, null, null)
-          .._addError(error, stackTrace)
-          .._closeUnchecked())
-        .stream;
-  }
+  factory Stream.error(Object error, [StackTrace stackTrace]) =>
+      (_AsyncStreamController<T>(null, null, null, null)
+            .._addError(error, stackTrace)
+            .._closeUnchecked())
+          .stream;
 
   /**
    * Creates a new single-subscription stream from the future.
@@ -1814,8 +1811,6 @@
   /**
    * Adds an [error] to the sink.
    *
-   * The [error] must not be `null`.
-   *
    * Must not be called on a closed sink.
    */
   void addError(Object error, [StackTrace stackTrace]);
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index b54ddac..50e9aa3 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -237,7 +237,7 @@
   /**
    * Sends or enqueues an error event.
    *
-   * The [error] must not be `null`.
+   * If [error] is `null`, it is replaced by a [NullThrownError].
    *
    * Listeners receive this event at a later microtask. This behavior can be
    * overridden by using `sync` controllers. Note, however, that sync
@@ -361,8 +361,6 @@
   /**
    * Adds error to the controller's stream.
    *
-   * The [error] must not be `null`.
-   *
    * As [StreamController.addError], but must not be called while an event is
    * being added by [add], [addError] or [close].
    */
@@ -599,11 +597,8 @@
 
   /**
    * Send or enqueue an error event.
-   *
-   * The [error] must not be `null`.
    */
   void addError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
     if (!_mayAddEvent) throw _badEventState();
     error = _nonNullError(error);
     AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
diff --git a/sdk/lib/async/stream_transformers.dart b/sdk/lib/async/stream_transformers.dart
index 41c963f..7cba3ba 100644
--- a/sdk/lib/async/stream_transformers.dart
+++ b/sdk/lib/async/stream_transformers.dart
@@ -234,7 +234,6 @@
   }
 
   void addError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
     if (_isClosed) {
       throw StateError("Sink is closed");
     }
diff --git a/sdk/lib/async/zone.dart b/sdk/lib/async/zone.dart
index 83c0a80..d8f8596 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -43,9 +43,7 @@
   final Object error;
   final StackTrace stackTrace;
 
-  AsyncError(this.error, this.stackTrace) {
-    ArgumentError.checkNotNull(error, "error");
-  }
+  AsyncError(this.error, this.stackTrace);
 
   String toString() => '$error';
 }
@@ -752,7 +750,6 @@
   }
 
   AsyncError errorCallback(Zone zone, Object error, StackTrace stackTrace) {
-    ArgumentError.checkNotNull(error, "error");
     var implementation = _delegationTarget._errorCallback;
     _Zone implZone = implementation.zone;
     if (identical(implZone, _rootZone)) return null;
@@ -1068,7 +1065,6 @@
   }
 
   AsyncError errorCallback(Object error, StackTrace stackTrace) {
-    ArgumentError.checkNotNull(error, "error");
     var implementation = this._errorCallback;
     assert(implementation != null);
     final Zone implementationZone = implementation.zone;
@@ -1113,11 +1109,8 @@
 
 void _rootHandleUncaughtError(
     Zone self, ZoneDelegate parent, Zone zone, error, StackTrace stackTrace) {
-  if (error == null) {
-    error = ArgumentError.notNull("error");
-    stackTrace = StackTrace.current;
-  }
   _schedulePriorityAsyncCallback(() {
+    error ??= new NullThrownError();
     if (stackTrace == null) throw error;
     _rethrow(error, stackTrace);
   });
diff --git a/sdk/lib/convert/chunked_conversion.dart b/sdk/lib/convert/chunked_conversion.dart
index 3b67c3a..7253981 100644
--- a/sdk/lib/convert/chunked_conversion.dart
+++ b/sdk/lib/convert/chunked_conversion.dart
@@ -75,7 +75,6 @@
   }
 
   void addError(Object error, [StackTrace stackTrace]) {
-    ArgumentError.checkNotNull(error, "error");
     _eventSink.addError(error, stackTrace);
   }
 
diff --git a/sdk_nnbd/lib/_http/websocket_impl.dart b/sdk_nnbd/lib/_http/websocket_impl.dart
index 64eb1eb..4afba79 100644
--- a/sdk_nnbd/lib/_http/websocket_impl.dart
+++ b/sdk_nnbd/lib/_http/websocket_impl.dart
@@ -113,8 +113,6 @@
   }
 
   void addError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     _eventSink!.addError(error, stackTrace);
   }
 
@@ -724,8 +722,6 @@
   }
 
   void addError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     _eventSink!.addError(error, stackTrace);
   }
 
@@ -1220,7 +1216,6 @@
   }
 
   void addUtf8Text(List<int> bytes) {
-    // TODO(40614): Remove once non-nullability is sound.
     ArgumentError.checkNotNull(bytes, "bytes");
     _sink.add(new _EncodedString(bytes));
   }
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart
index dbba91e..78ba91b 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart
@@ -417,7 +417,6 @@
   }
 
   void addError(Object error, StackTrace stackTrace) {
-    ArgumentError.checkNotNull(error, "error");
     var completer = cancellationCompleter;
     if (completer != null && !completer.isCompleted) {
       // If the stream has been cancelled, complete the cancellation future
diff --git a/sdk_nnbd/lib/_internal/vm/lib/async_patch.dart b/sdk_nnbd/lib/_internal/vm/lib/async_patch.dart
index 9e180a2..b2b57d7 100644
--- a/sdk_nnbd/lib/_internal/vm/lib/async_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/lib/async_patch.dart
@@ -214,8 +214,6 @@
   }
 
   void addError(Object error, StackTrace stackTrace) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     final future = cancellationFuture;
     if ((future != null) && future._mayComplete) {
       // If the stream has been cancelled, complete the cancellation future
diff --git a/sdk_nnbd/lib/async/broadcast_stream_controller.dart b/sdk_nnbd/lib/async/broadcast_stream_controller.dart
index 9a80aab..ec0bae3 100644
--- a/sdk_nnbd/lib/async/broadcast_stream_controller.dart
+++ b/sdk_nnbd/lib/async/broadcast_stream_controller.dart
@@ -248,8 +248,6 @@
   }
 
   void addError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     if (!_mayAddEvent) throw _addEventError();
     AsyncError? replacement = Zone.current.errorCallback(error, stackTrace);
     if (replacement != null) {
@@ -478,8 +476,6 @@
   }
 
   void addError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     if (!isClosed && _isFiring) {
       _addPendingEvent(new _DelayedError(error, stackTrace));
       return;
diff --git a/sdk_nnbd/lib/async/future.dart b/sdk_nnbd/lib/async/future.dart
index 79e9ee6..a489a6a 100644
--- a/sdk_nnbd/lib/async/future.dart
+++ b/sdk_nnbd/lib/async/future.dart
@@ -269,11 +269,11 @@
    * If an error handler isn't added before the future completes, the error
    * will be considered unhandled.
    *
+   * If [error] is `null`, it is replaced by a [NullThrownError].
+   *
    * Use [Completer] to create a future and complete it later.
    */
   factory Future.error(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     if (!identical(Zone.current, _rootZone)) {
       AsyncError? replacement = Zone.current.errorCallback(error, stackTrace);
       if (replacement != null) {
diff --git a/sdk_nnbd/lib/async/future_impl.dart b/sdk_nnbd/lib/async/future_impl.dart
index e469175..c012e53 100644
--- a/sdk_nnbd/lib/async/future_impl.dart
+++ b/sdk_nnbd/lib/async/future_impl.dart
@@ -17,8 +17,6 @@
   void complete([FutureOr<T>? value]);
 
   void completeError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     if (!future._mayComplete) throw new StateError("Future already completed");
     AsyncError? replacement = Zone.current.errorCallback(error, stackTrace);
     if (replacement != null) {
diff --git a/sdk_nnbd/lib/async/stream.dart b/sdk_nnbd/lib/async/stream.dart
index c83b77b..3969f20 100644
--- a/sdk_nnbd/lib/async/stream.dart
+++ b/sdk_nnbd/lib/async/stream.dart
@@ -150,14 +150,11 @@
    * stack trace as well.
    */
   @Since("2.5")
-  factory Stream.error(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
-    return (_AsyncStreamController<T>(null, null, null, null)
-          .._addError(error, stackTrace)
-          .._closeUnchecked())
-        .stream;
-  }
+  factory Stream.error(Object error, [StackTrace? stackTrace]) =>
+      (_AsyncStreamController<T>(null, null, null, null)
+            .._addError(error, stackTrace)
+            .._closeUnchecked())
+          .stream;
 
   /**
    * Creates a new single-subscription stream from the future.
diff --git a/sdk_nnbd/lib/async/stream_controller.dart b/sdk_nnbd/lib/async/stream_controller.dart
index 3f3f461..31fc5c3 100644
--- a/sdk_nnbd/lib/async/stream_controller.dart
+++ b/sdk_nnbd/lib/async/stream_controller.dart
@@ -600,8 +600,6 @@
    * Send or enqueue an error event.
    */
   void addError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     if (!_mayAddEvent) throw _badEventState();
     AsyncError? replacement = Zone.current.errorCallback(error, stackTrace);
     if (replacement != null) {
diff --git a/sdk_nnbd/lib/async/stream_transformers.dart b/sdk_nnbd/lib/async/stream_transformers.dart
index b445d66..3e332b4 100644
--- a/sdk_nnbd/lib/async/stream_transformers.dart
+++ b/sdk_nnbd/lib/async/stream_transformers.dart
@@ -229,8 +229,6 @@
   }
 
   void addError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     var sink = _sink;
     if (sink == null) {
       throw StateError("Sink is closed");
diff --git a/sdk_nnbd/lib/async/zone.dart b/sdk_nnbd/lib/async/zone.dart
index 2fc47b8..31644f2 100644
--- a/sdk_nnbd/lib/async/zone.dart
+++ b/sdk_nnbd/lib/async/zone.dart
@@ -41,10 +41,7 @@
   final Object error;
   final StackTrace? stackTrace;
 
-  AsyncError(this.error, this.stackTrace) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
-  }
+  AsyncError(this.error, this.stackTrace);
 
   String toString() => '$error';
 }
@@ -745,8 +742,6 @@
   }
 
   AsyncError? errorCallback(Zone zone, Object error, StackTrace? stackTrace) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     var implementation = _delegationTarget._errorCallback;
     _Zone implZone = implementation.zone;
     if (identical(implZone, _rootZone)) return null;
@@ -1080,8 +1075,6 @@
   }
 
   AsyncError? errorCallback(Object error, StackTrace? stackTrace) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     var implementation = this._errorCallback;
     final _Zone implementationZone = implementation.zone;
     if (identical(implementationZone, _rootZone)) return null;
diff --git a/sdk_nnbd/lib/convert/chunked_conversion.dart b/sdk_nnbd/lib/convert/chunked_conversion.dart
index d2c24f0..654c9d2 100644
--- a/sdk_nnbd/lib/convert/chunked_conversion.dart
+++ b/sdk_nnbd/lib/convert/chunked_conversion.dart
@@ -73,8 +73,6 @@
   }
 
   void addError(Object error, [StackTrace? stackTrace]) {
-    // TODO(40614): Remove once non-nullability is sound.
-    ArgumentError.checkNotNull(error, "error");
     _eventSink.addError(error, stackTrace);
   }
 
diff --git a/tests/lib_2/async/future_error_test.dart b/tests/lib_2/async/future_error_test.dart
deleted file mode 100644
index 3ef0eb3..0000000
--- a/tests/lib_2/async/future_error_test.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
-import 'package:expect/expect.dart';
-
-main() {
-  // The error cannot be null.
-  Expect.throwsArgumentError(() {
-    Future.error(null);
-  });
-}
diff --git a/tests/lib_2/async/future_test.dart b/tests/lib_2/async/future_test.dart
index 3a4f09d..9223646 100644
--- a/tests/lib_2/async/future_test.dart
+++ b/tests/lib_2/async/future_test.dart
@@ -697,10 +697,13 @@
 }
 
 void testCompleteErrorWithNull() {
+  asyncStart();
   final completer = new Completer<int>();
-  Expect.throwsArgumentError(() {
-    completer.completeError(null);
+  completer.future.catchError((e) {
+    Expect.isTrue(e is NullThrownError);
+    asyncEnd();
   });
+  completer.completeError(null);
 }
 
 void testChainedFutureValue() {
diff --git a/tests/lib_2/async/stream_controller_add_error_test.dart b/tests/lib_2/async/stream_controller_add_error_test.dart
deleted file mode 100644
index aed39e8..0000000
--- a/tests/lib_2/async/stream_controller_add_error_test.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
-import 'package:expect/expect.dart';
-
-main() {
-  // Single-cast async.
-  var controller = StreamController();
-  Expect.throwsArgumentError(() {
-    controller.addError(null);
-  });
-
-  Expect.throwsArgumentError(() {
-    controller.sink.addError(null);
-  });
-
-  // Single-cast sync.
-  controller = StreamController(sync: true);
-  Expect.throwsArgumentError(() {
-    controller.addError(null);
-  });
-
-  Expect.throwsArgumentError(() {
-    controller.sink.addError(null);
-  });
-
-  // Broadcast async.
-  controller = StreamController.broadcast();
-  Expect.throwsArgumentError(() {
-    controller.addError(null);
-  });
-
-  Expect.throwsArgumentError(() {
-    controller.sink.addError(null);
-  });
-
-  // Broadcast sync.
-  controller = StreamController.broadcast(sync: true);
-  Expect.throwsArgumentError(() {
-    controller.addError(null);
-  });
-
-  Expect.throwsArgumentError(() {
-    controller.sink.addError(null);
-  });
-}
diff --git a/tests/lib_2/async/stream_error_test.dart b/tests/lib_2/async/stream_error_test.dart
index 22b091b..11f6a93 100644
--- a/tests/lib_2/async/stream_error_test.dart
+++ b/tests/lib_2/async/stream_error_test.dart
@@ -72,11 +72,6 @@
     await onDone.future;
   }
 
-  // A null error argument is a synchronous error.
-  Expect.throwsArgumentError(() {
-    Stream.error(null);
-  });
-
   asyncEnd();
 }
 
diff --git a/tests/lib_2/async/zone_async_error_test.dart b/tests/lib_2/async/zone_async_error_test.dart
deleted file mode 100644
index b1f67ce..0000000
--- a/tests/lib_2/async/zone_async_error_test.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
-import 'package:expect/expect.dart';
-
-main() {
-  // The error cannot be null.
-  Expect.throwsArgumentError(() {
-    AsyncError(null, StackTrace.current);
-  });
-}