| 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 bd01388937f4fdc9c8639d752120cb49ea5382d2..645ebeb93bf43ba20ae00bdfe9f7202451cfdc13 100644
|
| --- a/pkg/analyzer/test/generated/hint_code_test.dart
|
| +++ b/pkg/analyzer/test/generated/hint_code_test.dart
|
| @@ -377,6 +377,49 @@ f() {
|
| 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_deadOperandLHS_and() {
|
| Source source = addSource(r'''
|
| f() {
|
| @@ -473,49 +516,6 @@ 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) {
|
| @@ -1196,6 +1196,27 @@ abstract class B implements A {
|
| verify([source]);
|
| }
|
|
|
| + void test_invalidUseOfProtectedMember_in_docs_OK() {
|
| + Source source = addSource(r'''
|
| +import 'package:meta/meta.dart';
|
| +
|
| +class A {
|
| + @protected
|
| + int a() => c;
|
| + @protected
|
| + int get b => a();
|
| + @protected
|
| + int c = 42;
|
| +}
|
| +
|
| +/// OK: [A.a], [A.b], [A.c].
|
| +f() {}
|
| +''');
|
| + computeLibrarySourceErrors(source);
|
| + assertNoErrors(source);
|
| + verify([source]);
|
| + }
|
| +
|
| void test_invalidUseOfProtectedMember_message() {
|
| Source source = addSource(r'''
|
| import 'package:meta/meta.dart';
|
|
|