facebook / facebook/pyrefly

Wrapped methods don't get bound

Open
#1,110 3 comments 0 reactions 0 assignees View on GitHub
needs-discussion overloads typechecking
Dominant language
Rust
Stars
7k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

This should not reveal a type with a positional argument:
```py
import typing

P = typing.ParamSpec("P")
R = typing.TypeVar("R")

def wrap(f: typing.Callable[P, R]) -> typing.Callable[P, R]:
return f

class A:
def blah(self) -> None:
pass

class B:
blah = wrap(A.blah)

b: B = B()

typing.reveal_type(b.blah) # INFO: revealed type: (self: A) -> None
```

Note that `blah = A.blah` does not hit this bug.

### Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIEAtsbgE4AuABA6cROgOYA66vACkwC8LNh06F%2BqOqioBlYjADGACm4h%2B6gJS8ASsNHsuhACpsYANWlqQu7b16YYYJgHcZxFWESHxhAMKoUFCo2LAA2vwANEy6ALpaTAC0AHy%2BxoHBoRHRsXGIvExFTHQwDACudOhMYA7oSiFwcEwAggXVxU4uYagAFipwMFBgialMAHK46DDtxXNMxKhNdQ1LzQBCs8U9vQbuqJ4thDs6fOjYPusG6yqnvKxGEqUAbjBBAPoPMCrYxyG9p1%2BO1uRQAxEwYPhZMRYEwIE1yjAQABfKIgVBKBgQV4AMWgSMQIDQWDwRDIKKAA&version=3.12

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.