mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:53:55 +00:00
[expect] Replace @alwaysThrows with Never
Actually, for `Expect.fail`, the return type is kept as `void`, as changing this to `Never` would apparently change a lot of static analysis of language and co19 tests. It seems the `@alwaysThrows` annotation is no longer (or was never) relied upon for static analysis (usually around dead code analysis). Bug: https://github.com/dart-lang/sdk/issues/49583 Change-Id: I6d9daaa1d290ab0322a529faaf9574fe83b9cd25 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279742 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
parent
6fa2f50380
commit
d5bd015cac
|
@ -6,8 +6,6 @@
|
|||
/// for simple unit-tests.
|
||||
library expect;
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
/// Whether the program is running without sound null safety.
|
||||
bool get hasUnsoundNullSafety => const <Null>[] is List<Object>;
|
||||
|
||||
|
@ -275,7 +273,9 @@ class Expect {
|
|||
}
|
||||
|
||||
// Unconditional failure.
|
||||
@alwaysThrows
|
||||
// This function always throws, as [_fail] always throws.
|
||||
// TODO(srawlins): It would be more correct to change the return type to
|
||||
// `Never`, which would require refactoring many language and co19 tests.
|
||||
static void fail(String msg) {
|
||||
_fail("Expect.fail('$msg')");
|
||||
}
|
||||
|
@ -693,7 +693,6 @@ class Expect {
|
|||
static String _getMessage(String reason) =>
|
||||
(reason.isEmpty) ? "" : ", '$reason'";
|
||||
|
||||
@alwaysThrows
|
||||
static Never _fail(String message) {
|
||||
throw ExpectException(message);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ environment:
|
|||
|
||||
# Use 'any' constraints here; we get our versions from the DEPS file.
|
||||
dependencies:
|
||||
meta: any
|
||||
smith: any
|
||||
|
||||
# Use 'any' constraints here; we get our versions from the DEPS file.
|
||||
|
|
Loading…
Reference in a new issue