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

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

Issue 2814223002: Support for generic function as type arguments in DeclarationResolver. (Closed)
Patch Set: Created 3 years, 8 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/generated/declaration_resolver.dart ('k') | tests/language/language_analyzer2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/declaration_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/declaration_resolver_test.dart b/pkg/analyzer/test/generated/declaration_resolver_test.dart
index 38d635eae049375f0984e66ce3dcc171b1497d87..8b0a4e3e3896d06b944e7c35c6a6a93ea748ad4d 100644
--- a/pkg/analyzer/test/generated/declaration_resolver_test.dart
+++ b/pkg/analyzer/test/generated/declaration_resolver_test.dart
@@ -520,6 +520,57 @@ int Function(int, String) v;
// no other validations than built into DeclarationResolver
}
+ test_genericFunction_asTypeArgument() async {
+ String code = r'''
+List<Function(int)> v;
+''';
+ CompilationUnit unit = await resolveSource(code);
+ // re-resolve
+ _cloneResolveUnit(unit);
+ // no other validations than built into DeclarationResolver
+ }
+
+ test_genericFunction_asTypeArgument_lessNodes() async {
+ String code = r'''
+Map<Function<int>> v;
+''';
+ CompilationUnit unit = await resolveSource(code);
+ // re-resolve
+ _cloneResolveUnit(unit);
+ // no other validations than built into DeclarationResolver
+ }
+
+ test_genericFunction_asTypeArgument_moreNodes() async {
+ String code = r'''
+List<Function<int>, Function<String>> v;
+''';
+ CompilationUnit unit = await resolveSource(code);
+ // re-resolve
+ _cloneResolveUnit(unit);
+ // no other validations than built into DeclarationResolver
+ }
+
+ test_genericFunction_asTypeArgument_noNodes() async {
+ String code = r'''
+List v;
+''';
+ CompilationUnit unit = await resolveSource(code);
+ // re-resolve
+ _cloneResolveUnit(unit);
+ // no other validations than built into DeclarationResolver
+ }
+
+ test_genericFunction_asTypeArgument_ofInitializer() async {
+ String code = r'''
+var v = <Function(int)>[];
+''';
+ CompilationUnit unit = await resolveSource(code);
+ CompilationUnit newUnit = _cloneResolveUnit(unit);
+ var v = newUnit.declarations[0] as TopLevelVariableDeclaration;
+ var initializer = v.variables.variables[0].initializer as ListLiteral;
+ expect(initializer.typeArguments.arguments[0].type, isNotNull);
+ }
+
test_invalid_functionDeclaration_getter_inFunction() async {
String code = r'''
var v = (() {
« no previous file with comments | « pkg/analyzer/lib/src/generated/declaration_resolver.dart ('k') | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698