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

Unified Diff: pkg/analyzer/test/src/dart/ast/utilities_test.dart

Issue 2613383003: Add support for generic function type syntax, part 1 (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/analyzer/test/generated/utilities_test.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/dart/ast/utilities_test.dart
diff --git a/pkg/analyzer/test/src/dart/ast/utilities_test.dart b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
index 8ccaa8a4e79340639d01eb2d5112a52076ca37d2..f4016bcb59b1772033314b7f9b2c5408de71d51d 100644
--- a/pkg/analyzer/test/src/dart/ast/utilities_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
@@ -196,23 +196,13 @@ class ConstantEvaluatorTest extends ParserTestCase {
expect(value, true);
}
- void test_binary_plus_string() {
- Object value = _getConstantValue("'hello ' + 'world'");
- expect(value, 'hello world');
- }
-
void test_binary_plus_double() {
Object value = _getConstantValue("2.3 + 3.2");
expect(value, 2.3 + 3.2);
}
- void test_binary_plus_integer() {
- Object value = _getConstantValue("2 + 3");
- expect(value, 5);
- }
-
- void test_binary_plus_string_int() {
- Object value = _getConstantValue("5 + 'world'");
+ void test_binary_plus_double_string() {
+ Object value = _getConstantValue("'world' + 5.5");
expect(value, ConstantEvaluator.NOT_A_CONSTANT);
}
@@ -221,9 +211,14 @@ class ConstantEvaluatorTest extends ParserTestCase {
expect(value, ConstantEvaluator.NOT_A_CONSTANT);
}
- void test_binary_plus_double_string() {
- Object value = _getConstantValue("'world' + 5.5");
- expect(value, ConstantEvaluator.NOT_A_CONSTANT);
+ void test_binary_plus_integer() {
+ Object value = _getConstantValue("2 + 3");
+ expect(value, 5);
+ }
+
+ void test_binary_plus_string() {
+ Object value = _getConstantValue("'hello ' + 'world'");
+ expect(value, 'hello world');
}
void test_binary_plus_string_double() {
@@ -231,6 +226,11 @@ class ConstantEvaluatorTest extends ParserTestCase {
expect(value, ConstantEvaluator.NOT_A_CONSTANT);
}
+ void test_binary_plus_string_int() {
+ Object value = _getConstantValue("5 + 'world'");
+ expect(value, ConstantEvaluator.NOT_A_CONSTANT);
+ }
+
void test_binary_remainder_double() {
Object value = _getConstantValue("3.2 % 2.3");
expect(value, 3.2 % 2.3);
@@ -372,7 +372,7 @@ class NodeLocator2Test extends ParserTestCase {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(code);
TopLevelVariableDeclaration declaration = unit.declarations[0];
VariableDeclarationList variableList = declaration.variables;
- Identifier typeName = variableList.type.name;
+ Identifier typeName = (variableList.type as TypeName).name;
SimpleIdentifier varName = variableList.variables[0].name;
expect(new NodeLocator2(0).searchWithin(unit), same(unit));
expect(new NodeLocator2(1).searchWithin(unit), same(typeName));
@@ -393,7 +393,7 @@ class NodeLocator2Test extends ParserTestCase {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(code);
TopLevelVariableDeclaration declaration = unit.declarations[0];
VariableDeclarationList variableList = declaration.variables;
- Identifier typeName = variableList.type.name;
+ Identifier typeName = (variableList.type as TypeName).name;
SimpleIdentifier varName = variableList.variables[0].name;
expect(new NodeLocator2(-1, 2).searchWithin(unit), isNull);
expect(new NodeLocator2(0, 2).searchWithin(unit), same(unit));
@@ -696,9 +696,9 @@ class ResolutionCopierTest extends EngineTestCase {
.functionExpressionInvocation(AstTestFactory.identifier3("f"));
ClassElement elementT = ElementFactory.classElement2('T');
fromNode.typeArguments = AstTestFactory
- .typeArgumentList(<TypeName>[AstTestFactory.typeName(elementT)]);
+ .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName(elementT)]);
toNode.typeArguments = AstTestFactory
- .typeArgumentList(<TypeName>[AstTestFactory.typeName4('T')]);
+ .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName4('T')]);
_copyAndVerifyInvocation(fromNode, toNode);
@@ -831,9 +831,9 @@ class ResolutionCopierTest extends EngineTestCase {
MethodInvocation toNode = AstTestFactory.methodInvocation2("m");
ClassElement elementT = ElementFactory.classElement2('T');
fromNode.typeArguments = AstTestFactory
- .typeArgumentList(<TypeName>[AstTestFactory.typeName(elementT)]);
+ .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName(elementT)]);
toNode.typeArguments = AstTestFactory
- .typeArgumentList(<TypeName>[AstTestFactory.typeName4('T')]);
+ .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName4('T')]);
_copyAndVerifyInvocation(fromNode, toNode);
}
@@ -1130,12 +1130,12 @@ class ResolutionCopierTest extends EngineTestCase {
expect(toNode.staticType, same(staticType));
expect(toNode.propagatedInvokeType, same(propagatedInvokeType));
expect(toNode.staticInvokeType, same(staticInvokeType));
- List<TypeName> fromTypeArguments = toNode.typeArguments.arguments;
- List<TypeName> toTypeArguments = fromNode.typeArguments.arguments;
+ List<TypeAnnotation> fromTypeArguments = toNode.typeArguments.arguments;
+ List<TypeAnnotation> toTypeArguments = fromNode.typeArguments.arguments;
if (fromTypeArguments != null) {
for (int i = 0; i < fromTypeArguments.length; i++) {
- TypeName toArgument = fromTypeArguments[i];
- TypeName fromArgument = toTypeArguments[i];
+ TypeAnnotation toArgument = fromTypeArguments[i];
+ TypeAnnotation fromArgument = toTypeArguments[i];
expect(toArgument.type, same(fromArgument.type));
}
}
« no previous file with comments | « pkg/analyzer/test/generated/utilities_test.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698