| OLD | NEW |
| 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 engine.resolver_test; | 5 library engine.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 3511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3522 _f(int p) { | 3522 _f(int p) { |
| 3523 _f(p - 1); | 3523 _f(p - 1); |
| 3524 } | 3524 } |
| 3525 main() { | 3525 main() { |
| 3526 }'''); | 3526 }'''); |
| 3527 resolve(source); | 3527 resolve(source); |
| 3528 assertErrors(source, [HintCode.UNUSED_ELEMENT]); | 3528 assertErrors(source, [HintCode.UNUSED_ELEMENT]); |
| 3529 verify([source]); | 3529 verify([source]); |
| 3530 } | 3530 } |
| 3531 | 3531 |
| 3532 void test_unusedElement_functionTypeAlias_isUsed_isExpression() { |
| 3533 enableUnusedElement = true; |
| 3534 Source source = addSource(r''' |
| 3535 typedef _F(a, b); |
| 3536 main(f) { |
| 3537 if (f is _F) { |
| 3538 print('F'); |
| 3539 } |
| 3540 }'''); |
| 3541 resolve(source); |
| 3542 assertNoErrors(source); |
| 3543 verify([source]); |
| 3544 } |
| 3545 |
| 3532 void test_unusedElement_functionTypeAlias_isUsed_reference() { | 3546 void test_unusedElement_functionTypeAlias_isUsed_reference() { |
| 3533 enableUnusedElement = true; | 3547 enableUnusedElement = true; |
| 3534 Source source = addSource(r''' | 3548 Source source = addSource(r''' |
| 3535 typedef _F(a, b); | 3549 typedef _F(a, b); |
| 3536 main(_F f) { | 3550 main(_F f) { |
| 3537 }'''); | 3551 }'''); |
| 3538 resolve(source); | 3552 resolve(source); |
| 3539 assertNoErrors(source); | 3553 assertNoErrors(source); |
| 3540 verify([source]); | 3554 verify([source]); |
| 3541 } | 3555 } |
| (...skipping 10162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13704 // check propagated type | 13718 // check propagated type |
| 13705 FunctionType propagatedType = node.propagatedType as FunctionType; | 13719 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13706 expect(propagatedType.returnType, test.typeProvider.stringType); | 13720 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13707 } on AnalysisException catch (e, stackTrace) { | 13721 } on AnalysisException catch (e, stackTrace) { |
| 13708 thrownException[0] = new CaughtException(e, stackTrace); | 13722 thrownException[0] = new CaughtException(e, stackTrace); |
| 13709 } | 13723 } |
| 13710 } | 13724 } |
| 13711 return null; | 13725 return null; |
| 13712 } | 13726 } |
| 13713 } | 13727 } |
| OLD | NEW |