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

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

Issue 2809773005: Fix parsing of generic function types as return types (Closed)
Patch Set: remove test 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/parser.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/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index bf816452f190dbc80bccdaec47b7cb314677022f..57e81b22d6072a156d73924c80fa6237a183fd16 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -10040,6 +10040,26 @@ class SimpleParserTest extends ParserTestCase {
expect(arguments, hasLength(3));
}
+ void test_parseClassMember_method_gftReturnType() {
+ createParser('''
+void Function<A>(core.List<core.int> x) m() => null;
+''');
+ ClassMember member = parser.parseClassMember('C');
+ expect(member, new isInstanceOf<MethodDeclaration>());
+ expect((member as MethodDeclaration).body,
+ new isInstanceOf<ExpressionFunctionBody>());
+ }
+
+ void test_parseClassMember_method_noReturnType() {
+ createParser('''
+Function<A>(core.List<core.int> x) m() => null;
+''');
+ ClassMember member = parser.parseClassMember('C');
+ expect(member, new isInstanceOf<MethodDeclaration>());
+ expect((member as MethodDeclaration).body,
+ new isInstanceOf<ExpressionFunctionBody>());
+ }
+
void test_parseCombinator_hide() {
createParser('hide a;');
Combinator combinator = parser.parseCombinator();
@@ -10640,6 +10660,24 @@ void''');
expect(reference.offset, 15);
}
+ void test_parseCompilationUnitMember_function_gftReturnType() {
+ createParser('''
+void Function<A>(core.List<core.int> x) f() => null;
+''');
+ CompilationUnit unit = parser.parseCompilationUnit2();
+ expect(unit, isNotNull);
+ expect(unit.declarations, hasLength(1));
+ }
+
+ void test_parseCompilationUnitMember_function_noReturnType() {
+ createParser('''
+Function<A>(core.List<core.int> x) f() => null;
+''');
+ CompilationUnit unit = parser.parseCompilationUnit2();
+ expect(unit, isNotNull);
+ expect(unit.declarations, hasLength(1));
+ }
+
void test_parseConfiguration_noOperator_dottedIdentifier() {
createParser("if (a.b) 'c.dart'");
Configuration configuration = parser.parseConfiguration();
@@ -11303,6 +11341,34 @@ void''');
expect(typeName.typeArguments, isNull);
}
+ void test_parseStatement_function_gftReturnType() {
+ createParser('''
+void Function<A>(core.List<core.int> x) m() => null;
+''');
+ Statement statement = parser.parseStatement2();
+ expect(statement, new isInstanceOf<FunctionDeclarationStatement>());
+ expect(
+ (statement as FunctionDeclarationStatement)
+ .functionDeclaration
+ .functionExpression
+ .body,
+ new isInstanceOf<ExpressionFunctionBody>());
+ }
+
+ void test_parseStatement_function_noReturnType() {
+ createParser('''
+Function<A>(core.List<core.int> x) m() => null;
+''');
+ Statement statement = parser.parseStatement2();
+ expect(statement, new isInstanceOf<FunctionDeclarationStatement>());
+ expect(
+ (statement as FunctionDeclarationStatement)
+ .functionDeclaration
+ .functionExpression
+ .body,
+ new isInstanceOf<ExpressionFunctionBody>());
+ }
+
void test_parseStatements_multiple() {
List<Statement> statements = parseStatements("return; return;", 2);
expect(statements, hasLength(2));
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698