Skip to content

Commit 5891d7c

Browse files
committed
callexpr
1 parent cad794a commit 5891d7c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

mypy/checker.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,14 @@ def check_first_pass(self) -> None:
476476
if self.binder.is_unreachable():
477477
if not self.should_report_unreachable_issues():
478478
break
479-
if not self.is_noop_for_reachability(d):
479+
if self.is_noop_for_reachability(d):
480+
if not isinstance(d, ExpressionStmt) or not isinstance(
481+
d.expr, CallExpr
482+
):
483+
self.accept(d)
484+
else:
480485
self.msg.unreachable_statement(d)
481486
break
482-
else:
483-
self.accept(d)
484487
else:
485488
self.accept(d)
486489

@@ -2950,11 +2953,12 @@ def visit_block(self, b: Block) -> None:
29502953
if self.binder.is_unreachable():
29512954
if not self.should_report_unreachable_issues():
29522955
break
2953-
if not self.is_noop_for_reachability(s):
2956+
if self.is_noop_for_reachability(s):
2957+
if not isinstance(s, ExpressionStmt) or not isinstance(s.expr, CallExpr):
2958+
self.accept(s)
2959+
else:
29542960
self.msg.unreachable_statement(s)
29552961
break
2956-
else:
2957-
self.accept(s)
29582962
else:
29592963
self.accept(s)
29602964

0 commit comments

Comments
 (0)