Exhaustiveness of type tuple[bool, bool]
まだ誰も着手していません。
評価
調査の方向性
提供された再現コードを Python 3.14.7 と --enable-error-code exhaustive-match で実行し、match 文における tuple[bool, bool] の exhaustive-match 解析の扱いを追跡します。4 つの boolean ケースが網羅的であると認識され、missing-return または unhandled-case エラーが報告されない一方で、実際に不完全な match では引き続きエラーが報告されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug Report
It looks like the exhaustiveness of tuples of bools is not checked in match statements.
To Reproduce
def measure(a: bool, b: bool) -> float:
match a, b:
case True, True:
return 1
case True, False:
return 0.9
case False, True:
return 0.5
case False, False:
return 0
Expected Behavior
Should pass, looks exhaustive to me (or I should go take a nap).
Actual Behavior
$ mypy --enable-error-code exhaustive-match repro.py
repro.py:1: error: Missing return statement [return]
repro.py:2: error: Match statement has unhandled case for values of type "tuple[bool, bool]" [exhaustive-match]
repro.py:2: note: If match statement is intended to be non-exhaustive, add `case _: pass`
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: mypy 2.3.1 (compiled: yes)
- Mypy command-line flags:
--enable-error-code exhaustive-match - Mypy configuration options from
mypy.ini(and other config files): ø - Python version used: 3.14.7
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 58
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/mypy のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug topic-configuration topic-error-reporting
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
bug topic-attrs
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
似ている issue
-
essnmx good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
[Feature] 奇物选择添加优先级 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
syfoud/Simulated_Scepter#174 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Giskard-AI/giskard-oss#2840 · コメント 1 件 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success オープンarea: repo bug perceived difficulty: 2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
yeti-platform/yeti#1380 ·