Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Exhaustiveness of type tuple[bool, bool]

オープン
#21,968 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
compilers

調査の方向性

提供された再現コードを Python 3.14.7 と --enable-error-code exhaustive-match で実行し、match 文における tuple[bool, bool] の exhaustive-match 解析の扱いを追跡します。4 つの boolean ケースが網羅的であると認識され、missing-return または unhandled-case エラーが報告されない一方で、実際に不完全な match では引き続きエラーが報告されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug topic-match-statement topic-reachability

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python/mypy のほかの issue

python/mypy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。