| 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 engine.declaration_resolver_test; | 5 library engine.declaration_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/src/dart/ast/ast.dart'; | 9 import 'package:analyzer/src/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/src/dart/ast/utilities.dart'; | 10 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 | 629 |
| 630 /** | 630 /** |
| 631 * Strong mode DeclarationResolver tests | 631 * Strong mode DeclarationResolver tests |
| 632 */ | 632 */ |
| 633 @reflectiveTest | 633 @reflectiveTest |
| 634 class StrongModeDeclarationResolverTest extends ResolverTestCase { | 634 class StrongModeDeclarationResolverTest extends ResolverTestCase { |
| 635 @override | 635 @override |
| 636 void setUp() { | 636 void setUp() { |
| 637 resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); | 637 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); |
| 638 } | 638 } |
| 639 | 639 |
| 640 void test_genericFunction_typeParameter() { | 640 void test_genericFunction_typeParameter() { |
| 641 String code = r''' | 641 String code = r''' |
| 642 /*=T*/ max/*<T>*/(/*=T*/ x, /*=T*/ y) => null; | 642 /*=T*/ max/*<T>*/(/*=T*/ x, /*=T*/ y) => null; |
| 643 '''; | 643 '''; |
| 644 CompilationUnit unit = resolveSource(code); | 644 CompilationUnit unit = resolveSource(code); |
| 645 FunctionDeclaration node = _findSimpleIdentifier(unit, code, 'max').parent; | 645 FunctionDeclaration node = _findSimpleIdentifier(unit, code, 'max').parent; |
| 646 TypeParameter t = node.functionExpression.typeParameters.typeParameters[0]; | 646 TypeParameter t = node.functionExpression.typeParameters.typeParameters[0]; |
| 647 | 647 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 676 expect(element.type.toString(), "<T>(T, T) → T"); | 676 expect(element.type.toString(), "<T>(T, T) → T"); |
| 677 expect(t.element, same(tElement)); | 677 expect(t.element, same(tElement)); |
| 678 | 678 |
| 679 // re-resolve | 679 // re-resolve |
| 680 CompilationUnit unit2 = _cloneResolveUnit(unit); | 680 CompilationUnit unit2 = _cloneResolveUnit(unit); |
| 681 node = _findSimpleIdentifier(unit2, code, 'max').parent; | 681 node = _findSimpleIdentifier(unit2, code, 'max').parent; |
| 682 t = node.typeParameters.typeParameters[0]; | 682 t = node.typeParameters.typeParameters[0]; |
| 683 expect(t.element, same(tElement)); | 683 expect(t.element, same(tElement)); |
| 684 } | 684 } |
| 685 } | 685 } |
| OLD | NEW |