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

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

Issue 1568643002: clean up generic methods in resolution (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: deprecate FunctionMember Created 4 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/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 1f1f2a57329554b16abec9aed6fbcc49fe4a746a..7f19e7a7c2d1cf2539917793999e0870fa2f8a74 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -13063,7 +13063,7 @@ main() {
SimpleIdentifier f = _findIdentifier('f');
FunctionElementImpl e = f.staticElement;
expect(e.typeParameters.toString(), '[T]');
- expect(e.type.boundTypeParameters.toString(), '[T]');
+ expect(e.type.typeFormals.toString(), '[T]');
expect(e.type.typeParameters.toString(), '[]');
expect(e.type.toString(), '<T>(T) → T');
@@ -13076,7 +13076,7 @@ main() {
SimpleIdentifier f = _findIdentifier('f');
FunctionElementImpl e = f.staticElement;
expect(e.typeParameters.toString(), '[T extends num]');
- expect(e.type.boundTypeParameters.toString(), '[T extends num]');
+ expect(e.type.typeFormals.toString(), '[T extends num]');
expect(e.type.typeParameters.toString(), '[]');
expect(e.type.toString(), '<T extends num>(T) → T');
}
@@ -13090,7 +13090,7 @@ class C<E> {
SimpleIdentifier f = _findIdentifier('f');
MethodElementImpl e = f.staticElement;
expect(e.typeParameters.toString(), '[T]');
- expect(e.type.boundTypeParameters.toString(), '[T]');
+ expect(e.type.typeFormals.toString(), '[T]');
// TODO(jmesserly): we could get rid of this {E/E} substitution, but it's
// probably harmless, as E won't be used in the function (error verifier
// checks this), and {E/E} is a no-op anyway.
@@ -13189,7 +13189,7 @@ main() {
SimpleIdentifier f = _findIdentifier('f');
MethodElementImpl e = f.staticElement;
expect(e.typeParameters.toString(), '[T]');
- expect(e.type.boundTypeParameters.toString(), '[T]');
+ expect(e.type.typeFormals.toString(), '[T]');
expect(e.type.typeParameters.toString(), '[E]');
expect(e.type.typeArguments.toString(), '[E]');
expect(e.type.toString(), '<T>(E) → List<T>');
@@ -13212,8 +13212,8 @@ main() {
var x = cOfString.f/*<int>*/('hi');
}
''');
- SimpleIdentifier f = _findIdentifier('f/*<int>*/');
- FunctionType ft = f.staticType;
+ MethodInvocation f = _findIdentifier('f/*<int>*/').parent;
+ FunctionType ft = f.staticInvokeType;
expect(ft.toString(), '(String) → List<int>');
expect('${ft.typeArguments}/${ft.typeParameters}', '[String, int]/[E, T]');
@@ -13234,7 +13234,7 @@ main() {
SimpleIdentifier f = _findIdentifier('f');
MethodElementImpl e = f.staticElement;
expect(e.typeParameters.toString(), '[T]');
- expect(e.type.boundTypeParameters.toString(), '[T]');
+ expect(e.type.typeFormals.toString(), '[T]');
expect(e.type.typeParameters.toString(), '[E]');
expect(e.type.typeArguments.toString(), '[E]');
expect(e.type.toString(), '<T>((E) → T) → List<T>');
@@ -13261,10 +13261,14 @@ void foo() {
}''');
SimpleIdentifier map1 = _findIdentifier('map((e) => e);');
- expect(map1.staticType.toString(), '((dynamic) → dynamic) → dynamic');
+ MethodInvocation m1 = map1.parent;
+ expect(m1.staticInvokeType.toString(), '((dynamic) → dynamic) → dynamic');
+ expect(map1.staticType, isNull);
expect(map1.propagatedType, isNull);
SimpleIdentifier map2 = _findIdentifier('map((e) => 3);');
- expect(map2.staticType.toString(), '((dynamic) → int) → int');
+ MethodInvocation m2 = map2.parent;
+ expect(m2.staticInvokeType.toString(), '((dynamic) → int) → int');
+ expect(map2.staticType, isNull);
expect(map2.propagatedType, isNull);
}
@@ -13278,13 +13282,13 @@ class C<T> {
}
}
''');
- SimpleIdentifier f = _findIdentifier('f/*<int>*/(3);');
- expect(f.staticType.toString(), '(int) → S');
- FunctionType ft = f.staticType;
+ MethodInvocation f = _findIdentifier('f/*<int>*/(3);').parent;
+ expect(f.staticInvokeType.toString(), '(int) → S');
+ FunctionType ft = f.staticInvokeType;
expect('${ft.typeArguments}/${ft.typeParameters}', '[S, int]/[T, S]');
- f = _findIdentifier('f;');
- expect(f.staticType.toString(), '<S₀>(S₀) → S');
+ SimpleIdentifier f2 = _findIdentifier('f;');
+ expect(f2.staticType.toString(), '<S₀>(S₀) → S');
}
void test_genericMethod_nestedFunctions() {
@@ -13313,7 +13317,7 @@ class D extends C {
_findIdentifier('f/*<T>*/(/*=T*/ x) => null; // from D');
MethodElementImpl e = f.staticElement;
expect(e.typeParameters.toString(), '[T]');
- expect(e.type.boundTypeParameters.toString(), '[T]');
+ expect(e.type.typeFormals.toString(), '[T]');
expect(e.type.toString(), '<T>(T) → T');
FunctionType ft = e.type.instantiate([typeProvider.stringType]);

Powered by Google App Engine
This is Rietveld 408576698