mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
![]() ## Summary Closes #14588 ```py x: Literal[42, "hello"] = 42 if bool_instance() else "hello" reveal_type(x) # revealed: Literal[42] | Literal["hello"] _ = ... if isinstance(x, str) else ... # The `isinstance` test incorrectly narrows the type of `x`. # As a result, `x` is revealed as Literal["hello"], but it should remain Literal[42, "hello"]. reveal_type(x) # revealed: Literal["hello"] ``` ## Test Plan mdtest included! --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> |
||
---|---|---|
.. | ||
mdtest | ||
README.md |
Markdown files within the mdtest/
subdirectory are tests of type inference and type checking;
executed by the tests/mdtest.rs
integration test.
See crates/red_knot_test/README.md
for documentation of this test format.