Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: pkg/analyzer/test/generated/strong_mode_test.dart

Issue 2624793002: Make error producing tests ansynchronous. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/strong_mode_test.dart
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 5eddb57d8f9205fce14fe864ca504cb6e6a0da28..cf4cd1d93a8926f5b748578de9dbd6ec60b0aee4 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -4,6 +4,7 @@
library analyzer.test.generated.strong_mode_test;
+import 'dart:async';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -78,7 +79,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isStreamOf = _isInstantiationOf(_sameElement(typeProvider.streamType));
}
- void test_async_method_propagation() {
+ test_async_method_propagation() async {
String code = r'''
import "dart:async";
class A {
@@ -135,7 +136,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
check("g5", _isFutureOfInt);
}
- void test_async_propagation() {
+ test_async_propagation() async {
String code = r'''
import "dart:async";
@@ -191,7 +192,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
check("g5", _isFutureOfInt);
}
- void test_async_star_method_propagation() {
+ test_async_star_method_propagation() async {
String code = r'''
import "dart:async";
class A {
@@ -219,7 +220,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
check("g3", _isStreamOf([(DartType type) => _isListOf(_isInt)(type)]));
}
- void test_async_star_propagation() {
+ test_async_star_propagation() async {
String code = r'''
import "dart:async";
@@ -246,7 +247,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
check("g3", _isStreamOf([(DartType type) => _isListOf(_isInt)(type)]));
}
- void test_cascadeExpression() {
+ test_cascadeExpression() async {
String code = r'''
class A<T> {
List<T> map(T a, List<T> mapper(T x)) => mapper(a);
@@ -277,7 +278,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
expect(f0.type.normalParameterTypes[0], typeProvider.intType);
}
- void test_constructorInitializer_propagation() {
+ test_constructorInitializer_propagation() async {
String code = r'''
class A {
List<String> x;
@@ -292,7 +293,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isListOf(_isString)(exp.staticType);
}
- void test_factoryConstructor_propagation() {
+ test_factoryConstructor_propagation() async {
String code = r'''
class A<T> {
factory A() { return new B(); }
@@ -314,7 +315,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
[_isType(elementA.typeParameters[0].type)])(exp.staticType);
}
- void test_fieldDeclaration_propagation() {
+ test_fieldDeclaration_propagation() async {
String code = r'''
class A {
List<String> f0 = ["hello"];
@@ -327,7 +328,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isListOf(_isString)(field.initializer.staticType);
}
- void test_functionDeclaration_body_propagation() {
+ test_functionDeclaration_body_propagation() async {
String code = r'''
typedef T Function2<S, T>(S x);
@@ -367,7 +368,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
expect(type1.normalParameterTypes[0], typeProvider.intType);
}
- void test_functionLiteral_assignment_typedArguments() {
+ test_functionLiteral_assignment_typedArguments() async {
String code = r'''
typedef T Function2<S, T>(S x);
@@ -396,7 +397,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_assignment_unTypedArguments() {
+ test_functionLiteral_assignment_unTypedArguments() async {
String code = r'''
typedef T Function2<S, T>(S x);
@@ -425,7 +426,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_body_propagation() {
+ test_functionLiteral_body_propagation() async {
String code = r'''
typedef T Function2<S, T>(S x);
@@ -459,7 +460,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfString(functionReturnValue(3).staticType);
}
- void test_functionLiteral_functionExpressionInvocation_typedArguments() {
+ test_functionLiteral_functionExpressionInvocation_typedArguments() async {
String code = r'''
class Mapper<F, T> {
T map(T mapper(F x)) => mapper(null);
@@ -490,7 +491,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_functionExpressionInvocation_unTypedArguments() {
+ test_functionLiteral_functionExpressionInvocation_unTypedArguments() async {
String code = r'''
class Mapper<F, T> {
T map(T mapper(F x)) => mapper(null);
@@ -521,7 +522,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_functionInvocation_typedArguments() {
+ test_functionLiteral_functionInvocation_typedArguments() async {
String code = r'''
String map(String mapper(int x)) => mapper(null);
@@ -550,7 +551,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_functionInvocation_unTypedArguments() {
+ test_functionLiteral_functionInvocation_unTypedArguments() async {
String code = r'''
String map(String mapper(int x)) => mapper(null);
@@ -579,7 +580,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_methodInvocation_typedArguments() {
+ test_functionLiteral_methodInvocation_typedArguments() async {
String code = r'''
class Mapper<F, T> {
T map(T mapper(F x)) => mapper(null);
@@ -610,7 +611,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_methodInvocation_unTypedArguments() {
+ test_functionLiteral_methodInvocation_unTypedArguments() async {
String code = r'''
class Mapper<F, T> {
T map(T mapper(F x)) => mapper(null);
@@ -641,7 +642,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isFunction2Of(_isInt, _isString)(literal(4));
}
- void test_functionLiteral_unTypedArgument_propagation() {
+ test_functionLiteral_unTypedArgument_propagation() async {
String code = r'''
typedef T Function2<S, T>(S x);
@@ -676,7 +677,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
expect(functionReturnValue(4).staticType, typeProvider.stringType);
}
- void test_inference_hints() {
+ test_inference_hints() async {
Source source = addSource(r'''
void main () {
var x = 3;
@@ -684,11 +685,11 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
}
''');
resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_inferredFieldDeclaration_propagation() {
+ test_inferredFieldDeclaration_propagation() async {
// Regression test for https://github.com/dart-lang/sdk/issues/25546
String code = r'''
abstract class A {
@@ -725,7 +726,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfInt(listLiteralC.staticType);
}
- void test_instanceCreation() {
+ test_instanceCreation() async {
String code = r'''
class A<S, T> {
S x;
@@ -944,7 +945,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
}
}
- void test_listLiteral_nested() {
+ test_listLiteral_nested() async {
String code = r'''
void main () {
List<List<int>> l0 = [[]];
@@ -977,7 +978,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfInt(literal(3).elements[0].staticType);
}
- void test_listLiteral_simple() {
+ test_listLiteral_simple() async {
String code = r'''
void main () {
List<int> l0 = [];
@@ -1004,7 +1005,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfInt(literal(3));
}
- void test_listLiteral_simple_const() {
+ test_listLiteral_simple_const() async {
String code = r'''
void main () {
const List<int> c0 = const [];
@@ -1031,7 +1032,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfInt(literal(3));
}
- void test_listLiteral_simple_disabled() {
+ test_listLiteral_simple_disabled() async {
String code = r'''
void main () {
List<int> l0 = <num>[];
@@ -1056,7 +1057,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isListOf(_isDynamic)(literal(3));
}
- void test_listLiteral_simple_subtype() {
+ test_listLiteral_simple_subtype() async {
String code = r'''
void main () {
Iterable<int> l0 = [];
@@ -1083,7 +1084,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfInt(literal(3));
}
- void test_mapLiteral_nested() {
+ test_mapLiteral_nested() async {
String code = r'''
void main () {
Map<int, List<String>> l0 = {};
@@ -1119,7 +1120,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfString(literal(4).entries[0].value.staticType);
}
- void test_mapLiteral_simple() {
+ test_mapLiteral_simple() async {
String code = r'''
void main () {
Map<int, String> l0 = {};
@@ -1148,7 +1149,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertMapOfIntToString(literal(3));
}
- void test_mapLiteral_simple_disabled() {
+ test_mapLiteral_simple_disabled() async {
String code = r'''
void main () {
Map<int, String> l0 = <int, dynamic>{};
@@ -1176,7 +1177,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertMapOfIntToDynamic(literal(3));
}
- void test_methodDeclaration_body_propagation() {
+ test_methodDeclaration_body_propagation() async {
String code = r'''
class A {
List<String> m0(int x) => ["hello"];
@@ -1201,7 +1202,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
assertListOfString(methodReturnValue("m1").staticType);
}
- void test_redirectingConstructor_propagation() {
+ test_redirectingConstructor_propagation() async {
String code = r'''
class A {
A() : this.named([]);
@@ -1217,7 +1218,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isListOf(_isString)(exp.staticType);
}
- void test_superConstructorInvocation_propagation() {
+ test_superConstructorInvocation_propagation() async {
String code = r'''
class B {
B(List<String>);
@@ -1235,7 +1236,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
_isListOf(_isString)(exp.staticType);
}
- void test_sync_star_method_propagation() {
+ test_sync_star_method_propagation() async {
String code = r'''
import "dart:async";
class A {
@@ -1263,7 +1264,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
check("f3", _isListOf((DartType type) => _isListOf(_isInt)(type)));
}
- void test_sync_star_propagation() {
+ test_sync_star_propagation() async {
String code = r'''
import "dart:async";
@@ -1296,8 +1297,8 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
*/
@reflectiveTest
class StrongModeStaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared {
- void fail_genericMethod_tearoff_instantiated() {
- resolveTestUnit(r'''
+ fail_genericMethod_tearoff_instantiated() async {
+ await resolveTestUnit(r'''
class C<E> {
/*=T*/ f/*<T>*/(E e) => null;
static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1327,8 +1328,8 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
expectIdentifierType('paramTearOffInst', "(int) → int");
}
- void objectMethodOnFunctions_helper(String code) {
- resolveTestUnit(code);
+ Future<Null> _objectMethodOnFunctions_helper2(String code) async {
+ await resolveTestUnit(code);
expectIdentifierType('t0', "String");
expectIdentifierType('t1', "() → String");
expectIdentifierType('t2', "int");
@@ -1344,30 +1345,30 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
resetWithOptions(options);
}
- void test_dynamicObjectGetter_hashCode() {
+ test_dynamicObjectGetter_hashCode() async {
String code = r'''
main() {
dynamic a = null;
var foo = a.hashCode;
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'int', isNull);
}
- void test_dynamicObjectMethod_toString() {
+ test_dynamicObjectMethod_toString() async {
String code = r'''
main() {
dynamic a = null;
var foo = a.toString();
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'String', isNull);
}
- void test_genericFunction() {
- resolveTestUnit(r'/*=T*/ f/*<T>*/(/*=T*/ x) => null;');
+ test_genericFunction() async {
+ await resolveTestUnit(r'/*=T*/ f/*<T>*/(/*=T*/ x) => null;');
expectFunctionType('f', '<T>(T) → T',
elementTypeParams: '[T]', typeFormals: '[T]');
SimpleIdentifier f = findIdentifier('f');
@@ -1376,14 +1377,14 @@ main() {
expect(ft.toString(), '(String) → String');
}
- void test_genericFunction_bounds() {
- resolveTestUnit(r'/*=T*/ f/*<T extends num>*/(/*=T*/ x) => null;');
+ test_genericFunction_bounds() async {
+ await resolveTestUnit(r'/*=T*/ f/*<T extends num>*/(/*=T*/ x) => null;');
expectFunctionType('f', '<T extends num>(T) → T',
elementTypeParams: '[T extends num]', typeFormals: '[T extends num]');
}
- void test_genericFunction_parameter() {
- resolveTestUnit(r'''
+ test_genericFunction_parameter() async {
+ await resolveTestUnit(r'''
void g(/*=T*/ f/*<T>*/(/*=T*/ x)) {}
''');
expectFunctionType('f', '<T>(T) → T',
@@ -1395,8 +1396,8 @@ void g(/*=T*/ f/*<T>*/(/*=T*/ x)) {}
expect(ft.toString(), '(String) → String');
}
- void test_genericFunction_static() {
- resolveTestUnit(r'''
+ test_genericFunction_static() async {
+ await resolveTestUnit(r'''
class C<E> {
static /*=T*/ f/*<T>*/(/*=T*/ x) => null;
}
@@ -1409,7 +1410,7 @@ class C<E> {
expect(ft.toString(), '(String) → String');
}
- void test_genericFunction_typedef() {
+ test_genericFunction_typedef() async {
String code = r'''
typedef T F<T>(T x);
F f0;
@@ -1440,7 +1441,7 @@ class D<S> {
}
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
checkBody(String className) {
List<Statement> statements =
@@ -1456,14 +1457,14 @@ class D<S> {
checkBody("D");
}
- void test_genericFunction_upwardsAndDownwards() {
+ test_genericFunction_upwardsAndDownwards() async {
// Regression tests for https://github.com/dart-lang/sdk/issues/27151.
- resolveTestUnit(r'List<num> x = [1, 2];');
+ await resolveTestUnit(r'List<num> x = [1, 2];');
expectInitializerType('x', 'List<int>');
}
- void test_genericMethod() {
- resolveTestUnit(r'''
+ test_genericMethod() async {
+ await resolveTestUnit(r'''
class C<E> {
List/*<T>*/ f/*<T>*/(E e) => null;
}
@@ -1484,8 +1485,8 @@ main() {
expect('${ft.typeArguments}/${ft.typeParameters}', '[String, int]/[E, T]');
}
- void test_genericMethod_explicitTypeParams() {
- resolveTestUnit(r'''
+ test_genericMethod_explicitTypeParams() async {
+ await resolveTestUnit(r'''
class C<E> {
List/*<T>*/ f/*<T>*/(E e) => null;
}
@@ -1504,8 +1505,8 @@ main() {
typeProvider.listType.instantiate([typeProvider.intType]));
}
- void test_genericMethod_functionExpressionInvocation_explicit() {
- resolveTestUnit(r'''
+ test_genericMethod_functionExpressionInvocation_explicit() async {
+ await resolveTestUnit(r'''
class C<E> {
/*=T*/ f/*<T>*/(/*=T*/ e) => null;
static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1538,8 +1539,8 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
expectIdentifierType('lambdaCall', "int");
}
- void test_genericMethod_functionExpressionInvocation_inferred() {
- resolveTestUnit(r'''
+ test_genericMethod_functionExpressionInvocation_inferred() async {
+ await resolveTestUnit(r'''
class C<E> {
/*=T*/ f/*<T>*/(/*=T*/ e) => null;
static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1572,8 +1573,8 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
expectIdentifierType('lambdaCall', "int");
}
- void test_genericMethod_functionInvocation_explicit() {
- resolveTestUnit(r'''
+ test_genericMethod_functionInvocation_explicit() async {
+ await resolveTestUnit(r'''
class C<E> {
/*=T*/ f/*<T>*/(/*=T*/ e) => null;
static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1603,8 +1604,8 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
expectIdentifierType('paramCall', "int");
}
- void test_genericMethod_functionInvocation_inferred() {
- resolveTestUnit(r'''
+ test_genericMethod_functionInvocation_inferred() async {
+ await resolveTestUnit(r'''
class C<E> {
/*=T*/ f/*<T>*/(/*=T*/ e) => null;
static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1634,8 +1635,8 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
expectIdentifierType('paramCall', "int");
}
- void test_genericMethod_functionTypedParameter() {
- resolveTestUnit(r'''
+ test_genericMethod_functionTypedParameter() async {
+ await resolveTestUnit(r'''
class C<E> {
List/*<T>*/ f/*<T>*/(/*=T*/ f(E e)) => null;
}
@@ -1656,11 +1657,11 @@ main() {
expect(ft.toString(), '((String) → int) → List<int>');
}
- void test_genericMethod_implicitDynamic() {
+ test_genericMethod_implicitDynamic() async {
// Regression test for:
// https://github.com/dart-lang/sdk/issues/25100#issuecomment-162047588
// These should not cause any hints or warnings.
- resolveTestUnit(r'''
+ await resolveTestUnit(r'''
class List<E> {
/*=T*/ map/*<T>*/(/*=T*/ f(E e)) => null;
}
@@ -1678,62 +1679,62 @@ void foo() {
expect(m2.staticInvokeType.toString(), '((dynamic) → int) → int');
}
- void test_genericMethod_max_doubleDouble() {
+ test_genericMethod_max_doubleDouble() async {
String code = r'''
import 'dart:math';
main() {
var foo = max(1.0, 2.0);
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'double', isNull);
}
- void test_genericMethod_max_doubleDouble_prefixed() {
+ test_genericMethod_max_doubleDouble_prefixed() async {
String code = r'''
import 'dart:math' as math;
main() {
var foo = math.max(1.0, 2.0);
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'double', isNull);
}
- void test_genericMethod_max_doubleInt() {
+ test_genericMethod_max_doubleInt() async {
String code = r'''
import 'dart:math';
main() {
var foo = max(1.0, 2);
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'num', isNull);
}
- void test_genericMethod_max_intDouble() {
+ test_genericMethod_max_intDouble() async {
String code = r'''
import 'dart:math';
main() {
var foo = max(1, 2.0);
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'num', isNull);
}
- void test_genericMethod_max_intInt() {
+ test_genericMethod_max_intInt() async {
String code = r'''
import 'dart:math';
main() {
var foo = max(1, 2);
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'int', isNull);
}
- void test_genericMethod_nestedBound() {
+ test_genericMethod_nestedBound() async {
String code = r'''
class Foo<T extends num> {
void method/*<U extends T>*/(dynamic/*=U*/ u) {
@@ -1742,11 +1743,11 @@ class Foo<T extends num> {
}
''';
// Just validate that there is no warning on the call to `.abs()`.
- resolveTestUnit(code);
+ await resolveTestUnit(code);
}
- void test_genericMethod_nestedCapture() {
- resolveTestUnit(r'''
+ test_genericMethod_nestedCapture() async {
+ await resolveTestUnit(r'''
class C<T> {
/*=T*/ f/*<S>*/(/*=S*/ x) {
new C<S>().f/*<int>*/(3);
@@ -1763,8 +1764,8 @@ class C<T> {
expectIdentifierType('f;', '<S₀>(S₀) → S');
}
- void test_genericMethod_nestedFunctions() {
- resolveTestUnit(r'''
+ test_genericMethod_nestedFunctions() async {
+ await resolveTestUnit(r'''
/*=S*/ f/*<S>*/(/*=S*/ x) {
g/*<S>*/(/*=S*/ x) => f;
return null;
@@ -1774,8 +1775,8 @@ class C<T> {
expectIdentifierType('g', '<S>(S) → <S>(S) → S');
}
- void test_genericMethod_override() {
- resolveTestUnit(r'''
+ test_genericMethod_override() async {
+ await resolveTestUnit(r'''
class C {
/*=T*/ f/*<T>*/(/*=T*/ x) => null;
}
@@ -1792,8 +1793,8 @@ class D extends C {
expect(ft.toString(), '(String) → String');
}
- void test_genericMethod_override_bounds() {
- resolveTestUnit(r'''
+ test_genericMethod_override_bounds() async {
+ await resolveTestUnit(r'''
class A {}
class B extends A {}
class C {
@@ -1805,7 +1806,7 @@ class D extends C {
''');
}
- void test_genericMethod_override_invalidReturnType() {
+ test_genericMethod_override_invalidReturnType() async {
Source source = addSource(r'''
class C {
Iterable/*<T>*/ f/*<T>*/(/*=T*/ x) => null;
@@ -1813,11 +1814,11 @@ class C {
class D extends C {
String f/*<S>*/(/*=S*/ x) => null;
}''');
- assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
+ await assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
verify([source]);
}
- void test_genericMethod_override_invalidTypeParamBounds() {
+ test_genericMethod_override_invalidTypeParamBounds() async {
Source source = addSource(r'''
class A {}
class B extends A {}
@@ -1827,11 +1828,11 @@ class C {
class D extends C {
/*=T*/ f/*<T extends B>*/(/*=T*/ x) => null;
}''');
- assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
+ await assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
verify([source]);
}
- void test_genericMethod_override_invalidTypeParamCount() {
+ test_genericMethod_override_invalidTypeParamCount() async {
Source source = addSource(r'''
class C {
/*=T*/ f/*<T>*/(/*=T*/ x) => null;
@@ -1839,11 +1840,11 @@ class C {
class D extends C {
/*=S*/ f/*<T, S>*/(/*=T*/ x) => null;
}''');
- assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
+ await assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
verify([source]);
}
- void test_genericMethod_propagatedType_promotion() {
+ test_genericMethod_propagatedType_promotion() async {
// Regression test for:
// https://github.com/dart-lang/sdk/issues/25340
@@ -1851,7 +1852,7 @@ class D extends C {
// example won't work, as we now compute a static type and therefore discard
// the propagated type. So a new test was created that doesn't run under
// strong mode.
- resolveTestUnit(r'''
+ await resolveTestUnit(r'''
abstract class Iter {
List/*<S>*/ map/*<S>*/(/*=S*/ f(x));
}
@@ -1865,8 +1866,8 @@ C toSpan(dynamic element) {
expectIdentifierType('y = ', 'List<C>', isNull);
}
- void test_genericMethod_tearoff() {
- resolveTestUnit(r'''
+ test_genericMethod_tearoff() async {
+ await resolveTestUnit(r'''
class C<E> {
/*=T*/ f/*<T>*/(E e) => null;
static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1896,7 +1897,7 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
expectIdentifierType('paramTearOff', "<T>(T) → T");
}
- void test_genericMethod_then() {
+ test_genericMethod_then() async {
String code = r'''
import 'dart:async';
String toString(int x) => x.toString();
@@ -1905,11 +1906,11 @@ main() {
var foo = bar.then(toString);
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'Future<String>', isNull);
}
- void test_genericMethod_then_prefixed() {
+ test_genericMethod_then_prefixed() async {
String code = r'''
import 'dart:async' as async;
String toString(int x) => x.toString();
@@ -1918,11 +1919,11 @@ main() {
var foo = bar.then(toString);
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'Future<String>', isNull);
}
- void test_genericMethod_then_propagatedType() {
+ test_genericMethod_then_propagatedType() async {
// Regression test for https://github.com/dart-lang/sdk/issues/25482.
String code = r'''
import 'dart:async';
@@ -1932,11 +1933,11 @@ void main() {
}
''';
// This should produce no hints or warnings.
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'Future<String>', isNull);
}
- void test_implicitBounds() {
+ test_implicitBounds() async {
String code = r'''
class A<T> {}
@@ -1954,7 +1955,7 @@ void test() {
var cc = new C();
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectIdentifierType('ai', "A<dynamic>");
expectIdentifierType('bi', "B<num>");
expectIdentifierType('ci', "C<int, B<int>, B<dynamic>>");
@@ -1963,7 +1964,7 @@ void test() {
expectIdentifierType('cc', "C<int, B<int>, B<dynamic>>");
}
- void test_objectMethodOnFunctions_Anonymous() {
+ test_objectMethodOnFunctions_Anonymous() async {
String code = r'''
void main() {
var f = (x) => 3;
@@ -1987,10 +1988,10 @@ void main() {
(f)..toString;
(f)..hashCode;
}''';
- objectMethodOnFunctions_helper(code);
+ await _objectMethodOnFunctions_helper2(code);
}
- void test_objectMethodOnFunctions_Function() {
+ test_objectMethodOnFunctions_Function() async {
String code = r'''
void main() {
Function f;
@@ -2014,10 +2015,10 @@ void main() {
(f)..toString;
(f)..hashCode;
}''';
- objectMethodOnFunctions_helper(code);
+ await _objectMethodOnFunctions_helper2(code);
}
- void test_objectMethodOnFunctions_Static() {
+ test_objectMethodOnFunctions_Static() async {
String code = r'''
int f(int x) => null;
void main() {
@@ -2041,10 +2042,10 @@ void main() {
(f)..toString;
(f)..hashCode;
}''';
- objectMethodOnFunctions_helper(code);
+ await _objectMethodOnFunctions_helper2(code);
}
- void test_objectMethodOnFunctions_Typedef() {
+ test_objectMethodOnFunctions_Typedef() async {
String code = r'''
typedef bool Predicate<T>(T object);
@@ -2070,24 +2071,24 @@ void main() {
(f)..toString;
(f)..hashCode;
}''';
- objectMethodOnFunctions_helper(code);
+ await _objectMethodOnFunctions_helper2(code);
}
- void test_setterWithDynamicTypeIsError() {
+ test_setterWithDynamicTypeIsError() async {
Source source = addSource(r'''
class A {
dynamic set f(String s) => null;
}
dynamic set g(int x) => null;
''');
- assertErrors(source, [
+ await assertErrors(source, [
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER,
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER
]);
verify([source]);
}
- void test_setterWithExplicitVoidType_returningVoid() {
+ test_setterWithExplicitVoidType_returningVoid() async {
Source source = addSource(r'''
void returnsVoid() {}
class A {
@@ -2095,11 +2096,11 @@ class A {
}
void set g(int x) => returnsVoid();
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_setterWithNoVoidType() {
+ test_setterWithNoVoidType() async {
Source source = addSource(r'''
class A {
set f(String s) {
@@ -2108,13 +2109,13 @@ class A {
}
set g(int x) => 42;
''');
- assertErrors(source, [
+ await assertErrors(source, [
StaticTypeWarningCode.RETURN_OF_INVALID_TYPE,
]);
verify([source]);
}
- void test_setterWithNoVoidType_returningVoid() {
+ test_setterWithNoVoidType_returningVoid() async {
Source source = addSource(r'''
void returnsVoid() {}
class A {
@@ -2122,41 +2123,41 @@ class A {
}
set g(int x) => returnsVoid();
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_setterWithOtherTypeIsError() {
+ test_setterWithOtherTypeIsError() async {
Source source = addSource(r'''
class A {
String set f(String s) => null;
}
Object set g(x) => null;
''');
- assertErrors(source, [
+ await assertErrors(source, [
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER,
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER
]);
verify([source]);
}
- void test_ternaryOperator_null_left() {
+ test_ternaryOperator_null_left() async {
String code = r'''
main() {
var foo = (true) ? null : 3;
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'int', isNull);
}
- void test_ternaryOperator_null_right() {
+ test_ternaryOperator_null_right() async {
String code = r'''
main() {
var foo = (true) ? 3 : null;
}
''';
- resolveTestUnit(code);
+ await resolveTestUnit(code);
expectInitializerType('foo', 'int', isNull);
}
}
@@ -2171,7 +2172,7 @@ class StrongModeTypePropagationTest extends ResolverTestCase {
resetWithOptions(options);
}
- void test_foreachInference_dynamic_disabled() {
+ test_foreachInference_dynamic_disabled() async {
String code = r'''
main() {
var list = <int>[];
@@ -2179,11 +2180,11 @@ main() {
v; // marker
}
}''';
- assertPropagatedIterationType(code, typeProvider.dynamicType, null);
- assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+ await assertPropagatedIterationType(code, typeProvider.dynamicType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
}
- void test_foreachInference_reusedVar_disabled() {
+ test_foreachInference_reusedVar_disabled() async {
String code = r'''
main() {
var list = <int>[];
@@ -2192,11 +2193,11 @@ main() {
v; // marker
}
}''';
- assertPropagatedIterationType(code, typeProvider.dynamicType, null);
- assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+ await assertPropagatedIterationType(code, typeProvider.dynamicType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
}
- void test_foreachInference_var() {
+ test_foreachInference_var() async {
String code = r'''
main() {
var list = <int>[];
@@ -2204,11 +2205,11 @@ main() {
v; // marker
}
}''';
- assertPropagatedIterationType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedIterationType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_foreachInference_var_iterable() {
+ test_foreachInference_var_iterable() async {
String code = r'''
main() {
Iterable<int> list = <int>[];
@@ -2216,11 +2217,11 @@ main() {
v; // marker
}
}''';
- assertPropagatedIterationType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedIterationType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_foreachInference_var_stream() {
+ test_foreachInference_var_stream() async {
String code = r'''
import 'dart:async';
main() async {
@@ -2229,52 +2230,52 @@ main() async {
v; // marker
}
}''';
- assertPropagatedIterationType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedIterationType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_bottom_disabled() {
+ test_localVariableInference_bottom_disabled() async {
String code = r'''
main() {
var v = null;
v; // marker
}''';
- assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
- assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+ await assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
}
- void test_localVariableInference_constant() {
+ test_localVariableInference_constant() async {
String code = r'''
main() {
var v = 3;
v; // marker
}''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_declaredType_disabled() {
+ test_localVariableInference_declaredType_disabled() async {
String code = r'''
main() {
dynamic v = 3;
v; // marker
}''';
- assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
- assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+ await assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
}
- void test_localVariableInference_noInitializer_disabled() {
+ test_localVariableInference_noInitializer_disabled() async {
String code = r'''
main() {
var v;
v = 3;
v; // marker
}''';
- assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
- assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+ await assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
}
- void test_localVariableInference_transitive_field_inferred_lexical() {
+ test_localVariableInference_transitive_field_inferred_lexical() async {
String code = r'''
class A {
final x = 3;
@@ -2286,11 +2287,11 @@ class A {
main() {
}
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_field_inferred_reversed() {
+ test_localVariableInference_transitive_field_inferred_reversed() async {
String code = r'''
class A {
f() {
@@ -2302,11 +2303,11 @@ class A {
main() {
}
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_field_lexical() {
+ test_localVariableInference_transitive_field_lexical() async {
String code = r'''
class A {
int x = 3;
@@ -2318,11 +2319,11 @@ class A {
main() {
}
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_field_reversed() {
+ test_localVariableInference_transitive_field_reversed() async {
String code = r'''
class A {
f() {
@@ -2334,33 +2335,33 @@ class A {
main() {
}
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_list_local() {
+ test_localVariableInference_transitive_list_local() async {
String code = r'''
main() {
var x = <int>[3];
var v = x[0];
v; // marker
}''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_local() {
+ test_localVariableInference_transitive_local() async {
String code = r'''
main() {
var x = 3;
var v = x;
v; // marker
}''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_toplevel_inferred_lexical() {
+ test_localVariableInference_transitive_toplevel_inferred_lexical() async {
String code = r'''
final x = 3;
main() {
@@ -2368,11 +2369,11 @@ main() {
v; // marker
}
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_toplevel_inferred_reversed() {
+ test_localVariableInference_transitive_toplevel_inferred_reversed() async {
String code = r'''
main() {
var v = x;
@@ -2380,11 +2381,11 @@ main() {
}
final x = 3;
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_toplevel_lexical() {
+ test_localVariableInference_transitive_toplevel_lexical() async {
String code = r'''
int x = 3;
main() {
@@ -2392,11 +2393,11 @@ main() {
v; // marker
}
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
- void test_localVariableInference_transitive_toplevel_reversed() {
+ test_localVariableInference_transitive_toplevel_reversed() async {
String code = r'''
main() {
var v = x;
@@ -2404,7 +2405,7 @@ main() {
}
int x = 3;
''';
- assertPropagatedAssignedType(code, typeProvider.intType, null);
- assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+ await assertPropagatedAssignedType(code, typeProvider.intType, null);
+ await assertTypeOfMarkedExpression(code, typeProvider.intType, null);
}
}

Powered by Google App Engine
This is Rietveld 408576698