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

Unified Diff: pkg/analyzer/test/src/summary/summary_common.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/summary/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index a2329abe1eea8d9dfadaf7bd16a277ff15185493..a3e26959dfe1dffd8f8c166d41632c8e6a929b45 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -1790,7 +1790,8 @@ foo(a, b) {}
0,
0,
0,
- 2
+ 2,
+ 0
],
referenceValidators: [
(EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -1821,7 +1822,8 @@ foo(a, b, c) {}
0,
1,
0,
- 3
+ 3,
+ 0
],
referenceValidators: [
(EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -2322,7 +2324,8 @@ const v = const Foo();
], ints: [
42,
0,
- 2
+ 2,
+ 0
], referenceValidators: [
(EntityRef r) {
checkTypeRef(r, 'dart:core', 'dart:core', 'identical',
@@ -6881,9 +6884,9 @@ final v = a..m(5).abs()..m(6);
UnlinkedConstOperation.cascadeSectionEnd,
],
ints: [
- 5, 0, 1, // m(5)
- 0, 0, // abs()
- 6, 0, 1, // m(5)
+ 5, 0, 1, 0, // m(5)
+ 0, 0, 0, // abs()
+ 6, 0, 1, 0, // m(5)
],
strings: [
'm',
@@ -6977,7 +6980,8 @@ foo(a, b) {}
0,
0,
0,
- 2
+ 2,
+ 0
],
referenceValidators: [
(EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -7008,7 +7012,8 @@ foo(a, b, c) {}
0,
1,
0,
- 3
+ 3,
+ 0
],
referenceValidators: [
(EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -7118,6 +7123,7 @@ final v = ((a, b) => 42)(1, 2);
],
ints: [
0,
+ 0,
0
]);
}
@@ -7142,6 +7148,7 @@ final v = ((a, b) => 42)(1, 2);
],
ints: [
0,
+ 0,
0
]);
}
@@ -7279,7 +7286,8 @@ final v = new C().m(1, b: 2, c: 3);
2,
3,
2,
- 1
+ 1,
+ 0
],
strings: [
'b',
@@ -7292,6 +7300,39 @@ final v = new C().m(1, b: 2, c: 3);
]);
}
+ test_expr_invokeMethod_withTypeParameters() {
+ if (skipNonConstInitializers) {
+ return;
+ }
+ UnlinkedVariable variable = serializeVariableText('''
+class C {
+ f<T, U>() => null;
+}
+final v = new C().f<int, String>();
+''');
+ _assertUnlinkedConst(variable.initializer.bodyExpr,
+ isValidConst: false,
+ operators: [
+ UnlinkedConstOperation.invokeConstructor,
+ UnlinkedConstOperation.invokeMethod
+ ],
+ ints: [
+ 0,
+ 0,
+ 0,
+ 0,
+ 2
+ ],
+ strings: [
+ 'f'
+ ],
+ referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'C'),
+ (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'int'),
+ (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'String')
+ ]);
+ }
+
test_expr_invokeMethodRef_instance() {
if (skipNonConstInitializers) {
return;
@@ -7320,7 +7361,8 @@ final v = a.b.c.m(10, 20);
10,
20,
0,
- 2
+ 2,
+ 0
],
strings: [],
referenceValidators: [
@@ -7357,6 +7399,7 @@ final v = p.C.m();
],
ints: [
0,
+ 0,
0
],
strings: [],
@@ -7388,7 +7431,8 @@ final v = f(u);
],
ints: [
0,
- 1
+ 1,
+ 0
],
referenceValidators: [
(EntityRef r) => checkTypeRef(r, null, null, 'u',
@@ -7398,6 +7442,33 @@ final v = f(u);
]);
}
+ test_expr_invokeMethodRef_withTypeParameters() {
+ if (skipNonConstInitializers) {
+ return;
+ }
+ UnlinkedVariable variable = serializeVariableText('''
+f<T, U>() => null;
+final v = f<int, String>();
+''');
+ _assertUnlinkedConst(variable.initializer.bodyExpr,
+ isValidConst: false,
+ operators: [
+ UnlinkedConstOperation.invokeMethodRef
+ ],
+ ints: [
+ 0,
+ 0,
+ 2
+ ],
+ referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'f',
+ expectedKind: ReferenceKind.topLevelFunction,
+ numTypeParameters: 2),
+ (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'int'),
+ (EntityRef r) => checkTypeRef(r, 'dart:core', 'dart:core', 'String')
+ ]);
+ }
+
test_expr_throwException() {
if (skipNonConstInitializers) {
return;
@@ -7524,6 +7595,7 @@ class C {
ints: [
1,
0,
+ 0,
0
],
strings: [],

Powered by Google App Engine
This is Rietveld 408576698