-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
help wantedContributions especially welcomeContributions especially welcometyMulti-file analysis & type inferenceMulti-file analysis & type inference
Description
For example, when using callable types in a union:
from typing import Callable
def foo(x: Callable[[], int] | None):
# red-knot: Revealed type is `() -> int | None` [revealed-type]
reveal_type(x)This can be confused with the return type could be read as int | None.
To disambiguate, we should add parentheses like:
red-knot: Revealed type is `(() -> int) | None` [revealed-type]
This is what Pyright does as well while mypy uses the Union[...] syntax.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcometyMulti-file analysis & type inferenceMulti-file analysis & type inference