You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This flag will cause mypy to report an error whenever it encounters a match statement
805
805
that does not cover all possible cases.
@@ -815,21 +815,25 @@ of the above sections.
815
815
816
816
val: Color = Color.RED
817
817
818
-
match val: # error: Cases within match statement do not exhaustively handle all values: "Literal[Color.BLUE]". If not intended to handle all cases, use `case _: pass`
818
+
# without --disallow-inexhaustive-match-statements
819
+
match val:
819
820
case Color.RED:
820
821
print("red")
821
-
# without --only-allow-exhaustive-match-statements
822
+
823
+
# Also no issues without --disallow-inexhaustive-match-statements, but this is exhaustive
822
824
match val:
823
825
case Color.RED:
824
826
print("red")
825
-
# with --only-allow-exhaustive-match-statements
827
+
case _:
828
+
print("other")
829
+
830
+
# with --disallow-inexhaustive-match-statements
826
831
match val: # error: Cases within match statement do not exhaustively handle all values: "Literal[Color.BLUE]". If not intended to handle all cases, use `case _: pass`
827
832
case Color.RED:
828
833
print("red")
829
834
830
-
831
-
# no error with --only-allow-exhaustive-match-statements since all cases are handled
832
-
match val: # error: Cases within match statement do not exhaustively handle all values: "Literal[Color.BLUE]". If not intended to handle all cases, use `case _: pass`
835
+
# no error with --disallow-inexhaustive-match-statements since all cases are handled
0 commit comments