facebook / facebook/pyrefly

double clicking callable inlay hint should insert `Callable`, not invalid code

Open
#2,985 1 comment 0 reactions 0 assignees View on GitHub
language-server needs-discussion
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

```py
def f() -> int: ...

a = f
```

# expected
```py
from collections.abc import Callable

def f() -> int: ...

a: Callable[[], int] = f
```

# actual
```py
def f() -> int: ...

a: () -> int = f
```

> Yeah, this is an interesting case. For normal classes we show `type[T]` because that's a legal annotation (so double clicking it would insert valid type hint but double clicking the constructor signature would not) but for NewType `type[N]` is not a legal annotation.

_Originally posted by @yangdanny97 in [#2965](https://github.com/facebook/pyrefly/issues/2965#issuecomment-4167167610)_

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.