| Index: pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| index 7a8f6ab7a710c0196fb0099e8a3d06bf12c00b69..810c05239cd8bad3c6b5438b7e345012fbaa7ddb 100644
|
| --- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| +++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| @@ -1843,6 +1843,56 @@ foo() {
|
| ''');
|
| }
|
|
|
| + void test_inferedType_usesSyntheticFunctionType() {
|
| + var mainUnit = checkFile('''
|
| +int f() => null;
|
| +String g() => null;
|
| +var v = /*info:INFERRED_TYPE_LITERAL*/[f, g];
|
| +''');
|
| + var v = mainUnit.topLevelVariables[0];
|
| + expect(v.type.toString(), 'List<() → Object>');
|
| + }
|
| +
|
| + void test_inferedType_usesSyntheticFunctionType_functionTypedParam() {
|
| + var mainUnit = checkFile('''
|
| +int f(int x(String y)) => null;
|
| +String g(int x(String y)) => null;
|
| +var v = /*info:INFERRED_TYPE_LITERAL*/[f, g];
|
| +''');
|
| + var v = mainUnit.topLevelVariables[0];
|
| + expect(v.type.toString(), 'List<((String) → int) → Object>');
|
| + }
|
| +
|
| + void test_inferedType_usesSyntheticFunctionType_namedParam() {
|
| + var mainUnit = checkFile('''
|
| +int f({int x}) => null;
|
| +String g({int x}) => null;
|
| +var v = /*info:INFERRED_TYPE_LITERAL*/[f, g];
|
| +''');
|
| + var v = mainUnit.topLevelVariables[0];
|
| + expect(v.type.toString(), 'List<({x: int}) → Object>');
|
| + }
|
| +
|
| + void test_inferedType_usesSyntheticFunctionType_positionalParam() {
|
| + var mainUnit = checkFile('''
|
| +int f([int x]) => null;
|
| +String g([int x]) => null;
|
| +var v = /*info:INFERRED_TYPE_LITERAL*/[f, g];
|
| +''');
|
| + var v = mainUnit.topLevelVariables[0];
|
| + expect(v.type.toString(), 'List<([int]) → Object>');
|
| + }
|
| +
|
| + void test_inferedType_usesSyntheticFunctionType_requiredParam() {
|
| + var mainUnit = checkFile('''
|
| +int f(int x) => null;
|
| +String g(int x) => null;
|
| +var v = /*info:INFERRED_TYPE_LITERAL*/[f, g];
|
| +''');
|
| + var v = mainUnit.topLevelVariables[0];
|
| + expect(v.type.toString(), 'List<(int) → Object>');
|
| + }
|
| +
|
| void test_inferenceInCyclesIsDeterministic() {
|
| addFile(
|
| '''
|
| @@ -3082,6 +3132,17 @@ class Point<T extends num> {
|
| ''');
|
| }
|
|
|
| + void test_staticMethod_tearoff() {
|
| + var mainUnit = checkFile('''
|
| +const v = C.f;
|
| +class C {
|
| + static int f(String s) => null;
|
| +}
|
| +''');
|
| + var v = mainUnit.topLevelVariables[0];
|
| + expect(v.type.toString(), '(String) → int');
|
| + }
|
| +
|
| void test_staticRefersToNonStaticField_inOtherLibraryCycle() {
|
| addFile(
|
| '''
|
|
|