[3.0 alpha][test] Remove use of NullThrownError

Change-Id: Ia28b44a9acdcb9a38ebb101029dc50b58d272b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275786
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Nicholas Shahan 2022-12-15 23:33:18 +00:00 committed by Commit Queue
parent 6d05f249ff
commit d0d2e2591f
3 changed files with 9 additions and 9 deletions

View file

@ -34,7 +34,7 @@ void testValue(var o) {
try {
throw o;
} on List<String> catch (e) {
} on NullThrownError catch (e) {
} on TypeError catch (e) {
} on Unresolved9 catch (e) {
} catch (e) {
}
@ -42,7 +42,7 @@ void testValue(var o) {
try {
throw o;
} on List<Unresolved10> catch (e) {
} on NullThrownError catch (e) {
} on TypeError catch (e) {
} on Unresolved11 catch (e) {
} catch (e) {
}

View file

@ -18,11 +18,11 @@ main() async {
// `throw a!` means `throw (a!)`, not `(throw a)!`. Since it's a compile-time
// error for a thrown expression to be potentially nullable, this is
// sufficient to verify that the compiler has resolved the ambiguity
// correctly. We check the runtime behavior by verifying that the error that
// is thrown is not `NullThrownError`.
Expect.throws(() {
throw a!;
}, (error) => error is! NullThrownError);
// correctly. We check the runtime behavior by verifying that an error is
// thrown from the `a!`.
Expect.throws(() {
throw a!;
});
// `() => a!` means `() => (a!)`, not `(() => a)!`. We check the compile-time
// behavior by trying to assign to a function returning non-null. We check

View file

@ -36,7 +36,7 @@ void testValue(var o) {
try {
throw o;
} on List<String> catch (e) {
} on NullThrownError catch (e) {
} on TypeError catch (e) {
} on Unresolved9 catch (e) {
} catch (e) {
}
@ -44,7 +44,7 @@ void testValue(var o) {
try {
throw o;
} on List<Unresolved10> catch (e) {
} on NullThrownError catch (e) {
} on TypeError catch (e) {
} on Unresolved11 catch (e) {
} catch (e) {
}