mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
ef8cc2c1cf
As per planned breaking change to let platforms decide how they and what throw for late initiaization errors, we no longer need a public `LateInitializationError` class. It's confusing to have one if some platforms throw something else instead. Removes the public abstract class. The dart:_internal implementation class `LateError` no longer implements it. This is the only implementation of the public interface, and the class which platforms either throw directly, or through front-end lowering of the feature. Remove mentions in tests. All tests now just expect `Error`, some platform specific tests might test the message. TEST=rewrote tests referring to LateInitializationError. Change-Id: I54344a67f89ce101ed770412db134e12354cdcc4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174928 Commit-Queue: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Nate Bosch <nbosch@google.com>
32 lines
1.2 KiB
Dart
32 lines
1.2 KiB
Dart
// 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.
|
|
|
|
/// Tests that an exception on a non-socket _NativeSocket, e.g. a pipe to
|
|
/// another process, is properly thrown as a SocketException. This test confirms
|
|
/// the absence of a regression during the dart:io null safety migration where
|
|
/// the late localAddress field wasn't initialized in an error path, raising a
|
|
/// late initialization error instead.
|
|
///
|
|
/// https://github.com/flutter/flutter/issues/57125
|
|
|
|
import 'dart:io';
|
|
|
|
Future<void> main() async {
|
|
final process = await Process.start("exit", [], runInShell: true);
|
|
process.stdout.drain();
|
|
process.stderr.drain();
|
|
bool finished = false;
|
|
// Ensure any other exception is unhandled and fails the test.
|
|
process.stdin.done.catchError((e) {
|
|
finished = true;
|
|
}, test: (e) => e is SocketException);
|
|
while (!finished) {
|
|
process.stdin.write("a");
|
|
await Future.delayed(new Duration(microseconds: 1));
|
|
}
|
|
process.stdin.close();
|
|
await process.exitCode;
|
|
// Windows hangs for some reason.
|
|
exit(0);
|
|
}
|