mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-20 04:29:47 +00:00
## Summary
Add support for implicit type aliases that use PEP 604 unions:
```py
IntOrStr = int | str
reveal_type(IntOrStr) # UnionType
def _(int_or_str: IntOrStr):
reveal_type(int_or_str) # int | str
```
## Typing conformance
The changes are either removed false positives, or new diagnostics due
to known limitations unrelated to this PR.
## Ecosystem impact
Spot checked, a mix of true positives and known limitations.
## Test Plan
New Markdown tests.
|
||
|---|---|---|
| .. | ||
| annotated.md | ||
| any.md | ||
| callable.md | ||
| deferred.md | ||
| int_float_complex.md | ||
| invalid.md | ||
| literal.md | ||
| literal_string.md | ||
| never.md | ||
| new_types.md | ||
| optional.md | ||
| self.md | ||
| starred.md | ||
| stdlib_typing_aliases.md | ||
| string.md | ||
| union.md | ||
| unsupported_special_forms.md | ||
| unsupported_special_types.md | ||
| unsupported_type_qualifiers.md | ||