Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,16 @@ Using `Concatenate` as the first argument to `Callable`:
from typing_extensions import Callable, Concatenate

def _(c: Callable[Concatenate[int, str, ...], int]):
reveal_type(c) # revealed: (*args: @Todo(todo signature *args), **kwargs: @Todo(todo signature **kwargs)) -> int
# TODO: Should reveal the correct signature
reveal_type(c) # revealed: (...) -> int
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we think that the signature should still reveal @Todo somehow, I can try to retain that property, by making is_gradual an enum or introducing another flag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to either keep ... or have @Todo(...) but not retain the current display as that's clearly incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, keeping ... for now. Thank you.

```

And, as one of the parameter types:

```py
def _(c: Callable[[Concatenate[int, str, ...], int], int]):
reveal_type(c) # revealed: (*args: @Todo(todo signature *args), **kwargs: @Todo(todo signature **kwargs)) -> int
# TODO: Should reveal the correct signature
reveal_type(c) # revealed: (...) -> int
```

## Using `typing.ParamSpec`
Expand Down Expand Up @@ -276,7 +278,8 @@ from typing_extensions import Callable, TypeVarTuple
Ts = TypeVarTuple("Ts")

def _(c: Callable[[int, *Ts], int]):
reveal_type(c) # revealed: (*args: @Todo(todo signature *args), **kwargs: @Todo(todo signature **kwargs)) -> int
# TODO: Should reveal the correct signature
reveal_type(c) # revealed: (...) -> int
```

And, using the legacy syntax using `Unpack`:
Expand All @@ -285,7 +288,8 @@ And, using the legacy syntax using `Unpack`:
from typing_extensions import Unpack

def _(c: Callable[[int, Unpack[Ts]], int]):
reveal_type(c) # revealed: (*args: @Todo(todo signature *args), **kwargs: @Todo(todo signature **kwargs)) -> int
# TODO: Should reveal the correct signature
reveal_type(c) # revealed: (...) -> int
```

## Member lookup
Expand Down
2 changes: 1 addition & 1 deletion crates/red_knot_python_semantic/src/types/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ impl<'db> Parameters<'db> {
Parameter::keyword_variadic(Name::new_static("kwargs"))
.with_annotated_type(todo_type!("todo signature **kwargs")),
],
is_gradual: false,
is_gradual: true,
}
}

Expand Down
Loading