-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
astral-sh/ruff
#18846Labels
help wantedContributions especially welcomeContributions especially welcometyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Description
An example I got from reviewing astral-sh/ruff#17643, which may or may not be related to this issue. I find it strange that we infer
Unknown
here, and not some@Todo
type?from typing import reveal_type def _(union_of_tuples: tuple[int] | tuple[None]): reveal_type(union_of_tuples[0]) # Unknown
Originally posted by @sharkdp in #493
It looks to me like the issue here is that TypeInferenceBuilder::infer_subscript_expression_types
has no case for handling unions or intersections, by mapping the subscript operation over the element types and unioning/intersecting the results.
Metadata
Metadata
Assignees
Labels
help wantedContributions especially welcomeContributions especially welcometyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc