Migrate "g" - "i" directory language tests off @compile-error.

The "@compile-error" comment is an old not-great way of defining static
error tests.

See: https://github.com/dart-lang/sdk/issues/45634
Change-Id: I65c446e00b25239960d421489e6cf87a88d875d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296408
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Robert Nystrom 2023-04-19 22:09:18 +00:00 committed by Commit Queue
parent 1d718fc7e9
commit c305279e0d
65 changed files with 282 additions and 71 deletions

View file

@ -6,9 +6,15 @@
// There is an interface conflict here due to a loop in the class
// hierarchy leading to an infinite set of implemented types; this loop
// shouldn't cause non-termination.
/*@compile-error=unspecified*/ class A<T> implements B<List<T>> {}
class A<T> implements B<List<T>> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'A' is a supertype of itself.
/*@compile-error=unspecified*/ class B<T> implements A<List<T>> {}
class B<T> implements A<List<T>> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'B' is a supertype of itself.
main() {
new A();

View file

@ -6,9 +6,15 @@
// There is no interface conflict here, but there is a loop in the class
// hierarchy leading to a finite set of implemented types; this loop
// shouldn't cause non-termination.
/*@compile-error=unspecified*/ class A<T> implements B<T> {}
class A<T> implements B<T> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'A' is a supertype of itself.
/*@compile-error=unspecified*/ class B<T> implements A<T> {}
class B<T> implements A<T> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'B' is a supertype of itself.
main() {
new A();

View file

@ -9,7 +9,10 @@ class A implements I<int> {}
class B implements I<String> {}
/*@compile-error=unspecified*/ class C extends A implements B {}
class C extends A implements B {}
// ^
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_GENERIC_INTERFACES
// [cfe] 'C' can't implement both 'I<int>' and 'I<String>'
main() {
new C();

View file

@ -6,7 +6,10 @@
class A {
const A();
foo() {
return y; /*@compile-error=unspecified*/
return y;
// ^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER
// [cfe] The getter 'y' isn't defined for the class 'A'.
}
}

View file

@ -9,5 +9,8 @@ import 'dart:typed_data';
import 'package:expect/expect.dart';
main() {
ClassID.GetID(4); /*@compile-error=unspecified*/
ClassID.GetID(4);
//^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER
// [cfe] Undefined name 'ClassID'.
}

View file

@ -2,8 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
var /*@compile-error=unspecified*/ x = () => y;
var /*@compile-error=unspecified*/ y = () => x;
var x = () => y;
// ^
// [analyzer] COMPILE_TIME_ERROR.TOP_LEVEL_CYCLE
// [cfe] Can't infer the type of 'x': circularity found during type inference.
var y = () => x;
// ^
// [analyzer] COMPILE_TIME_ERROR.TOP_LEVEL_CYCLE
void main() {
x;

View file

@ -10,7 +10,10 @@ class A {
// initializing formal.
A(this.x)
: y = (() {
/*@compile-error=unspecified*/ x = 3;
x = 3;
// ^
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_LOCAL
// [cfe] Can't assign to the final variable 'x'.
});
}

View file

@ -8,9 +8,15 @@
// There is an interface conflict here due to a loop in the class
// hierarchy leading to an infinite set of implemented types; this loop
// shouldn't cause non-termination.
/*@compile-error=unspecified*/ class A<T> implements B<List<T>> {}
class A<T> implements B<List<T>> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'A' is a supertype of itself.
/*@compile-error=unspecified*/ class B<T> implements A<List<T>> {}
class B<T> implements A<List<T>> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'B' is a supertype of itself.
main() {
new A();

View file

@ -8,9 +8,15 @@
// There is no interface conflict here, but there is a loop in the class
// hierarchy leading to a finite set of implemented types; this loop
// shouldn't cause non-termination.
/*@compile-error=unspecified*/ class A<T> implements B<T> {}
class A<T> implements B<T> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'A' is a supertype of itself.
/*@compile-error=unspecified*/ class B<T> implements A<T> {}
class B<T> implements A<T> {}
// ^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
// [cfe] 'B' is a supertype of itself.
main() {
new A();

View file

@ -11,7 +11,10 @@ class A implements I<int> {}
class B implements I<String> {}
/*@compile-error=unspecified*/ class C extends A implements B {}
class C extends A implements B {}
// ^
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_GENERIC_INTERFACES
// [cfe] 'C' can't implement both 'I<int>' and 'I<String>'
main() {
new C();

View file

@ -8,7 +8,10 @@
class A {
const A();
foo() {
return y; /*@compile-error=unspecified*/
return y;
// ^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER
// [cfe] The getter 'y' isn't defined for the class 'A'.
}
}

View file

@ -11,5 +11,8 @@ import 'dart:typed_data';
import 'package:expect/expect.dart';
main() {
ClassID.GetID(4); /*@compile-error=unspecified*/
ClassID.GetID(4);
//^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER
// [cfe] Undefined name 'ClassID'.
}

View file

@ -4,8 +4,13 @@
// @dart = 2.9
var /*@compile-error=unspecified*/ x = () => y;
var /*@compile-error=unspecified*/ y = () => x;
var x = () => y;
// ^
// [analyzer] COMPILE_TIME_ERROR.TOP_LEVEL_CYCLE
// [cfe] Can't infer the type of 'x': circularity found during type inference.
var y = () => x;
// ^
// [analyzer] COMPILE_TIME_ERROR.TOP_LEVEL_CYCLE
void main() {
x;

View file

@ -12,7 +12,10 @@ class A {
// initializing formal.
A(this.x)
: y = (() {
/*@compile-error=unspecified*/ x = 3;
x = 3;
// ^
// [analyzer] COMPILE_TIME_ERROR.ASSIGNMENT_TO_FINAL_LOCAL
// [cfe] Can't assign to the final variable 'x'.
});
}

View file

@ -12,7 +12,10 @@ class A {
// Finding the type of an initializing formal: should cause an error
// in the initializer but not the body, because the former has type
// `int` and the latter has type `num`.
A(int this.x) : /*@compile-error=unspecified*/ y = x {
A(int this.x) : y = x {
// ^
// [analyzer] COMPILE_TIME_ERROR.FIELD_INITIALIZER_NOT_ASSIGNABLE
// [cfe] A value of type 'int' can't be assigned to a variable of type 'double'.
y = x;
}
}

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
int v = null;
void test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Object v = null;
void test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<int> v = null;
void test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<int> v = null;
void test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<Object> v = null;
void test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<Object> v = null;
void test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
Object test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<void> v = null;
Object test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<void> v = null;
Object test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
Future<int> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<void> v = null;
Future<int> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<void> v = null;
Future<int> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
FutureOr<int> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<void> v = null;
FutureOr<int> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<void> v = null;
FutureOr<int> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
Future<Object> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<void> v = null;
Future<Object> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<void> v = null;
Future<Object> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
FutureOr<Object> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<void> v = null;
FutureOr<Object> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<void> v = null;
FutureOr<Object> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
int v = null;
Future<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<int> v = null;
Future<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<int> v = null;
Future<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<Future<String>> v = null;
Future<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<Future<String>>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
int v = null;
FutureOr<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<int> v = null;
FutureOr<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<int> v = null;
FutureOr<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<Future<String>> v = null;
FutureOr<String> test() async {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<Future<String>>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
int v = null;
void test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Object v = null;
void test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<int> v = null;
void test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<int> v = null;
void test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<Object> v = null;
void test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<Object> v = null;
void test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] Can't return a value from a void function.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
int test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
Object test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
Future<int> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
FutureOr<int> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
Future<Object> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
void v = null;
FutureOr<Object> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] This expression has type 'void' and can't be used.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
int v = null;
String test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'int' can't be assigned to a variable of type 'String'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<int> v = null;
String test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'String'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<int> v = null;
String test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'FutureOr<int>' can't be assigned to a variable of type 'String'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
int v = null;
Future<String> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'int' can't be assigned to a variable of type 'Future<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<int> v = null;
Future<String> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'Future<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<int> v = null;
Future<String> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'FutureOr<int>' can't be assigned to a variable of type 'Future<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
int v = null;
FutureOr<String> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'int' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
Future<int> v = null;
FutureOr<String> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'Future<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {

View file

@ -12,7 +12,10 @@ import 'dart:async';
*/
FutureOr<int> v = null;
FutureOr<String> test() {
return /*@compile-error=unspecified*/ v;
return v;
// ^
// [analyzer] COMPILE_TIME_ERROR.RETURN_OF_INVALID_TYPE
// [cfe] A value of type 'FutureOr<int>' can't be assigned to a variable of type 'FutureOr<String>'.
}
void main() {