Update language/invalid_returns tests, cf. SDK #41803

Change-Id: I36661c955b9e033fce92481033307525028a5dc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149163
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This commit is contained in:
Erik Ernst
2020-05-29 08:07:18 +00:00
committed by commit-bot@chromium.org
parent ea4b17533c
commit f585be5af2
33 changed files with 57 additions and 112 deletions
@@ -22,18 +22,14 @@ Object? test2() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Null>`, no error.
Object Function() test3 = () async {
return;
//^
// [analyzer] unspecified
// [cfe] unspecified
};
// Inferred return type of function literal is `Future<Null>`, no error.
Object? Function() test4 = () async {
return;
//^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -15,11 +15,9 @@ Future<Object?> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Null>`, no error.
Future<Object?> Function() test2 = () async {
return;
//^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -15,11 +15,9 @@ FutureOr<Object?> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Null>`, no error.
FutureOr<Object?> Function() test2 = () async {
return;
//^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ void test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
void Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ void test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Object>`, no error.
void Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ void test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int?>`, no error.
void Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ void test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
void Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ void test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Object>`, no error.
void Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ void test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Object>`, no error.
void Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -25,18 +25,14 @@ Object? test2() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void>`, no error.
Object Function() test3 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
// Inferred return type of function literal is `Future<void>`, no error.
Object? Function() test4 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -25,18 +25,14 @@ Object? test2() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void?>`, no error.
Object Function() test3 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
// Inferred return type of function literal is `Future<void?>`, no error.
Object? Function() test4 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -25,18 +25,14 @@ Object? test2() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void>`, no error.
Object Function() test3 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
// Inferred return type of function literal is `Future<void>`, no error.
Object? Function() test4 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ Future<Object?> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void>`, no error.
Future<Object?> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ Future<Object?> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void>`, no error.
Future<Object?> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ Future<Object?> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void>`, no error.
Future<Object?> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ FutureOr<Object?> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void>`, no error.
FutureOr<Object?> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -32,11 +32,9 @@ FutureOr<Object> Function() test3 = () async {
// [cfe] unspecified
};
// Inferred return type of function literal is `Future<void>`, no error.
FutureOr<Object?> Function() test4 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -18,11 +18,9 @@ FutureOr<Object?> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<void>`, no error.
FutureOr<Object?> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -9,7 +9,7 @@ import 'dart:async';
* `flatten(S)` is not a subtype of `Tv`.
*/
Future<Future<String>> v = Future.value(Future.value(''));
Future<Future<String>> v = Future.value(Future<String>.value(''));
Future<String> test1() async {
return v;
@@ -9,7 +9,7 @@ import 'dart:async';
* `flatten(S)` is not a subtype of `Tv`.
*/
Future<Future<String>> v = Future.value(Future.value(''));
Future<Future<String>> v = Future.value(Future<String>.value(''));
FutureOr<String> test1() async {
return v;
@@ -18,7 +18,8 @@ Future<Null> test1() async {
// [cfe] unspecified
}
Future<Nullf> Function() test2 = () async {
// Inferred return type of function literal is `Future<Null>`.
Future<Null> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
@@ -18,6 +18,7 @@ Future<Null> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Null>`.
Future<Null> Function() test2 = () async {
return v;
// ^
@@ -9,7 +9,7 @@ import 'dart:async';
* and `flatten(S)` is `void` or `void*`.
*/
Future<void> v = Future.value(null);
Future<void> v = Future.value("Hello");
FutureOr<Null> test1() async {
return v;
@@ -18,6 +18,7 @@ FutureOr<Null> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Null>`.
FutureOr<Null> Function() test2 = () async {
return v;
// ^
@@ -9,7 +9,7 @@ import 'dart:async';
* and `flatten(S)` is `void` or `void*`.
*/
FutureOr<void> v = null;
FutureOr<void> v = 42;
FutureOr<Null> test1() async {
return v;
@@ -18,6 +18,7 @@ FutureOr<Null> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Null>`.
FutureOr<Null> Function() test2 = () async {
return v;
// ^
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
int v = 0;
@@ -18,11 +18,9 @@ Future<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
Future<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
Object v = true;
@@ -18,11 +18,9 @@ Future<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Object>`, no error.
Future<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
FutureOr<int> v = 0;
@@ -18,11 +18,9 @@ Future<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
Future<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
Future<int> v = Future.value(0);
@@ -18,11 +18,9 @@ Future<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
Future<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
int v = 0;
@@ -18,11 +18,9 @@ FutureOr<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
FutureOr<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
Object v = true;
@@ -18,11 +18,9 @@ FutureOr<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<Object>`, no error.
FutureOr<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
FutureOr<int> v = 0;
@@ -18,11 +18,9 @@ FutureOr<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
FutureOr<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -5,8 +5,8 @@
import 'dart:async';
/* `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*`.
* value type of the function is `void` and `flatten(S)` is not
* `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
*/
Future<int> v = Future.value(0);
@@ -18,11 +18,9 @@ FutureOr<void> test1() async {
// [cfe] unspecified
}
// Inferred return type of function literal is `Future<int>`, no error.
FutureOr<void> Function() test2 = () async {
return v;
// ^
// [analyzer] unspecified
// [cfe] unspecified
};
void main() {
@@ -8,7 +8,8 @@ import 'dart:async';
* and `T` is not `void` or `dynamic`.
*/
void v = null;
void v = 42;
Null test() {
return v;
// ^