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
Copy file name to clipboardExpand all lines: docs/source/error_code_list2.rst
+4-11Lines changed: 4 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -636,25 +636,18 @@ Example:
636
636
637
637
val: Color = Color.RED
638
638
639
-
# without --enable-error-code exhaustive-match
639
+
#OK without --enable-error-code exhaustive-match
640
640
match val:
641
641
case Color.RED:
642
642
print("red")
643
643
644
-
# Also no issues without --enable-error-code exhaustive-match, but this is exhaustive
645
-
match val:
646
-
case Color.RED:
647
-
print("red")
648
-
case _:
649
-
print("other")
650
-
651
-
# with --enable-error-code exhaustive-match
652
-
# error: Cases within match statement do not exhaustively handle all values: "Literal[Color.BLUE]". If not intended to handle all cases, use `case _: pass`
644
+
# With --enable-error-code exhaustive-match
645
+
# Error: Match statement has unhandled case for values of type "Literal[Color.BLUE]"
653
646
match val:
654
647
case Color.RED:
655
648
print("red")
656
649
657
-
#no error with --enable-error-code exhaustive-match since all cases are handled
650
+
#OK with or without --enable-error-code exhaustive-match, since all cases are handled
0 commit comments