Incompatible types in assignment for `dict[key] = tmp = value` and nested structures
オープン
まだ誰も着手していません。
bug
false-positive
priority-2-low
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
I have Python2 code building some nested structures like lists/tuples/sets/dicts in dicts. For populating the nested structure I keep a temporary reference, which mypy fails to parse if the (untyped) temporary reference is not the first variable being assigned:
#!/usr/bin/python2.7
from typing import Dict, Set # noqa
x = {} # type: Dict[str, Set[str]]
z = x[''] = set() # okay
x[''] = y = set() # fail: Incompatible types in assignment (expression has type "Set[<nothing>]", target has type "Set[str]")
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issue に示されている最小限の Python 2.7 再現コードから始め、2 つの連鎖代入形式を比較します。それぞれの場合に mypy が型指定のない一時変数をどのように推論するかを追跡します。完了条件は、宣言された Dict[str, Set[str]] のチェックを弱めることなく、2 つ目の形式が 1 つ目の形式と一貫して受け入れられることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100