-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
astral-sh/ruff
#22589Milestone
Description
Summary
I could reduce my example all the way to this.
The evaluate(x, eager=eager) will only typecheck if I remove the “type” from line 5
from typing import overload, Literal
class Eager: ...
class Lazy: ...
type Array = Eager | Lazy # these work: `Array = …`, `Array: TypeAlias = …`
@overload
def evaluate(x: Eager, /, *, eager: bool = False) -> Eager: ...
@overload
def evaluate(x: Lazy, /, *, eager: Literal[False] = False) -> Lazy: ...
@overload
def evaluate(x: Lazy, /, *, eager: Literal[True]) -> Eager: ...
def evaluate(*args, **kw): ...
def foo(x: Array, *, eager: bool) -> None:
evaluate(x, eager=eager)Version
ty 0.0.11 (830cb9c 2026-01-09)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels