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

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

Issue 1692993004: Fix for type parameters of a local generic function in a static generic method of a generic class. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/lib/src/dart/element/type.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/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 396df79a7279c0e04689ae66faf4043785a20dc0..c29790ef53246c5247d5fa56233f7f13d880f605 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -10253,27 +10253,50 @@ main() {
resetWithOptions(options);
String code = r'''
class C<T> {
- static void m<S>(S s) => null;
+ static void m<S>(S s) {
+ void f<U>(S s, U u) {}
+ print(f);
+ }
}
main() {
print(C.m);
}
''';
_resolveTestUnit(code);
- SimpleIdentifier identifier = _findIdentifier('m);');
- FunctionTypeImpl type = identifier.staticType;
- expect(type.toString(), '<S>(S) → void');
- expect(type.typeParameters, isEmpty,
- reason: 'static methods should not have type parameters');
- expect(type.typeArguments, isEmpty,
- reason: 'static methods should not have type arguments');
- expect(type.typeFormals.toString(), '[S]');
-
- type = type.instantiate([DynamicTypeImpl.instance]);
- expect(type.toString(), '(dynamic) → void');
- expect(type.typeParameters.toString(), '[S]');
- expect(type.typeArguments, [DynamicTypeImpl.instance]);
- expect(type.typeFormals, isEmpty);
+ // C - m
+ TypeParameterType typeS;
+ {
+ SimpleIdentifier identifier = _findIdentifier('m);');
+ FunctionTypeImpl type = identifier.staticType;
+ expect(type.toString(), '<S>(S) → void');
+ expect(type.typeParameters, isEmpty,
+ reason: 'static methods should not have type parameters');
+ expect(type.typeArguments, isEmpty,
+ reason: 'static methods should not have type arguments');
+ expect(type.typeFormals.toString(), '[S]');
+ typeS = type.typeFormals[0].type;
+
+ type = type.instantiate([DynamicTypeImpl.instance]);
+ expect(type.toString(), '(dynamic) → void');
+ expect(type.typeParameters.toString(), '[S]');
+ expect(type.typeArguments, [DynamicTypeImpl.instance]);
+ expect(type.typeFormals, isEmpty);
+ }
+ // C - m - f
+ {
+ SimpleIdentifier identifier = _findIdentifier('f);');
+ FunctionTypeImpl type = identifier.staticType;
+ expect(type.toString(), '<U>(S, U) → void');
+ expect(type.typeParameters.toString(), '[S]');
+ expect(type.typeArguments.toString(), '[S]');
+ expect(type.typeFormals.toString(), '[U]');
+
+ type = type.instantiate([DynamicTypeImpl.instance]);
+ expect(type.toString(), '(S, dynamic) → void');
+ expect(type.typeParameters.toString(), '[S, U]');
+ expect(type.typeArguments, [typeS, DynamicTypeImpl.instance]);
+ expect(type.typeFormals, isEmpty);
+ }
}
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/type.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698