| Index: pkg/analyzer/test/generated/hint_code_test.dart
|
| diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
|
| index 0c3e3f60a7a036b05e94f89f41ffd5609c9c70e7..bd01388937f4fdc9c8639d752120cb49ea5382d2 100644
|
| --- a/pkg/analyzer/test/generated/hint_code_test.dart
|
| +++ b/pkg/analyzer/test/generated/hint_code_test.dart
|
| @@ -473,6 +473,49 @@ f(v) {
|
| verify([source]);
|
| }
|
|
|
| + void test_deadCode_deadFinalReturnInCase() {
|
| + Source source = addSource(r'''
|
| +f() {
|
| + switch (true) {
|
| + case true:
|
| + try {
|
| + int a = 1;
|
| + } finally {
|
| + return;
|
| + }
|
| + return;
|
| + default:
|
| + break;
|
| + }
|
| +}''');
|
| + computeLibrarySourceErrors(source);
|
| + assertErrors(source, [HintCode.DEAD_CODE]);
|
| + verify([source]);
|
| + }
|
| +
|
| + void test_deadCode_deadFinalStatementInCase() {
|
| + Source source = addSource(r'''
|
| +f() {
|
| + switch (true) {
|
| + case true:
|
| + try {
|
| + int a = 1;
|
| + } finally {
|
| + return;
|
| + }
|
| + int b = 1;
|
| + default:
|
| + break;
|
| + }
|
| +}''');
|
| + computeLibrarySourceErrors(source);
|
| + // A single dead statement at the end of a switch case that is not a
|
| + // terminating statement will yield two errors.
|
| + assertErrors(source,
|
| + [HintCode.DEAD_CODE, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]);
|
| + verify([source]);
|
| + }
|
| +
|
| void test_deadCode_statementAfterBreak_inWhileStatement() {
|
| Source source = addSource(r'''
|
| f(v) {
|
|
|