Skip to content

Commit 933a16c

Browse files
Raise AssertionError for uncovered fallback case
Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent 18cc751 commit 933a16c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pylint/checkers/variables.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,10 @@ def _inferred_to_define_name_raise_or_return(
685685
)
686686
case nodes.If():
687687
pass
688-
case _:
689-
return False
688+
case _: # pragma: no cover
689+
# The function is only called for Try, With, For, While, Match and
690+
# If nodes. All of which are being handled above.
691+
raise AssertionError
690692

691693
# Be permissive if there is a break or a continue
692694
if any(node.nodes_of_class(nodes.Break, nodes.Continue)):

0 commit comments

Comments
 (0)