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

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

Issue 1615963003: Issue 25522. Insert a synthetic '>' for incomplete type arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 8a58874c299d1de70cc5f94498c54de8cb85ab71..e9953a0dead506bff41b55ab78dc5a20eff5ea14 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -3710,6 +3710,36 @@ class C {
expect(statement.toSource(), 'List<String> v;');
}
+ void test_incompleteParameterizedType_field() {
Brian Wilkerson 2016/01/21 19:25:12 The method _expectGT is also used for type paramet
scheglov 2016/01/21 21:03:47 Done.
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(
+ r'''
+class C {
+ final List<int f;
+}''',
+ [ParserErrorCode.EXPECTED_TOKEN]);
+ // one class
+ List<CompilationUnitMember> declarations = unit.declarations;
+ expect(declarations, hasLength(1));
+ ClassDeclaration classDecl = declarations[0] as ClassDeclaration;
+ // one field declaration
+ List<ClassMember> members = classDecl.members;
+ expect(members, hasLength(1));
+ FieldDeclaration fieldDecl = members[0] as FieldDeclaration;
+ // one field
+ VariableDeclarationList fieldList = fieldDecl.fields;
+ List<VariableDeclaration> fields = fieldList.variables;
+ expect(fields, hasLength(1));
+ VariableDeclaration field = fields[0];
+ expect(field.name.name, 'f');
+ // validate the type
+ TypeArgumentList typeArguments = fieldList.type.typeArguments;
+ expect(typeArguments.arguments, hasLength(1));
+ // synthetic '>'
+ Token token = typeArguments.endToken;
+ expect(token.type, TokenType.GT);
+ expect(token.isSynthetic, isTrue);
+ }
+
void test_invalidFunctionBodyModifier() {
ParserTestCase.parseCompilationUnit(
"f() sync {}", [ParserErrorCode.MISSING_STAR_AFTER_SYNC]);
« pkg/analyzer/lib/src/generated/parser.dart ('K') | « 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