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 analyzer.test.generated.static_warning_code_test; | 5 library analyzer.test.generated.static_warning_code_test; |
6 | 6 |
7 import 'package:analyzer/error/error.dart'; | 7 import 'package:analyzer/error/error.dart'; |
8 import 'package:analyzer/src/error/codes.dart'; | 8 import 'package:analyzer/src/error/codes.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/source_io.dart'; | 10 import 'package:analyzer/src/generated/source_io.dart'; |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 | 1497 |
1498 test_functionWithoutCall_direct() async { | 1498 test_functionWithoutCall_direct() async { |
1499 Source source = addSource(r''' | 1499 Source source = addSource(r''' |
1500 class A implements Function { | 1500 class A implements Function { |
1501 }'''); | 1501 }'''); |
1502 await computeAnalysisResult(source); | 1502 await computeAnalysisResult(source); |
1503 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | 1503 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
1504 verify([source]); | 1504 verify([source]); |
1505 } | 1505 } |
1506 | 1506 |
| 1507 test_functionWithoutCall_direct_typeAlias() async { |
| 1508 Source source = addSource(r''' |
| 1509 class M {} |
| 1510 class A = Object with M implements Function;'''); |
| 1511 await computeAnalysisResult(source); |
| 1512 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
| 1513 verify([source]); |
| 1514 } |
| 1515 |
1507 test_functionWithoutCall_indirect_extends() async { | 1516 test_functionWithoutCall_indirect_extends() async { |
1508 Source source = addSource(r''' | 1517 Source source = addSource(r''' |
1509 abstract class A implements Function { | 1518 abstract class A implements Function { |
1510 } | 1519 } |
1511 class B extends A { | 1520 class B extends A { |
1512 }'''); | 1521 }'''); |
1513 await computeAnalysisResult(source); | 1522 await computeAnalysisResult(source); |
1514 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | 1523 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
1515 verify([source]); | 1524 verify([source]); |
1516 } | 1525 } |
1517 | 1526 |
| 1527 test_functionWithoutCall_indirect_extends_typeAlias() async { |
| 1528 Source source = addSource(r''' |
| 1529 abstract class A implements Function {} |
| 1530 class M {} |
| 1531 class B = A with M;'''); |
| 1532 await computeAnalysisResult(source); |
| 1533 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
| 1534 verify([source]); |
| 1535 } |
| 1536 |
1518 test_functionWithoutCall_indirect_implements() async { | 1537 test_functionWithoutCall_indirect_implements() async { |
1519 Source source = addSource(r''' | 1538 Source source = addSource(r''' |
1520 abstract class A implements Function { | 1539 abstract class A implements Function { |
1521 } | 1540 } |
1522 class B implements A { | 1541 class B implements A { |
1523 }'''); | 1542 }'''); |
1524 await computeAnalysisResult(source); | 1543 await computeAnalysisResult(source); |
1525 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | 1544 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
1526 verify([source]); | 1545 verify([source]); |
1527 } | 1546 } |
1528 | 1547 |
1529 test_functionWithoutCall_mixin_implements() async { | |
1530 Source source = addSource(r''' | |
1531 abstract class A implements Function {} | |
1532 class B extends Object with A {}'''); | |
1533 await computeAnalysisResult(source); | |
1534 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | |
1535 verify([source]); | |
1536 } | |
1537 | |
1538 test_functionWithoutCall_direct_typeAlias() async { | |
1539 Source source = addSource(r''' | |
1540 class M {} | |
1541 class A = Object with M implements Function;'''); | |
1542 await computeAnalysisResult(source); | |
1543 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | |
1544 verify([source]); | |
1545 } | |
1546 | |
1547 test_functionWithoutCall_indirect_extends_typeAlias() async { | |
1548 Source source = addSource(r''' | |
1549 abstract class A implements Function {} | |
1550 class M {} | |
1551 class B = A with M;'''); | |
1552 await computeAnalysisResult(source); | |
1553 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | |
1554 verify([source]); | |
1555 } | |
1556 | |
1557 test_functionWithoutCall_indirect_implements_typeAlias() async { | 1548 test_functionWithoutCall_indirect_implements_typeAlias() async { |
1558 Source source = addSource(r''' | 1549 Source source = addSource(r''' |
1559 abstract class A implements Function {} | 1550 abstract class A implements Function {} |
1560 class M {} | 1551 class M {} |
1561 class B = Object with M implements A;'''); | 1552 class B = Object with M implements A;'''); |
1562 await computeAnalysisResult(source); | 1553 await computeAnalysisResult(source); |
1563 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | 1554 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
1564 verify([source]); | 1555 verify([source]); |
| 1556 } |
| 1557 |
| 1558 test_functionWithoutCall_mixin_implements() async { |
| 1559 Source source = addSource(r''' |
| 1560 abstract class A implements Function {} |
| 1561 class B extends Object with A {}'''); |
| 1562 await computeAnalysisResult(source); |
| 1563 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
| 1564 verify([source]); |
1565 } | 1565 } |
1566 | 1566 |
1567 test_functionWithoutCall_mixin_implements_typeAlias() async { | 1567 test_functionWithoutCall_mixin_implements_typeAlias() async { |
1568 Source source = addSource(r''' | 1568 Source source = addSource(r''' |
1569 abstract class A implements Function {} | 1569 abstract class A implements Function {} |
1570 class B = Object with A;'''); | 1570 class B = Object with A;'''); |
1571 await computeAnalysisResult(source); | 1571 await computeAnalysisResult(source); |
1572 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); | 1572 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); |
1573 verify([source]); | 1573 verify([source]); |
1574 } | 1574 } |
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3797 | 3797 |
3798 test_voidReturnForGetter() async { | 3798 test_voidReturnForGetter() async { |
3799 Source source = addSource(r''' | 3799 Source source = addSource(r''' |
3800 class S { | 3800 class S { |
3801 void get value {} | 3801 void get value {} |
3802 }'''); | 3802 }'''); |
3803 await computeAnalysisResult(source); | 3803 await computeAnalysisResult(source); |
3804 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); | 3804 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); |
3805 } | 3805 } |
3806 } | 3806 } |
OLD | NEW |