Improve error message when variable-length tuple annotation is required
オープン
まだ誰も着手していません。
feature
topic-error-reporting
topic-usability
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Mypy currently does not give a particularly friendly error message for this snippet of code:
test = (1, 2)
test += (3,) # error: Incompatible types in assignment (expression has type "Tuple[int, int, int]", variable has type "Tuple[int, int]")
What the user probably needs to do is to add a variable-length tuple annotation, e.g.
test: tuple[int, ...] = (1, 2)
test += (3,)
However, the error message gives no indication of that (on mypy 0.941).
Refs #10384
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された可変長タプルの再現例から始め、現在の診断を提案された tuple[int, ...] アノテーションと比較します。互換性のない代入を報告している型チェックの経路を追跡し、その後、可変長タプルのアノテーションをユーザーに案内する文言を追加して、この例で検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100