`type[Self]` converted to a callable drops constructor signature
評価
この issue はまだ評価されていません。
説明
Describe the Bug
from typing import Callable
def identity[**P, R](cb: Callable[P, R]) -> Callable[P, R]:
return cb
class Foo:
def __init__(self, value: int) -> None: ...
@classmethod
def meth(cls) -> None:
reveal_type(cls) # type[Self@Foo]
reveal_type(identity(cls)) # (*args: Any, **kwds: Any) -> Any
cls("") # error, expected
f: Callable[[str], Foo] = cls # no error
def explicit(t: type[Foo]) -> None:
reveal_type(identity(t)) # (value: int) -> Foo
When a variable declared type[Self] (such as the cls parameter of a classmethod) is used where a callable is expected, pyrefly treats it as type.__call__ instead of using the constructor of the class bound to Self.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
- 主要言語
- Rust
- スター
- 7.2k
- フォーク
- 578
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
facebook/pyrefly のほかの issue
-
sqlalchemy
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
typechecking
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
-
quansight
難易度 3/5 半日 初心者へのやさしさ 55/100
-
Version-gated early exits: `from copy import replace` is accepted but `copy.replace` is rejectedオープンquansight
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
-
warning: hiding a lifetime that's elided elsewhere is confusing対応中かも @jay23606 が 2 日前に担当しました。 オープンgood first issue
facebook/pyrefly の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 94/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area:ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openfootmanager/openfootmanager#1365 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
JackMechem/marbble#305 ·
メンテナーはふだん 1 日以内に返信