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

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

Issue 2028713003: Fix AST-based type inference with explicit type parameters for method calls. (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
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 e2d48be0a9091d208e325798429753e75070f4cf..46e7434e1ca442b8853cfb0092776f0c45a3514c 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -3367,6 +3367,54 @@ var x = { null: null };
expect(x.type.toString(), 'Map<dynamic, dynamic>');
}
+ void test_methodCall_withTypeArguments_instanceMethod() {
+ var mainUnit = checkFile('''
+class C {
+ D/*<T>*/ f/*<T>*/() => null;
+}
+class D<T> {}
+var f = new C().f/*<int>*/();
+''');
+ var v = mainUnit.topLevelVariables[0];
+ expect(v.type.toString(), 'D<int>');
+ }
+
+ void test_methodCall_withTypeArguments_instanceMethod_identifierSequence() {
+ var mainUnit = checkFile('''
+class C {
+ D/*<T>*/ f/*<T>*/() => null;
+}
+class D<T> {}
+C c;
+var f = c.f/*<int>*/();
+''');
+ var v = mainUnit.topLevelVariables[1];
+ expect(v.name, 'f');
+ expect(v.type.toString(), 'D<int>');
+ }
+
+ void test_methodCall_withTypeArguments_staticMethod() {
+ var mainUnit = checkFile('''
+class C {
+ static D/*<T>*/ f/*<T>*/() => null;
+}
+class D<T> {}
+var f = C.f/*<int>*/();
+''');
+ var v = mainUnit.topLevelVariables[0];
+ expect(v.type.toString(), 'D<int>');
+ }
+
+ void test_methodCall_withTypeArguments_topLevelFunction() {
+ var mainUnit = checkFile('''
+D/*<T>*/ f/*<T>*/() => null;
+class D<T> {}
+var g = f/*<int>*/();
+''');
+ var v = mainUnit.topLevelVariables[0];
+ expect(v.type.toString(), 'D<int>');
+ }
+
void test_noErrorWhenDeclaredTypeIsNumAndAssignedNull() {
checkFile('''
test1() {
« pkg/analyzer/lib/src/summary/idl.dart ('K') | « pkg/analyzer/test/src/summary/summary_common.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698