-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
astral-sh/ruff
#21439Labels
bidirectional inferenceInference of types that takes into account the context of a declared type or expected typeInference of types that takes into account the context of a declared type or expected type
Milestone
Description
For example, on main:
def lst[T](x: T) -> list[T]:
return [x]
a = lst(1)
reveal_type(a) # revealed: list[Literal[1]]We currently perform literal promotion when inferring the list expression, i.e. before specialization. We may need a second literal promotion step during specialization for this to work, similar to what we do for generic constructors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bidirectional inferenceInference of types that takes into account the context of a declared type or expected typeInference of types that takes into account the context of a declared type or expected type