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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_test.dart

Issue 1960933002: Fix AST summarization of synthetic function types and method tear-offs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
'''
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698