(🐞) No error when overload implementation has incompatible return type
オープン
まだ誰も着手していません。
feature
topic-overloads
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
from typing import overload
@overload
def foo(a: int) -> int: ...
@overload
def foo(a: float) -> int: ...
def foo(a: object) -> object: # no error
return object()
While the strictest of solutions would be to enforce the return type be an intersection of the overload return types, that would result in being overly strict to the point of being unusable. I suggest enforcing the return type to be a union of the overloads, this is not typesafe, but is much safer than not checking it at all.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リンクされた mypy playground の例を再現し、それによって実行される overload 実装の戻り値型チェックを追跡します。実装の互換性のない戻り値型に対する診断を生成し、overload に対して記載された意図どおりの動作を維持できた状態を完了と定義します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100