diff --git a/CHANGELOG.md b/CHANGELOG.md index f698d6a6142..1c2292ceaf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ ### Core libraries +#### `dart:io` + +* [#42006][]: The signature of `exit` has been changed to return the + `Never`type instead of `void`. since no code will run after it, + +[#42006]: https://github.com/dart-lang/sdk/issues/42006 + #### `dart:convert` * **Breaking Change** [#41100][]: When encoding a string containing unpaired diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart index 0504204085f..df163f80857 100644 --- a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart +++ b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart @@ -303,7 +303,7 @@ class _Platform { @patch class _ProcessUtils { @patch - static void _exit(int status) { + static Never _exit(int status) { throw UnsupportedError("ProcessUtils._exit"); } diff --git a/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart b/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart index ff04937477e..2fa2e6f5b31 100644 --- a/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart +++ b/sdk_nnbd/lib/_internal/js_runtime/lib/io_patch.dart @@ -303,7 +303,7 @@ class _Platform { @patch class _ProcessUtils { @patch - static void _exit(int status) { + static Never _exit(int status) { throw new UnsupportedError("ProcessUtils._exit"); } diff --git a/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart b/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart index 16e866ceb47..bb86a0d9647 100644 --- a/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart +++ b/sdk_nnbd/lib/_internal/vm/bin/process_patch.dart @@ -135,7 +135,7 @@ Function _getWatchSignalInternal() => _ProcessUtils._watchSignalInternal; @patch class _ProcessUtils { @patch - static void _exit(int status) native "Process_Exit"; + static Never _exit(int status) native "Process_Exit"; @patch static void _setExitCode(int status) native "Process_SetExitCode"; @patch diff --git a/sdk_nnbd/lib/io/process.dart b/sdk_nnbd/lib/io/process.dart index 9b2884f2548..e15ba58d3df 100644 --- a/sdk_nnbd/lib/io/process.dart +++ b/sdk_nnbd/lib/io/process.dart @@ -7,7 +7,7 @@ part of dart.io; // TODO(ager): The only reason for this class is that we // cannot patch a top-level at this point. class _ProcessUtils { - external static void _exit(int status); + external static Never _exit(int status); external static void _setExitCode(int status); external static int _getExitCode(); external static void _sleep(int millis); @@ -49,7 +49,7 @@ class _ProcessUtils { * program to the surrounding environment. This will avoid any * cross-platform issues. */ -void exit(int code) { +Never exit(int code) { ArgumentError.checkNotNull(code, "code"); if (!_EmbedderConfig._mayExit) { throw new UnsupportedError(