Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: pkg/analyzer/test/generated/hint_code_test.dart

Issue 1943443002: If an if or do statement always exits, following statements are dead. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: test_ prefixes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/non_hint_code_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39752705c06ccf3780e8a592c3452bb3a52d2117..043faeb754265b75a685958b22fc5f4fdc00f2a7 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -21,7 +21,7 @@ main() {
@reflectiveTest
class HintCodeTest extends ResolverTestCase {
- void fail_deadCode_statementAfterRehrow() {
+ void test_deadCode_statementAfterRethrow() {
Source source = addSource(r'''
f() {
try {
@@ -36,7 +36,7 @@ f() {
verify([source]);
}
- void fail_deadCode_statementAfterThrow() {
+ void test_deadCode_statementAfterThrow() {
Source source = addSource(r'''
f() {
var one = 1;
@@ -619,6 +619,21 @@ f() {
verify([source]);
}
+ void test_deadCode_statementAfterExitingIf_returns() {
+ Source source = addSource(r'''
+f() {
+ if (1 > 2) {
+ return;
+ } else {
+ return;
+ }
+ var one = 1;
+}''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [HintCode.DEAD_CODE]);
+ verify([source]);
+ }
+
void test_deprecatedAnnotationUse_assignment() {
Source source = addSource(r'''
class A {
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/non_hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698