Better message if override violates Liskov substitution principle
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Some users don't understand why mypy complains about incompatible overrides. We could add an extra note in cases where the argument type is narrower in an override or the return type is wider (or all incompatible overrides). The note could mention Liskov substitution principle and add a link to mypy documentation (add a new section to https://mypy.readthedocs.io/en/latest/common_issues.html perhaps). We can also mention that # type: ignore[override] can be used to silence this error.
#7992 is an example where this came up, but several users have been confused about this.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、mypy の incompatible-override 診断の処理箇所を特定し、issue でリンクされている一般的な問題のドキュメントを確認します。動機となった例については issue #7992 を確認してください。関連する override のケースで Liskov substitution principle を説明し、ドキュメントへのリンクを含め、override の type-ignore オプションに言及し、そのメッセージをカバーするテストがあることが完了条件です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- documentation, tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 68/100