| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.src.task.dart_test; | 5 library analyzer.test.src.task.dart_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_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.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 4523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4534 // validate | 4534 // validate |
| 4535 CompilationUnit unit = outputs[RESOLVED_UNIT4]; | 4535 CompilationUnit unit = outputs[RESOLVED_UNIT4]; |
| 4536 FunctionTypeAlias nodeF = unit.declarations[0]; | 4536 FunctionTypeAlias nodeF = unit.declarations[0]; |
| 4537 // but 'T extends String' is resolved | 4537 // but 'T extends String' is resolved |
| 4538 _assertTypeParameterBound( | 4538 _assertTypeParameterBound( |
| 4539 nodeF.typeParameters.typeParameters[0], 'String', 'String'); | 4539 nodeF.typeParameters.typeParameters[0], 'String', 'String'); |
| 4540 } | 4540 } |
| 4541 | 4541 |
| 4542 void _assertTypeParameterBound(TypeParameter typeParameter, | 4542 void _assertTypeParameterBound(TypeParameter typeParameter, |
| 4543 String expectedBoundTypeString, String expectedBoundElementName) { | 4543 String expectedBoundTypeString, String expectedBoundElementName) { |
| 4544 TypeAnnotation bound = typeParameter.bound; | 4544 TypeName boundNode = typeParameter.bound; |
| 4545 // TODO(brianwilkerson) Extend this to support function types as bounds. | |
| 4546 expect(bound, new isInstanceOf<TypeName>()); | |
| 4547 TypeName boundNode = bound; | |
| 4548 Identifier boundName = boundNode.name; | 4545 Identifier boundName = boundNode.name; |
| 4549 expect(boundNode.type.toString(), expectedBoundTypeString); | 4546 expect(boundNode.type.toString(), expectedBoundTypeString); |
| 4550 expect(boundName.staticType.toString(), expectedBoundTypeString); | 4547 expect(boundName.staticType.toString(), expectedBoundTypeString); |
| 4551 expect(resolutionMap.staticElementForIdentifier(boundName).displayName, | 4548 expect(resolutionMap.staticElementForIdentifier(boundName).displayName, |
| 4552 expectedBoundElementName); | 4549 expectedBoundElementName); |
| 4553 } | 4550 } |
| 4554 } | 4551 } |
| 4555 | 4552 |
| 4556 @reflectiveTest | 4553 @reflectiveTest |
| 4557 class ResolveUnitTaskTest extends _AbstractDartTaskTest { | 4554 class ResolveUnitTaskTest extends _AbstractDartTaskTest { |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5729 /** | 5726 /** |
| 5730 * Fill [errorListener] with [result] errors in the current [task]. | 5727 * Fill [errorListener] with [result] errors in the current [task]. |
| 5731 */ | 5728 */ |
| 5732 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5729 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 5733 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5730 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
| 5734 expect(errors, isNotNull, reason: result.name); | 5731 expect(errors, isNotNull, reason: result.name); |
| 5735 errorListener = new GatheringErrorListener(); | 5732 errorListener = new GatheringErrorListener(); |
| 5736 errorListener.addAll(errors); | 5733 errorListener.addAll(errors); |
| 5737 } | 5734 } |
| 5738 } | 5735 } |
| OLD | NEW |