Give better error message if type inference fails because of unsatisfiable upper bound
オープン
まだ誰も着手していません。
priority-1-normal
topic-type-variables
topic-usability
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
After #5699 in certain cases (see testWideOuterContextEmptyError) if type inference fails, mypy gives an obscure error like
Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "List[str]")
This error message could be improved. Here are some ideas:
- Record that we didn't use the outer context because of unsatisfied bound and add a note about this
- (Probably better) If type variable with a bound is used in an invariant context and we can't infer a value, we currently infer
C[<nothing>]. What if we'd instead inferredC[<bound>]?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue で言及されている testWideOuterContextEmptyError ケースから始め、不変コンテキストにおける満たされていない上限に対する型推論の経路を調査してください。提案されている診断アプローチを比較し、改善されたエラーメッセージを示す回帰テストを追加してから、関連するテストスイートを実行してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100