mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:33:28 +00:00
Adjust nnbd tests that return voidy expressions
Change-Id: I3c9fb55e49630372d232d1dcf12ab323badac42a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152846 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
This commit is contained in:
parent
7f1f32904c
commit
1d264c53e4
|
@ -4,11 +4,16 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
/*
|
||||
* `return exp;` where `exp` has static type `S` is an error if `flatten(S)` is
|
||||
`void` and `flatten(T)` is not `void`, `dynamic`, or `Null`.
|
||||
*/
|
||||
/* `return exp;` where `exp` has static type `S` is an error if the future
|
||||
* value type of the function is neither `void` nor `dynamic`,
|
||||
* and `flatten(S)` is `void` or `void*`.
|
||||
*
|
||||
* With null-safety, this is an error because of the downcast and the use of
|
||||
* an expression of type `void`.
|
||||
*/
|
||||
|
||||
void v = null;
|
||||
|
||||
Future<int> test() async {
|
||||
return v;
|
||||
// ^
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
/*
|
||||
* `return exp;` where `exp` has static type `S` is an error if `flatten(S)` is
|
||||
`void` and `flatten(T)` is not `void`, `dynamic`, or `Null`.
|
||||
*/
|
||||
Future<void> v = null;
|
||||
// ^^^^
|
||||
// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'Future<void>'.
|
||||
/* `return exp;` where `exp` has static type `S` is an error if the future
|
||||
* value type of the function is neither `void` nor `dynamic`,
|
||||
* and `flatten(S)` is `void` or `void*`.
|
||||
*
|
||||
* With null-safety, this is an error because of the downcast.
|
||||
*/
|
||||
|
||||
Future<void> v = Future.value(null);
|
||||
|
||||
Future<int> test() async {
|
||||
return v;
|
||||
// ^
|
||||
|
|
|
@ -4,11 +4,15 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
/*
|
||||
* `return exp;` where `exp` has static type `S` is an error if `flatten(S)` is
|
||||
`void` and `flatten(T)` is not `void`, `dynamic`, or `Null`.
|
||||
*/
|
||||
/* `return exp;` where `exp` has static type `S` is an error if the future
|
||||
* value type of the function is neither `void` nor `dynamic`,
|
||||
* and `flatten(S)` is `void` or `void*`.
|
||||
*
|
||||
* With null-safety, this is an error because of the downcast.
|
||||
*/
|
||||
|
||||
FutureOr<void> v = null;
|
||||
|
||||
Future<int> test() async {
|
||||
return v;
|
||||
// ^
|
||||
|
|
|
@ -4,11 +4,16 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
/*
|
||||
* `return exp;` where `exp` has static type `S` is an error if `flatten(S)` is
|
||||
`void` and `flatten(T)` is not `void`, `dynamic`, or `Null`.
|
||||
*/
|
||||
/* `return exp;` where `exp` has static type `S` is an error if the future
|
||||
* value type of the function is neither `void` nor `dynamic`,
|
||||
* and `flatten(S)` is `void` or `void*`.
|
||||
*
|
||||
* With null-safety, this is an error because of the downcast and the use of
|
||||
* an expression of type `void`.
|
||||
*/
|
||||
|
||||
void v = null;
|
||||
|
||||
FutureOr<int> test() async {
|
||||
return v;
|
||||
// ^
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
/*
|
||||
* `return exp;` where `exp` has static type `S` is an error if `flatten(S)` is
|
||||
`void` and `flatten(T)` is not `void`, `dynamic`, or `Null`.
|
||||
*/
|
||||
Future<void> v = null;
|
||||
// ^^^^
|
||||
// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
|
||||
// [cfe] A value of type 'Null' can't be assigned to a variable of type 'Future<void>'.
|
||||
/* `return exp;` where `exp` has static type `S` is an error if the future
|
||||
* value type of the function is neither `void` nor `dynamic`,
|
||||
* and `flatten(S)` is `void` or `void*`.
|
||||
*
|
||||
* With null-safety, this is an error because of the downcast.
|
||||
*/
|
||||
|
||||
Future<void> v = Future.value(null);
|
||||
|
||||
FutureOr<int> test() async {
|
||||
return v;
|
||||
// ^
|
||||
|
|
|
@ -4,11 +4,15 @@
|
|||
|
||||
import 'dart:async';
|
||||
|
||||
/*
|
||||
* `return exp;` where `exp` has static type `S` is an error if `flatten(S)` is
|
||||
`void` and `flatten(T)` is not `void`, `dynamic`, or `Null`.
|
||||
*/
|
||||
/* `return exp;` where `exp` has static type `S` is an error if the future
|
||||
* value type of the function is neither `void` nor `dynamic`,
|
||||
* and `flatten(S)` is `void` or `void*`.
|
||||
*
|
||||
* With null-safety, this is an error because of the downcast.
|
||||
*/
|
||||
|
||||
FutureOr<void> v = null;
|
||||
|
||||
FutureOr<int> test() async {
|
||||
return v;
|
||||
// ^
|
||||
|
|
Loading…
Reference in a new issue