-
Notifications
You must be signed in to change notification settings - Fork 226
Closed
astral-sh/ruff
#21930Labels
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
Summary
In this snippet:
from typing import reveal_type, Iterable
x: Iterable[list[int]] = [[42], [56]]
reveal_type(x)we currently reveal list[Unknown | list[Unknown | int]]. For comparison, mypy and pyrefly reveal Iterable[list[int]] and pyright reveals list[list[int]]. Either seems better than our current answer (though I like pyright's best!).
cc. @ibraheemdev
Version
No response
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