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

Side by Side Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 2700183002: Re-enable generic function type support in analyzer (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.generated.parser_test; 5 library analyzer.test.generated.parser_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 5914 matching lines...) Expand 10 before | Expand all | Expand 10 after
5925 expect(field.metadata, hasLength(0)); 5925 expect(field.metadata, hasLength(0));
5926 expect(field.staticKeyword, isNotNull); 5926 expect(field.staticKeyword, isNotNull);
5927 VariableDeclarationList list = field.fields; 5927 VariableDeclarationList list = field.fields;
5928 expect(list, isNotNull); 5928 expect(list, isNotNull);
5929 NodeList<VariableDeclaration> variables = list.variables; 5929 NodeList<VariableDeclaration> variables = list.variables;
5930 expect(variables, hasLength(1)); 5930 expect(variables, hasLength(1));
5931 VariableDeclaration variable = variables[0]; 5931 VariableDeclaration variable = variables[0];
5932 expect(variable.name, isNotNull); 5932 expect(variable.name, isNotNull);
5933 } 5933 }
5934 5934
5935 @failingTest
5936 void test_parseClassMember_getter_functionType() { 5935 void test_parseClassMember_getter_functionType() {
5937 createParser('int Function(int) get g {}'); 5936 createParser('int Function(int) get g {}');
5938 ClassMember member = parser.parseClassMember('C'); 5937 ClassMember member = parser.parseClassMember('C');
5939 expectNotNullIfNoErrors(member); 5938 expectNotNullIfNoErrors(member);
5940 listener.assertNoErrors(); 5939 listener.assertNoErrors();
5941 expect(member, new isInstanceOf<MethodDeclaration>()); 5940 expect(member, new isInstanceOf<MethodDeclaration>());
5942 MethodDeclaration method = member; 5941 MethodDeclaration method = member;
5943 expect(method.documentationComment, isNull); 5942 expect(method.documentationComment, isNull);
5944 expect(method.externalKeyword, isNull); 5943 expect(method.externalKeyword, isNull);
5945 expect(method.modifierKeyword, isNull); 5944 expect(method.modifierKeyword, isNull);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
6255 expect(method.modifierKeyword, isNull); 6254 expect(method.modifierKeyword, isNull);
6256 expect(method.propertyKeyword, isNull); 6255 expect(method.propertyKeyword, isNull);
6257 expect(method.returnType, isNotNull); 6256 expect(method.returnType, isNotNull);
6258 expect(method.name, isNotNull); 6257 expect(method.name, isNotNull);
6259 expect(method.operatorKeyword, isNull); 6258 expect(method.operatorKeyword, isNull);
6260 expect(method.typeParameters, isNull); 6259 expect(method.typeParameters, isNull);
6261 expect(method.parameters, isNotNull); 6260 expect(method.parameters, isNotNull);
6262 expect(method.body, isNotNull); 6261 expect(method.body, isNotNull);
6263 } 6262 }
6264 6263
6265 @failingTest
6266 void test_parseClassMember_method_returnType_functionType() { 6264 void test_parseClassMember_method_returnType_functionType() {
6267 createParser('int Function(String) m() {}'); 6265 createParser('int Function(String) m() {}');
6268 ClassMember member = parser.parseClassMember('C'); 6266 ClassMember member = parser.parseClassMember('C');
6269 expectNotNullIfNoErrors(member); 6267 expectNotNullIfNoErrors(member);
6270 listener.assertNoErrors(); 6268 listener.assertNoErrors();
6271 expect(member, new isInstanceOf<MethodDeclaration>()); 6269 expect(member, new isInstanceOf<MethodDeclaration>());
6272 MethodDeclaration method = member; 6270 MethodDeclaration method = member;
6273 expect(method.documentationComment, isNull); 6271 expect(method.documentationComment, isNull);
6274 expect(method.externalKeyword, isNull); 6272 expect(method.externalKeyword, isNull);
6275 expect(method.modifierKeyword, isNull); 6273 expect(method.modifierKeyword, isNull);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
6371 expect(method.modifierKeyword, isNull); 6369 expect(method.modifierKeyword, isNull);
6372 expect(method.propertyKeyword, isNull); 6370 expect(method.propertyKeyword, isNull);
6373 expect(method.returnType, isNotNull); 6371 expect(method.returnType, isNotNull);
6374 expect(method.name, isNotNull); 6372 expect(method.name, isNotNull);
6375 expect(method.operatorKeyword, isNull); 6373 expect(method.operatorKeyword, isNull);
6376 expect(method.typeParameters, isNull); 6374 expect(method.typeParameters, isNull);
6377 expect(method.parameters, isNotNull); 6375 expect(method.parameters, isNotNull);
6378 expect(method.body, isNotNull); 6376 expect(method.body, isNotNull);
6379 } 6377 }
6380 6378
6381 @failingTest
6382 void test_parseClassMember_operator_functionType() { 6379 void test_parseClassMember_operator_functionType() {
6383 createParser('int Function() operator +(int Function() f) {}'); 6380 createParser('int Function() operator +(int Function() f) {}');
6384 ClassMember member = parser.parseClassMember('C'); 6381 ClassMember member = parser.parseClassMember('C');
6385 expectNotNullIfNoErrors(member); 6382 expectNotNullIfNoErrors(member);
6386 listener.assertNoErrors(); 6383 listener.assertNoErrors();
6387 expect(member, new isInstanceOf<MethodDeclaration>()); 6384 expect(member, new isInstanceOf<MethodDeclaration>());
6388 MethodDeclaration method = member; 6385 MethodDeclaration method = member;
6389 expect(method.documentationComment, isNull); 6386 expect(method.documentationComment, isNull);
6390 expect(method.externalKeyword, isNull); 6387 expect(method.externalKeyword, isNull);
6391 expect(method.modifierKeyword, isNull); 6388 expect(method.modifierKeyword, isNull);
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
7977 expect(simpleParameter.covariantKeyword, isNotNull); 7974 expect(simpleParameter.covariantKeyword, isNotNull);
7978 expect(simpleParameter.identifier, isNotNull); 7975 expect(simpleParameter.identifier, isNotNull);
7979 expect(simpleParameter.keyword, isNotNull); 7976 expect(simpleParameter.keyword, isNotNull);
7980 expect(simpleParameter.type, isNotNull); 7977 expect(simpleParameter.type, isNotNull);
7981 expect(simpleParameter.kind, kind); 7978 expect(simpleParameter.kind, kind);
7982 expect(defaultParameter.separator, isNotNull); 7979 expect(defaultParameter.separator, isNotNull);
7983 expect(defaultParameter.defaultValue, isNotNull); 7980 expect(defaultParameter.defaultValue, isNotNull);
7984 expect(defaultParameter.kind, kind); 7981 expect(defaultParameter.kind, kind);
7985 } 7982 }
7986 7983
7987 @failingTest
7988 void test_parseFormalParameter_covariant_type_function() { 7984 void test_parseFormalParameter_covariant_type_function() {
7989 ParameterKind kind = ParameterKind.REQUIRED; 7985 ParameterKind kind = ParameterKind.REQUIRED;
7990 createParser('covariant String Function(int) a'); 7986 createParser('covariant String Function(int) a');
7991 FormalParameter parameter = parser.parseFormalParameter(kind); 7987 FormalParameter parameter = parser.parseFormalParameter(kind);
7992 expectNotNullIfNoErrors(parameter); 7988 expectNotNullIfNoErrors(parameter);
7993 listener.assertNoErrors(); 7989 listener.assertNoErrors();
7994 expect(parameter, new isInstanceOf<SimpleFormalParameter>()); 7990 expect(parameter, new isInstanceOf<SimpleFormalParameter>());
7995 SimpleFormalParameter simpleParameter = parameter; 7991 SimpleFormalParameter simpleParameter = parameter;
7996 expect(simpleParameter.covariantKeyword, isNotNull); 7992 expect(simpleParameter.covariantKeyword, isNotNull);
7997 expect(simpleParameter.identifier, isNotNull); 7993 expect(simpleParameter.identifier, isNotNull);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
8213 expect(simpleParameter.covariantKeyword, isNull); 8209 expect(simpleParameter.covariantKeyword, isNull);
8214 expect(simpleParameter.identifier, isNotNull); 8210 expect(simpleParameter.identifier, isNotNull);
8215 expect(simpleParameter.keyword, isNotNull); 8211 expect(simpleParameter.keyword, isNotNull);
8216 expect(simpleParameter.type, isNotNull); 8212 expect(simpleParameter.type, isNotNull);
8217 expect(simpleParameter.kind, kind); 8213 expect(simpleParameter.kind, kind);
8218 expect(defaultParameter.separator, isNotNull); 8214 expect(defaultParameter.separator, isNotNull);
8219 expect(defaultParameter.defaultValue, isNotNull); 8215 expect(defaultParameter.defaultValue, isNotNull);
8220 expect(defaultParameter.kind, kind); 8216 expect(defaultParameter.kind, kind);
8221 } 8217 }
8222 8218
8223 @failingTest
8224 void test_parseFormalParameter_type_function() { 8219 void test_parseFormalParameter_type_function() {
8225 ParameterKind kind = ParameterKind.REQUIRED; 8220 ParameterKind kind = ParameterKind.REQUIRED;
8226 createParser('String Function(int) a'); 8221 createParser('String Function(int) a');
8227 FormalParameter parameter = parser.parseFormalParameter(kind); 8222 FormalParameter parameter = parser.parseFormalParameter(kind);
8228 expectNotNullIfNoErrors(parameter); 8223 expectNotNullIfNoErrors(parameter);
8229 listener.assertNoErrors(); 8224 listener.assertNoErrors();
8230 expect(parameter, new isInstanceOf<SimpleFormalParameter>()); 8225 expect(parameter, new isInstanceOf<SimpleFormalParameter>());
8231 SimpleFormalParameter simpleParameter = parameter; 8226 SimpleFormalParameter simpleParameter = parameter;
8232 expect(simpleParameter.covariantKeyword, isNull); 8227 expect(simpleParameter.covariantKeyword, isNull);
8233 expect(simpleParameter.identifier, isNotNull); 8228 expect(simpleParameter.identifier, isNotNull);
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after
10011 void test_parseNonLabeledStatement_typeCast() { 10006 void test_parseNonLabeledStatement_typeCast() {
10012 createParser('double.NAN as num;'); 10007 createParser('double.NAN as num;');
10013 Statement statement = parser.parseNonLabeledStatement(); 10008 Statement statement = parser.parseNonLabeledStatement();
10014 expectNotNullIfNoErrors(statement); 10009 expectNotNullIfNoErrors(statement);
10015 listener.assertNoErrors(); 10010 listener.assertNoErrors();
10016 expect(statement, new isInstanceOf<ExpressionStatement>()); 10011 expect(statement, new isInstanceOf<ExpressionStatement>());
10017 ExpressionStatement expressionStatement = statement; 10012 ExpressionStatement expressionStatement = statement;
10018 expect(expressionStatement.expression, isNotNull); 10013 expect(expressionStatement.expression, isNotNull);
10019 } 10014 }
10020 10015
10016 void test_parseNonLabeledStatement_variableDeclaration_final_namedFunction() {
10017 createParser('final int Function = 0;');
10018 Statement statement = parser.parseNonLabeledStatement();
10019 expectNotNullIfNoErrors(statement);
10020 listener.assertNoErrors();
10021 }
10022
10021 void test_parseNormalFormalParameter_field_const_noType() { 10023 void test_parseNormalFormalParameter_field_const_noType() {
10022 createParser('const this.a)'); 10024 createParser('const this.a)');
10023 NormalFormalParameter parameter = parser.parseNormalFormalParameter(); 10025 NormalFormalParameter parameter = parser.parseNormalFormalParameter();
10024 expectNotNullIfNoErrors(parameter); 10026 expectNotNullIfNoErrors(parameter);
10025 listener.assertNoErrors(); 10027 listener.assertNoErrors();
10026 expect(parameter, new isInstanceOf<FieldFormalParameter>()); 10028 expect(parameter, new isInstanceOf<FieldFormalParameter>());
10027 FieldFormalParameter fieldParameter = parameter; 10029 FieldFormalParameter fieldParameter = parameter;
10028 expect(fieldParameter.keyword, isNotNull); 10030 expect(fieldParameter.keyword, isNotNull);
10029 expect(fieldParameter.type, isNull); 10031 expect(fieldParameter.type, isNull);
10030 expect(fieldParameter.identifier, isNotNull); 10032 expect(fieldParameter.identifier, isNotNull);
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
10932 RedirectingConstructorInvocation invocation = 10934 RedirectingConstructorInvocation invocation =
10933 parser.parseRedirectingConstructorInvocation(false); 10935 parser.parseRedirectingConstructorInvocation(false);
10934 expectNotNullIfNoErrors(invocation); 10936 expectNotNullIfNoErrors(invocation);
10935 listener.assertNoErrors(); 10937 listener.assertNoErrors();
10936 expect(invocation.argumentList, isNotNull); 10938 expect(invocation.argumentList, isNotNull);
10937 expect(invocation.constructorName, isNull); 10939 expect(invocation.constructorName, isNull);
10938 expect(invocation.thisKeyword, isNotNull); 10940 expect(invocation.thisKeyword, isNotNull);
10939 expect(invocation.period, isNull); 10941 expect(invocation.period, isNull);
10940 } 10942 }
10941 10943
10942 @failingTest
10943 void test_parseRelationalExpression_as_functionType_noReturnType() { 10944 void test_parseRelationalExpression_as_functionType_noReturnType() {
10944 createParser('x as Function(int)'); 10945 createParser('x as Function(int)');
10945 Expression expression = parser.parseRelationalExpression(); 10946 Expression expression = parser.parseRelationalExpression();
10946 expectNotNullIfNoErrors(expression); 10947 expectNotNullIfNoErrors(expression);
10947 listener.assertNoErrors(); 10948 listener.assertNoErrors();
10948 expect(expression, new isInstanceOf<AsExpression>()); 10949 expect(expression, new isInstanceOf<AsExpression>());
10949 AsExpression asExpression = expression; 10950 AsExpression asExpression = expression;
10950 expect(asExpression.expression, isNotNull); 10951 expect(asExpression.expression, isNotNull);
10951 expect(asExpression.asOperator, isNotNull); 10952 expect(asExpression.asOperator, isNotNull);
10952 expect(asExpression.type, new isInstanceOf<GenericFunctionType>()); 10953 expect(asExpression.type, new isInstanceOf<GenericFunctionType>());
10953 } 10954 }
10954 10955
10955 @failingTest
10956 void test_parseRelationalExpression_as_functionType_returnType() { 10956 void test_parseRelationalExpression_as_functionType_returnType() {
10957 createParser('x as String Function(int)'); 10957 createParser('x as String Function(int)');
10958 Expression expression = parser.parseRelationalExpression(); 10958 Expression expression = parser.parseRelationalExpression();
10959 expectNotNullIfNoErrors(expression); 10959 expectNotNullIfNoErrors(expression);
10960 listener.assertNoErrors(); 10960 listener.assertNoErrors();
10961 expect(expression, new isInstanceOf<AsExpression>()); 10961 expect(expression, new isInstanceOf<AsExpression>());
10962 AsExpression asExpression = expression; 10962 AsExpression asExpression = expression;
10963 expect(asExpression.expression, isNotNull); 10963 expect(asExpression.expression, isNotNull);
10964 expect(asExpression.asOperator, isNotNull); 10964 expect(asExpression.asOperator, isNotNull);
10965 expect(asExpression.type, new isInstanceOf<GenericFunctionType>()); 10965 expect(asExpression.type, new isInstanceOf<GenericFunctionType>());
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
11101 void test_parseReturnStatement_value() { 11101 void test_parseReturnStatement_value() {
11102 createParser('return x;'); 11102 createParser('return x;');
11103 ReturnStatement statement = parser.parseReturnStatement(); 11103 ReturnStatement statement = parser.parseReturnStatement();
11104 expectNotNullIfNoErrors(statement); 11104 expectNotNullIfNoErrors(statement);
11105 listener.assertNoErrors(); 11105 listener.assertNoErrors();
11106 expect(statement.returnKeyword, isNotNull); 11106 expect(statement.returnKeyword, isNotNull);
11107 expect(statement.expression, isNotNull); 11107 expect(statement.expression, isNotNull);
11108 expect(statement.semicolon, isNotNull); 11108 expect(statement.semicolon, isNotNull);
11109 } 11109 }
11110 11110
11111 @failingTest
11112 void test_parseReturnType_function() { 11111 void test_parseReturnType_function() {
11113 createParser('A<B> Function<B>(B)'); 11112 createParser('A<B> Function<B>(B)');
11114 GenericFunctionType type = parser.parseReturnType(false); 11113 GenericFunctionType type = parser.parseReturnType(false);
11115 expectNotNullIfNoErrors(type); 11114 expectNotNullIfNoErrors(type);
11116 listener.assertNoErrors(); 11115 listener.assertNoErrors();
11117 expect(type.returnType, isNotNull); 11116 expect(type.returnType, isNotNull);
11118 expect(type.typeParameters, isNotNull); 11117 expect(type.typeParameters, isNotNull);
11119 expect(type.parameters, isNotNull); 11118 expect(type.parameters, isNotNull);
11120 } 11119 }
11121 11120
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
11934 expect(clause.exceptionType, isNotNull); 11933 expect(clause.exceptionType, isNotNull);
11935 expect(clause.catchKeyword, isNotNull); 11934 expect(clause.catchKeyword, isNotNull);
11936 expect(clause.exceptionParameter, isNotNull); 11935 expect(clause.exceptionParameter, isNotNull);
11937 expect(clause.comma, isNotNull); 11936 expect(clause.comma, isNotNull);
11938 expect(clause.stackTraceParameter, isNotNull); 11937 expect(clause.stackTraceParameter, isNotNull);
11939 expect(clause.body, isNotNull); 11938 expect(clause.body, isNotNull);
11940 expect(statement.finallyKeyword, isNotNull); 11939 expect(statement.finallyKeyword, isNotNull);
11941 expect(statement.finallyBlock, isNotNull); 11940 expect(statement.finallyBlock, isNotNull);
11942 } 11941 }
11943 11942
11944 @failingTest
11945 void test_parseTypeAnnotation_function_noReturnType_noParameters() { 11943 void test_parseTypeAnnotation_function_noReturnType_noParameters() {
11946 createParser('Function() v'); 11944 createParser('Function() v');
11947 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 11945 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
11948 expectNotNullIfNoErrors(functionType); 11946 expectNotNullIfNoErrors(functionType);
11949 listener.assertNoErrors(); 11947 listener.assertNoErrors();
11950 expect(functionType.returnType, isNull); 11948 expect(functionType.returnType, isNull);
11951 expect(functionType.functionKeyword, isNotNull); 11949 expect(functionType.functionKeyword, isNotNull);
11952 expect(functionType.typeParameters, isNull); 11950 expect(functionType.typeParameters, isNull);
11953 FormalParameterList parameterList = functionType.parameters; 11951 FormalParameterList parameterList = functionType.parameters;
11954 expect(parameterList, isNotNull); 11952 expect(parameterList, isNotNull);
11955 expect(parameterList.parameters, hasLength(0)); 11953 expect(parameterList.parameters, hasLength(0));
11956 } 11954 }
11957 11955
11958 @failingTest
11959 void test_parseTypeAnnotation_function_noReturnType_parameters() { 11956 void test_parseTypeAnnotation_function_noReturnType_parameters() {
11960 createParser('Function(int, int) v'); 11957 createParser('Function(int, int) v');
11961 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 11958 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
11962 expectNotNullIfNoErrors(functionType); 11959 expectNotNullIfNoErrors(functionType);
11963 listener.assertNoErrors(); 11960 listener.assertNoErrors();
11964 expect(functionType.returnType, isNull); 11961 expect(functionType.returnType, isNull);
11965 expect(functionType.functionKeyword, isNotNull); 11962 expect(functionType.functionKeyword, isNotNull);
11966 expect(functionType.typeParameters, isNull); 11963 expect(functionType.typeParameters, isNull);
11967 FormalParameterList parameterList = functionType.parameters; 11964 FormalParameterList parameterList = functionType.parameters;
11968 expect(parameterList, isNotNull); 11965 expect(parameterList, isNotNull);
11969 NodeList<FormalParameter> parameters = parameterList.parameters; 11966 NodeList<FormalParameter> parameters = parameterList.parameters;
11970 expect(parameters, hasLength(2)); 11967 expect(parameters, hasLength(2));
11971 11968
11972 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>()); 11969 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>());
11973 SimpleFormalParameter parameter = parameters[0]; 11970 SimpleFormalParameter parameter = parameters[0];
11974 expect(parameter.identifier, isNull); 11971 expect(parameter.identifier, isNull);
11975 expect(parameter.type, new isInstanceOf<TypeName>()); 11972 expect(parameter.type, new isInstanceOf<TypeName>());
11976 expect((parameter.type as TypeName).name.name, 'int'); 11973 expect((parameter.type as TypeName).name.name, 'int');
11977 11974
11978 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>()); 11975 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>());
11979 parameter = parameters[1]; 11976 parameter = parameters[1];
11980 expect(parameter.identifier, isNull); 11977 expect(parameter.identifier, isNull);
11981 expect(parameter.type, new isInstanceOf<TypeName>()); 11978 expect(parameter.type, new isInstanceOf<TypeName>());
11982 expect((parameter.type as TypeName).name.name, 'int'); 11979 expect((parameter.type as TypeName).name.name, 'int');
11983 } 11980 }
11984 11981
11985 @failingTest
11986 void test_parseTypeAnnotation_function_noReturnType_typeParameters() { 11982 void test_parseTypeAnnotation_function_noReturnType_typeParameters() {
11987 createParser('Function<S, T>()'); 11983 createParser('Function<S, T>()');
11988 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 11984 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
11989 expectNotNullIfNoErrors(functionType); 11985 expectNotNullIfNoErrors(functionType);
11990 listener.assertNoErrors(); 11986 listener.assertNoErrors();
11991 expect(functionType.returnType, isNull); 11987 expect(functionType.returnType, isNull);
11992 expect(functionType.functionKeyword, isNotNull); 11988 expect(functionType.functionKeyword, isNotNull);
11993 TypeParameterList typeParameters = functionType.typeParameters; 11989 TypeParameterList typeParameters = functionType.typeParameters;
11994 expect(typeParameters, isNotNull); 11990 expect(typeParameters, isNotNull);
11995 expect(typeParameters.typeParameters, hasLength(2)); 11991 expect(typeParameters.typeParameters, hasLength(2));
11996 FormalParameterList parameterList = functionType.parameters; 11992 FormalParameterList parameterList = functionType.parameters;
11997 expect(parameterList, isNotNull); 11993 expect(parameterList, isNotNull);
11998 expect(parameterList.parameters, hasLength(0)); 11994 expect(parameterList.parameters, hasLength(0));
11999 } 11995 }
12000 11996
12001 @failingTest
12002 void 11997 void
12003 test_parseTypeAnnotation_function_noReturnType_typeParameters_parameters() { 11998 test_parseTypeAnnotation_function_noReturnType_typeParameters_parameters() {
12004 createParser('Function<T>(String, {T t})'); 11999 createParser('Function<T>(String, {T t})');
12005 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 12000 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
12006 expectNotNullIfNoErrors(functionType); 12001 expectNotNullIfNoErrors(functionType);
12007 listener.assertNoErrors(); 12002 listener.assertNoErrors();
12008 expect(functionType.returnType, isNull); 12003 expect(functionType.returnType, isNull);
12009 expect(functionType.functionKeyword, isNotNull); 12004 expect(functionType.functionKeyword, isNotNull);
12010 TypeParameterList typeParameters = functionType.typeParameters; 12005 TypeParameterList typeParameters = functionType.typeParameters;
12011 expect(typeParameters, isNotNull); 12006 expect(typeParameters, isNotNull);
12012 expect(typeParameters.typeParameters, hasLength(1)); 12007 expect(typeParameters.typeParameters, hasLength(1));
12013 FormalParameterList parameterList = functionType.parameters; 12008 FormalParameterList parameterList = functionType.parameters;
12014 expect(parameterList, isNotNull); 12009 expect(parameterList, isNotNull);
12015 expect(parameterList.parameters, hasLength(2)); 12010 expect(parameterList.parameters, hasLength(2));
12016 } 12011 }
12017 12012
12018 void test_parseTypeAnnotation_function_returnType_classFunction() { 12013 void test_parseTypeAnnotation_function_returnType_classFunction() {
12019 createParser('Function v'); 12014 createParser('Function v');
12020 TypeName functionType = parser.parseTypeAnnotation(false); 12015 TypeName functionType = parser.parseTypeAnnotation(false);
12021 expectNotNullIfNoErrors(functionType); 12016 expectNotNullIfNoErrors(functionType);
12022 listener.assertNoErrors(); 12017 listener.assertNoErrors();
12023 } 12018 }
12024 12019
12025 @failingTest
12026 void test_parseTypeAnnotation_function_returnType_function() { 12020 void test_parseTypeAnnotation_function_returnType_function() {
12027 createParser('A Function(B, C) Function(D) v'); 12021 createParser('A Function(B, C) Function(D) v');
12028 // TODO(scheglov) improve the test to verify also the node properties 12022 // TODO(scheglov) improve the test to verify also the node properties
12029 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType; 12023 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType;
12030 expectNotNullIfNoErrors(functionType); 12024 expectNotNullIfNoErrors(functionType);
12031 listener.assertNoErrors(); 12025 listener.assertNoErrors();
12032 } 12026 }
12033 12027
12034 @failingTest
12035 void test_parseTypeAnnotation_function_returnType_noParameters() { 12028 void test_parseTypeAnnotation_function_returnType_noParameters() {
12036 createParser('List<int> Function()'); 12029 createParser('List<int> Function()');
12037 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 12030 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
12038 expectNotNullIfNoErrors(functionType); 12031 expectNotNullIfNoErrors(functionType);
12039 listener.assertNoErrors(); 12032 listener.assertNoErrors();
12040 expect(functionType.returnType, isNotNull); 12033 expect(functionType.returnType, isNotNull);
12041 expect(functionType.functionKeyword, isNotNull); 12034 expect(functionType.functionKeyword, isNotNull);
12042 expect(functionType.typeParameters, isNull); 12035 expect(functionType.typeParameters, isNull);
12043 FormalParameterList parameterList = functionType.parameters; 12036 FormalParameterList parameterList = functionType.parameters;
12044 expect(parameterList, isNotNull); 12037 expect(parameterList, isNotNull);
12045 expect(parameterList.parameters, hasLength(0)); 12038 expect(parameterList.parameters, hasLength(0));
12046 } 12039 }
12047 12040
12048 @failingTest
12049 void test_parseTypeAnnotation_function_returnType_parameters() { 12041 void test_parseTypeAnnotation_function_returnType_parameters() {
12050 createParser('List<int> Function(String s, int i)'); 12042 createParser('List<int> Function(String s, int i)');
12051 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 12043 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
12052 expectNotNullIfNoErrors(functionType); 12044 expectNotNullIfNoErrors(functionType);
12053 listener.assertNoErrors(); 12045 listener.assertNoErrors();
12054 expect(functionType.returnType, isNotNull); 12046 expect(functionType.returnType, isNotNull);
12055 expect(functionType.functionKeyword, isNotNull); 12047 expect(functionType.functionKeyword, isNotNull);
12056 expect(functionType.typeParameters, isNull); 12048 expect(functionType.typeParameters, isNull);
12057 FormalParameterList parameterList = functionType.parameters; 12049 FormalParameterList parameterList = functionType.parameters;
12058 expect(parameterList, isNotNull); 12050 expect(parameterList, isNotNull);
12059 NodeList<FormalParameter> parameters = parameterList.parameters; 12051 NodeList<FormalParameter> parameters = parameterList.parameters;
12060 expect(parameters, hasLength(2)); 12052 expect(parameters, hasLength(2));
12061 12053
12062 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>()); 12054 expect(parameters[0], new isInstanceOf<SimpleFormalParameter>());
12063 SimpleFormalParameter parameter = parameters[0]; 12055 SimpleFormalParameter parameter = parameters[0];
12064 expect(parameter.identifier, isNotNull); 12056 expect(parameter.identifier, isNotNull);
12065 expect(parameter.identifier.name, 's'); 12057 expect(parameter.identifier.name, 's');
12066 expect(parameter.type, new isInstanceOf<TypeName>()); 12058 expect(parameter.type, new isInstanceOf<TypeName>());
12067 expect((parameter.type as TypeName).name.name, 'String'); 12059 expect((parameter.type as TypeName).name.name, 'String');
12068 12060
12069 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>()); 12061 expect(parameters[1], new isInstanceOf<SimpleFormalParameter>());
12070 parameter = parameters[1]; 12062 parameter = parameters[1];
12071 expect(parameter.identifier, isNotNull); 12063 expect(parameter.identifier, isNotNull);
12072 expect(parameter.identifier.name, 'i'); 12064 expect(parameter.identifier.name, 'i');
12073 expect(parameter.type, new isInstanceOf<TypeName>()); 12065 expect(parameter.type, new isInstanceOf<TypeName>());
12074 expect((parameter.type as TypeName).name.name, 'int'); 12066 expect((parameter.type as TypeName).name.name, 'int');
12075 } 12067 }
12076 12068
12077 @failingTest
12078 void test_parseTypeAnnotation_function_returnType_simple() { 12069 void test_parseTypeAnnotation_function_returnType_simple() {
12079 createParser('A Function(B, C) v'); 12070 createParser('A Function(B, C) v');
12080 // TODO(scheglov) improve the test to verify also the node properties 12071 // TODO(scheglov) improve the test to verify also the node properties
12081 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType; 12072 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType;
12082 expectNotNullIfNoErrors(functionType); 12073 expectNotNullIfNoErrors(functionType);
12083 listener.assertNoErrors(); 12074 listener.assertNoErrors();
12084 } 12075 }
12085 12076
12086 @failingTest
12087 void test_parseTypeAnnotation_function_returnType_typeParameters() { 12077 void test_parseTypeAnnotation_function_returnType_typeParameters() {
12088 createParser('List<T> Function<T>()'); 12078 createParser('List<T> Function<T>()');
12089 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 12079 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
12090 expectNotNullIfNoErrors(functionType); 12080 expectNotNullIfNoErrors(functionType);
12091 listener.assertNoErrors(); 12081 listener.assertNoErrors();
12092 expect(functionType.returnType, isNotNull); 12082 expect(functionType.returnType, isNotNull);
12093 expect(functionType.functionKeyword, isNotNull); 12083 expect(functionType.functionKeyword, isNotNull);
12094 TypeParameterList typeParameters = functionType.typeParameters; 12084 TypeParameterList typeParameters = functionType.typeParameters;
12095 expect(typeParameters, isNotNull); 12085 expect(typeParameters, isNotNull);
12096 expect(typeParameters.typeParameters, hasLength(1)); 12086 expect(typeParameters.typeParameters, hasLength(1));
12097 FormalParameterList parameterList = functionType.parameters; 12087 FormalParameterList parameterList = functionType.parameters;
12098 expect(parameterList, isNotNull); 12088 expect(parameterList, isNotNull);
12099 expect(parameterList.parameters, hasLength(0)); 12089 expect(parameterList.parameters, hasLength(0));
12100 } 12090 }
12101 12091
12102 @failingTest
12103 void 12092 void
12104 test_parseTypeAnnotation_function_returnType_typeParameters_parameters() { 12093 test_parseTypeAnnotation_function_returnType_typeParameters_parameters() {
12105 createParser('List<T> Function<T>(String s, [T])'); 12094 createParser('List<T> Function<T>(String s, [T])');
12106 GenericFunctionType functionType = parser.parseTypeAnnotation(false); 12095 GenericFunctionType functionType = parser.parseTypeAnnotation(false);
12107 expectNotNullIfNoErrors(functionType); 12096 expectNotNullIfNoErrors(functionType);
12108 listener.assertNoErrors(); 12097 listener.assertNoErrors();
12109 expect(functionType.returnType, isNotNull); 12098 expect(functionType.returnType, isNotNull);
12110 expect(functionType.functionKeyword, isNotNull); 12099 expect(functionType.functionKeyword, isNotNull);
12111 TypeParameterList typeParameters = functionType.typeParameters; 12100 TypeParameterList typeParameters = functionType.typeParameters;
12112 expect(typeParameters, isNotNull); 12101 expect(typeParameters, isNotNull);
12113 expect(typeParameters.typeParameters, hasLength(1)); 12102 expect(typeParameters.typeParameters, hasLength(1));
12114 FormalParameterList parameterList = functionType.parameters; 12103 FormalParameterList parameterList = functionType.parameters;
12115 expect(parameterList, isNotNull); 12104 expect(parameterList, isNotNull);
12116 expect(parameterList.parameters, hasLength(2)); 12105 expect(parameterList.parameters, hasLength(2));
12117 } 12106 }
12118 12107
12119 @failingTest
12120 void test_parseTypeAnnotation_function_returnType_withArguments() { 12108 void test_parseTypeAnnotation_function_returnType_withArguments() {
12121 createParser('A<B> Function(C) v'); 12109 createParser('A<B> Function(C) v');
12122 // TODO(scheglov) improve this test to verify also the node properties 12110 // TODO(scheglov) improve this test to verify also the node properties
12123 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType; 12111 var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType;
12124 expectNotNullIfNoErrors(functionType); 12112 expectNotNullIfNoErrors(functionType);
12125 listener.assertNoErrors(); 12113 listener.assertNoErrors();
12126 } 12114 }
12127 12115
12128 void test_parseTypeAnnotation_named() { 12116 void test_parseTypeAnnotation_named() {
12129 createParser('A<B> v'); 12117 createParser('A<B> v');
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
12261 enableNnbd = true; 12249 enableNnbd = true;
12262 createParser('String?'); 12250 createParser('String?');
12263 TypeName typeName = parser.parseTypeName(false); 12251 TypeName typeName = parser.parseTypeName(false);
12264 expectNotNullIfNoErrors(typeName); 12252 expectNotNullIfNoErrors(typeName);
12265 listener.assertNoErrors(); 12253 listener.assertNoErrors();
12266 expect(typeName.name, isNotNull); 12254 expect(typeName.name, isNotNull);
12267 expect(typeName.typeArguments, isNull); 12255 expect(typeName.typeArguments, isNull);
12268 expect(typeName.question, isNotNull); 12256 expect(typeName.question, isNotNull);
12269 } 12257 }
12270 12258
12271 @failingTest
12272 void test_parseTypeParameter_bounded_functionType_noReturn() { 12259 void test_parseTypeParameter_bounded_functionType_noReturn() {
12273 createParser('A extends Function(int)'); 12260 createParser('A extends Function(int)');
12274 TypeParameter parameter = parser.parseTypeParameter(); 12261 TypeParameter parameter = parser.parseTypeParameter();
12275 expectNotNullIfNoErrors(parameter); 12262 expectNotNullIfNoErrors(parameter);
12276 listener.assertNoErrors(); 12263 listener.assertNoErrors();
12277 expect(parameter.bound, new isInstanceOf<GenericFunctionType>()); 12264 expect(parameter.bound, new isInstanceOf<GenericFunctionType>());
12278 expect(parameter.extendsKeyword, isNotNull); 12265 expect(parameter.extendsKeyword, isNotNull);
12279 expect(parameter.name, isNotNull); 12266 expect(parameter.name, isNotNull);
12280 } 12267 }
12281 12268
12282 @failingTest
12283 void test_parseTypeParameter_bounded_functionType_return() { 12269 void test_parseTypeParameter_bounded_functionType_return() {
12284 createParser('A extends String Function(int)'); 12270 createParser('A extends String Function(int)');
12285 TypeParameter parameter = parser.parseTypeParameter(); 12271 TypeParameter parameter = parser.parseTypeParameter();
12286 expectNotNullIfNoErrors(parameter); 12272 expectNotNullIfNoErrors(parameter);
12287 listener.assertNoErrors(); 12273 listener.assertNoErrors();
12288 expect(parameter.bound, new isInstanceOf<GenericFunctionType>()); 12274 expect(parameter.bound, new isInstanceOf<GenericFunctionType>());
12289 expect(parameter.extendsKeyword, isNotNull); 12275 expect(parameter.extendsKeyword, isNotNull);
12290 expect(parameter.name, isNotNull); 12276 expect(parameter.name, isNotNull);
12291 } 12277 }
12292 12278
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after
14312 expect(typeAlias, isNotNull); 14298 expect(typeAlias, isNotNull);
14313 assertNoErrors(); 14299 assertNoErrors();
14314 expect(typeAlias.typedefKeyword, isNotNull); 14300 expect(typeAlias.typedefKeyword, isNotNull);
14315 expect(typeAlias.name, isNotNull); 14301 expect(typeAlias.name, isNotNull);
14316 expect(typeAlias.parameters, isNotNull); 14302 expect(typeAlias.parameters, isNotNull);
14317 expect(typeAlias.returnType, isNotNull); 14303 expect(typeAlias.returnType, isNotNull);
14318 expect(typeAlias.semicolon, isNotNull); 14304 expect(typeAlias.semicolon, isNotNull);
14319 expect(typeAlias.typeParameters, isNull); 14305 expect(typeAlias.typeParameters, isNull);
14320 } 14306 }
14321 14307
14322 @failingTest
14323 void test_parseTypeAlias_genericFunction_noParameters() { 14308 void test_parseTypeAlias_genericFunction_noParameters() {
14324 createParser('typedef F = bool Function();'); 14309 createParser('typedef F = bool Function();');
14325 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14310 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14326 expect(typeAlias, isNotNull); 14311 expect(typeAlias, isNotNull);
14327 assertNoErrors(); 14312 assertNoErrors();
14328 expect(typeAlias.typedefKeyword, isNotNull); 14313 expect(typeAlias.typedefKeyword, isNotNull);
14329 expect(typeAlias.name, isNotNull); 14314 expect(typeAlias.name, isNotNull);
14330 expect(typeAlias.typeParameters, isNull); 14315 expect(typeAlias.typeParameters, isNull);
14331 expect(typeAlias.semicolon, isNotNull); 14316 expect(typeAlias.semicolon, isNotNull);
14332 GenericFunctionType functionType = typeAlias.functionType; 14317 GenericFunctionType functionType = typeAlias.functionType;
14333 expect(functionType, isNotNull); 14318 expect(functionType, isNotNull);
14334 expect(functionType.parameters, isNotNull); 14319 expect(functionType.parameters, isNotNull);
14335 expect(functionType.returnType, isNotNull); 14320 expect(functionType.returnType, isNotNull);
14336 expect(functionType.typeParameters, isNull); 14321 expect(functionType.typeParameters, isNull);
14337 } 14322 }
14338 14323
14339 @failingTest
14340 void test_parseTypeAlias_genericFunction_noReturnType() { 14324 void test_parseTypeAlias_genericFunction_noReturnType() {
14341 createParser('typedef F = Function();'); 14325 createParser('typedef F = Function();');
14342 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14326 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14343 expect(typeAlias, isNotNull); 14327 expect(typeAlias, isNotNull);
14344 assertNoErrors(); 14328 assertNoErrors();
14345 expect(typeAlias.typedefKeyword, isNotNull); 14329 expect(typeAlias.typedefKeyword, isNotNull);
14346 expect(typeAlias.name, isNotNull); 14330 expect(typeAlias.name, isNotNull);
14347 expect(typeAlias.typeParameters, isNull); 14331 expect(typeAlias.typeParameters, isNull);
14348 expect(typeAlias.semicolon, isNotNull); 14332 expect(typeAlias.semicolon, isNotNull);
14349 GenericFunctionType functionType = typeAlias.functionType; 14333 GenericFunctionType functionType = typeAlias.functionType;
14350 expect(functionType, isNotNull); 14334 expect(functionType, isNotNull);
14351 expect(functionType.parameters, isNotNull); 14335 expect(functionType.parameters, isNotNull);
14352 expect(functionType.returnType, isNull); 14336 expect(functionType.returnType, isNull);
14353 expect(functionType.typeParameters, isNull); 14337 expect(functionType.typeParameters, isNull);
14354 } 14338 }
14355 14339
14356 @failingTest
14357 void test_parseTypeAlias_genericFunction_parameterizedReturnType() { 14340 void test_parseTypeAlias_genericFunction_parameterizedReturnType() {
14358 createParser('typedef F = A<B> Function();'); 14341 createParser('typedef F = A<B> Function();');
14359 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14342 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14360 expect(typeAlias, isNotNull); 14343 expect(typeAlias, isNotNull);
14361 assertNoErrors(); 14344 assertNoErrors();
14362 expect(typeAlias.typedefKeyword, isNotNull); 14345 expect(typeAlias.typedefKeyword, isNotNull);
14363 expect(typeAlias.name, isNotNull); 14346 expect(typeAlias.name, isNotNull);
14364 expect(typeAlias.typeParameters, isNull); 14347 expect(typeAlias.typeParameters, isNull);
14365 expect(typeAlias.semicolon, isNotNull); 14348 expect(typeAlias.semicolon, isNotNull);
14366 GenericFunctionType functionType = typeAlias.functionType; 14349 GenericFunctionType functionType = typeAlias.functionType;
14367 expect(functionType, isNotNull); 14350 expect(functionType, isNotNull);
14368 expect(functionType.parameters, isNotNull); 14351 expect(functionType.parameters, isNotNull);
14369 expect(functionType.returnType, isNotNull); 14352 expect(functionType.returnType, isNotNull);
14370 expect(functionType.typeParameters, isNull); 14353 expect(functionType.typeParameters, isNull);
14371 } 14354 }
14372 14355
14373 @failingTest
14374 void test_parseTypeAlias_genericFunction_parameters() { 14356 void test_parseTypeAlias_genericFunction_parameters() {
14375 createParser('typedef F = bool Function(Object value);'); 14357 createParser('typedef F = bool Function(Object value);');
14376 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14358 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14377 expect(typeAlias, isNotNull); 14359 expect(typeAlias, isNotNull);
14378 assertNoErrors(); 14360 assertNoErrors();
14379 expect(typeAlias.typedefKeyword, isNotNull); 14361 expect(typeAlias.typedefKeyword, isNotNull);
14380 expect(typeAlias.name, isNotNull); 14362 expect(typeAlias.name, isNotNull);
14381 expect(typeAlias.typeParameters, isNull); 14363 expect(typeAlias.typeParameters, isNull);
14382 expect(typeAlias.semicolon, isNotNull); 14364 expect(typeAlias.semicolon, isNotNull);
14383 GenericFunctionType functionType = typeAlias.functionType; 14365 GenericFunctionType functionType = typeAlias.functionType;
14384 expect(functionType, isNotNull); 14366 expect(functionType, isNotNull);
14385 expect(functionType.parameters, isNotNull); 14367 expect(functionType.parameters, isNotNull);
14386 expect(functionType.returnType, isNotNull); 14368 expect(functionType.returnType, isNotNull);
14387 expect(functionType.typeParameters, isNull); 14369 expect(functionType.typeParameters, isNull);
14388 } 14370 }
14389 14371
14390 @failingTest
14391 void test_parseTypeAlias_genericFunction_typeParameters() { 14372 void test_parseTypeAlias_genericFunction_typeParameters() {
14392 createParser('typedef F = bool Function<E>();'); 14373 createParser('typedef F = bool Function<E>();');
14393 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14374 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14394 expect(typeAlias, isNotNull); 14375 expect(typeAlias, isNotNull);
14395 assertNoErrors(); 14376 assertNoErrors();
14396 expect(typeAlias.typedefKeyword, isNotNull); 14377 expect(typeAlias.typedefKeyword, isNotNull);
14397 expect(typeAlias.name, isNotNull); 14378 expect(typeAlias.name, isNotNull);
14398 expect(typeAlias.typeParameters, isNull); 14379 expect(typeAlias.typeParameters, isNull);
14399 expect(typeAlias.semicolon, isNotNull); 14380 expect(typeAlias.semicolon, isNotNull);
14400 GenericFunctionType functionType = typeAlias.functionType; 14381 GenericFunctionType functionType = typeAlias.functionType;
14401 expect(functionType, isNotNull); 14382 expect(functionType, isNotNull);
14402 expect(functionType.parameters, isNotNull); 14383 expect(functionType.parameters, isNotNull);
14403 expect(functionType.returnType, isNotNull); 14384 expect(functionType.returnType, isNotNull);
14404 expect(functionType.typeParameters, isNotNull); 14385 expect(functionType.typeParameters, isNotNull);
14405 } 14386 }
14406 14387
14407 @failingTest
14408 void test_parseTypeAlias_genericFunction_typeParameters_noParameters() { 14388 void test_parseTypeAlias_genericFunction_typeParameters_noParameters() {
14409 createParser('typedef F<T> = bool Function();'); 14389 createParser('typedef F<T> = bool Function();');
14410 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14390 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14411 expect(typeAlias, isNotNull); 14391 expect(typeAlias, isNotNull);
14412 assertNoErrors(); 14392 assertNoErrors();
14413 expect(typeAlias.typedefKeyword, isNotNull); 14393 expect(typeAlias.typedefKeyword, isNotNull);
14414 expect(typeAlias.name, isNotNull); 14394 expect(typeAlias.name, isNotNull);
14415 expect(typeAlias.typeParameters, isNotNull); 14395 expect(typeAlias.typeParameters, isNotNull);
14416 expect(typeAlias.semicolon, isNotNull); 14396 expect(typeAlias.semicolon, isNotNull);
14417 GenericFunctionType functionType = typeAlias.functionType; 14397 GenericFunctionType functionType = typeAlias.functionType;
14418 expect(functionType, isNotNull); 14398 expect(functionType, isNotNull);
14419 expect(functionType.parameters, isNotNull); 14399 expect(functionType.parameters, isNotNull);
14420 expect(functionType.returnType, isNotNull); 14400 expect(functionType.returnType, isNotNull);
14421 expect(functionType.typeParameters, isNull); 14401 expect(functionType.typeParameters, isNull);
14422 } 14402 }
14423 14403
14424 @failingTest
14425 void test_parseTypeAlias_genericFunction_typeParameters_noReturnType() { 14404 void test_parseTypeAlias_genericFunction_typeParameters_noReturnType() {
14426 createParser('typedef F<T> = Function();'); 14405 createParser('typedef F<T> = Function();');
14427 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14406 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14428 expect(typeAlias, isNotNull); 14407 expect(typeAlias, isNotNull);
14429 assertNoErrors(); 14408 assertNoErrors();
14430 expect(typeAlias.typedefKeyword, isNotNull); 14409 expect(typeAlias.typedefKeyword, isNotNull);
14431 expect(typeAlias.name, isNotNull); 14410 expect(typeAlias.name, isNotNull);
14432 expect(typeAlias.typeParameters, isNotNull); 14411 expect(typeAlias.typeParameters, isNotNull);
14433 expect(typeAlias.semicolon, isNotNull); 14412 expect(typeAlias.semicolon, isNotNull);
14434 GenericFunctionType functionType = typeAlias.functionType; 14413 GenericFunctionType functionType = typeAlias.functionType;
14435 expect(functionType, isNotNull); 14414 expect(functionType, isNotNull);
14436 expect(functionType.parameters, isNotNull); 14415 expect(functionType.parameters, isNotNull);
14437 expect(functionType.returnType, isNull); 14416 expect(functionType.returnType, isNull);
14438 expect(functionType.typeParameters, isNull); 14417 expect(functionType.typeParameters, isNull);
14439 } 14418 }
14440 14419
14441 @failingTest
14442 void 14420 void
14443 test_parseTypeAlias_genericFunction_typeParameters_parameterizedReturnType () { 14421 test_parseTypeAlias_genericFunction_typeParameters_parameterizedReturnType () {
14444 createParser('typedef F<T> = A<B> Function();'); 14422 createParser('typedef F<T> = A<B> Function();');
14445 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14423 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14446 expect(typeAlias, isNotNull); 14424 expect(typeAlias, isNotNull);
14447 assertNoErrors(); 14425 assertNoErrors();
14448 expect(typeAlias.typedefKeyword, isNotNull); 14426 expect(typeAlias.typedefKeyword, isNotNull);
14449 expect(typeAlias.name, isNotNull); 14427 expect(typeAlias.name, isNotNull);
14450 expect(typeAlias.typeParameters, isNotNull); 14428 expect(typeAlias.typeParameters, isNotNull);
14451 expect(typeAlias.semicolon, isNotNull); 14429 expect(typeAlias.semicolon, isNotNull);
14452 GenericFunctionType functionType = typeAlias.functionType; 14430 GenericFunctionType functionType = typeAlias.functionType;
14453 expect(functionType, isNotNull); 14431 expect(functionType, isNotNull);
14454 expect(functionType.parameters, isNotNull); 14432 expect(functionType.parameters, isNotNull);
14455 expect(functionType.returnType, isNotNull); 14433 expect(functionType.returnType, isNotNull);
14456 expect(functionType.typeParameters, isNull); 14434 expect(functionType.typeParameters, isNull);
14457 } 14435 }
14458 14436
14459 @failingTest
14460 void test_parseTypeAlias_genericFunction_typeParameters_parameters() { 14437 void test_parseTypeAlias_genericFunction_typeParameters_parameters() {
14461 createParser('typedef F<T> = bool Function(Object value);'); 14438 createParser('typedef F<T> = bool Function(Object value);');
14462 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14439 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14463 expect(typeAlias, isNotNull); 14440 expect(typeAlias, isNotNull);
14464 assertNoErrors(); 14441 assertNoErrors();
14465 expect(typeAlias.typedefKeyword, isNotNull); 14442 expect(typeAlias.typedefKeyword, isNotNull);
14466 expect(typeAlias.name, isNotNull); 14443 expect(typeAlias.name, isNotNull);
14467 expect(typeAlias.typeParameters, isNotNull); 14444 expect(typeAlias.typeParameters, isNotNull);
14468 expect(typeAlias.semicolon, isNotNull); 14445 expect(typeAlias.semicolon, isNotNull);
14469 GenericFunctionType functionType = typeAlias.functionType; 14446 GenericFunctionType functionType = typeAlias.functionType;
14470 expect(functionType, isNotNull); 14447 expect(functionType, isNotNull);
14471 expect(functionType.parameters, isNotNull); 14448 expect(functionType.parameters, isNotNull);
14472 expect(functionType.returnType, isNotNull); 14449 expect(functionType.returnType, isNotNull);
14473 expect(functionType.typeParameters, isNull); 14450 expect(functionType.typeParameters, isNull);
14474 } 14451 }
14475 14452
14476 @failingTest
14477 void test_parseTypeAlias_genericFunction_typeParameters_typeParameters() { 14453 void test_parseTypeAlias_genericFunction_typeParameters_typeParameters() {
14478 createParser('typedef F<T> = bool Function<E>();'); 14454 createParser('typedef F<T> = bool Function<E>();');
14479 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14455 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14480 expect(typeAlias, isNotNull); 14456 expect(typeAlias, isNotNull);
14481 assertNoErrors(); 14457 assertNoErrors();
14482 expect(typeAlias.typedefKeyword, isNotNull); 14458 expect(typeAlias.typedefKeyword, isNotNull);
14483 expect(typeAlias.name, isNotNull); 14459 expect(typeAlias.name, isNotNull);
14484 expect(typeAlias.typeParameters, isNotNull); 14460 expect(typeAlias.typeParameters, isNotNull);
14485 expect(typeAlias.semicolon, isNotNull); 14461 expect(typeAlias.semicolon, isNotNull);
14486 GenericFunctionType functionType = typeAlias.functionType; 14462 GenericFunctionType functionType = typeAlias.functionType;
14487 expect(functionType, isNotNull); 14463 expect(functionType, isNotNull);
14488 expect(functionType.parameters, isNotNull); 14464 expect(functionType.parameters, isNotNull);
14489 expect(functionType.returnType, isNotNull); 14465 expect(functionType.returnType, isNotNull);
14490 expect(functionType.typeParameters, isNotNull); 14466 expect(functionType.typeParameters, isNotNull);
14491 } 14467 }
14492 14468
14493 @failingTest
14494 void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() { 14469 void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() {
14495 createParser('typedef F<T> = void Function();'); 14470 createParser('typedef F<T> = void Function();');
14496 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14471 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14497 expect(typeAlias, isNotNull); 14472 expect(typeAlias, isNotNull);
14498 assertNoErrors(); 14473 assertNoErrors();
14499 expect(typeAlias.typedefKeyword, isNotNull); 14474 expect(typeAlias.typedefKeyword, isNotNull);
14500 expect(typeAlias.name, isNotNull); 14475 expect(typeAlias.name, isNotNull);
14501 expect(typeAlias.typeParameters, isNotNull); 14476 expect(typeAlias.typeParameters, isNotNull);
14502 expect(typeAlias.semicolon, isNotNull); 14477 expect(typeAlias.semicolon, isNotNull);
14503 GenericFunctionType functionType = typeAlias.functionType; 14478 GenericFunctionType functionType = typeAlias.functionType;
14504 expect(functionType, isNotNull); 14479 expect(functionType, isNotNull);
14505 expect(functionType.parameters, isNotNull); 14480 expect(functionType.parameters, isNotNull);
14506 expect(functionType.returnType, isNotNull); 14481 expect(functionType.returnType, isNotNull);
14507 expect(functionType.typeParameters, isNull); 14482 expect(functionType.typeParameters, isNull);
14508 } 14483 }
14509 14484
14510 @failingTest
14511 void test_parseTypeAlias_genericFunction_voidReturnType() { 14485 void test_parseTypeAlias_genericFunction_voidReturnType() {
14512 createParser('typedef F = void Function();'); 14486 createParser('typedef F = void Function();');
14513 GenericTypeAlias typeAlias = parseFullCompilationUnitMember(); 14487 GenericTypeAlias typeAlias = parseFullCompilationUnitMember();
14514 expect(typeAlias, isNotNull); 14488 expect(typeAlias, isNotNull);
14515 assertNoErrors(); 14489 assertNoErrors();
14516 expect(typeAlias.typedefKeyword, isNotNull); 14490 expect(typeAlias.typedefKeyword, isNotNull);
14517 expect(typeAlias.name, isNotNull); 14491 expect(typeAlias.name, isNotNull);
14518 expect(typeAlias.typeParameters, isNull); 14492 expect(typeAlias.typeParameters, isNull);
14519 expect(typeAlias.semicolon, isNotNull); 14493 expect(typeAlias.semicolon, isNotNull);
14520 GenericFunctionType functionType = typeAlias.functionType; 14494 GenericFunctionType functionType = typeAlias.functionType;
14521 expect(functionType, isNotNull); 14495 expect(functionType, isNotNull);
14522 expect(functionType.parameters, isNotNull); 14496 expect(functionType.parameters, isNotNull);
14523 expect(functionType.returnType, isNotNull); 14497 expect(functionType.returnType, isNotNull);
14524 expect(functionType.typeParameters, isNull); 14498 expect(functionType.typeParameters, isNull);
14525 } 14499 }
14526 } 14500 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698