Unreachability should work for constrained type vars
オープン
@tyralla がすでに取り組んでいます。
2025年6月12日 から。
feature
topic-reachability
topic-type-variables
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Feature
Unreachability should be checked for constrained type vars.
Pitch
It would be nice if this raised an error when run with --warn-unreachable:
from typing import TypeVar
U = TypeVar('U', int, str)
def f(u: U) -> U:
if u is None:
print("whoa!!")
return u
To implement this feature, I think we need to store the spans of unreachability for each run, then find the intersection. I thought for a while that we could just treat constrained type variables as if they were bound to the union of constraints, but things like https://github.com/python/mypy/issues/9424 will happen for things that aren't final (unlike None).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。