ruff/crates/ty_python_semantic/resources/mdtest/annotations
Carl Meyer 6b7adb0537
[ty] support PEP 613 type aliases (#21394)
Refs https://github.com/astral-sh/ty/issues/544

## Summary

Takes a more incremental approach to PEP 613 type alias support (vs
https://github.com/astral-sh/ruff/pull/20107). Instead of eagerly
inferring the RHS of a PEP 613 type alias as a type expression, infer it
as a value expression, just like we do for implicit type aliases, taking
advantage of the same support for e.g. unions and other type special
forms.

The main reason I'm following this path instead of the one in
https://github.com/astral-sh/ruff/pull/20107 is that we've realized that
people do sometimes use PEP 613 type aliases as values, not just as
types (because they are just a normal runtime assignment, unlike PEP 695
type aliases which create an opaque `TypeAliasType`).

This PR doesn't yet provide full support for recursive type aliases
(they don't panic, but they just fall back to `Unknown` at the recursion
point). This is future work.

## Test Plan

Added mdtests.

Many new ecosystem diagnostics, mostly because we
understand new types in lots of places.

Conformance suite changes are correct.

Performance regression is due to understanding lots of new
types; nothing we do in this PR is inherently expensive.
2025-11-20 17:59:35 -08:00
..
annotated.md [ty] Support stringified annotations in value-position `Annotated` instances (#21447) 2025-11-14 13:09:09 +00:00
any.md [ty] Use "cannot" consistently over "can not" (#21255) 2025-11-03 10:38:20 -05:00
callable.md [ty] Understand legacy and PEP 695 `ParamSpec` (#21139) 2025-11-06 11:14:40 -05:00
deferred.md [ty] fix global symbol lookup from eager scopes (#21317) 2025-11-12 10:15:51 -08:00
int_float_complex.md [ty] Improve disjointness inference for `NominalInstanceType`s and `SubclassOfType`s (#18864) 2025-06-24 20:27:37 +00:00
invalid.md [ty] tighten up handling of subscripts in type expressions (#21503) 2025-11-18 10:43:07 -08:00
literal.md [ty] tighten up handling of subscripts in type expressions (#21503) 2025-11-18 10:43:07 -08:00
literal_string.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
never.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
new_types.md [ty] Ensure annotation/type expressions in stub files are always deferred (#21401) 2025-11-13 17:14:54 +00:00
optional.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
self.md [ty] Create a specialization from a constraint set (#21414) 2025-11-19 14:20:33 -05:00
starred.md [ty] Return `Option<TupleType>` from `infer_tuple_type_expression` (#19735) 2025-08-04 13:48:19 +01:00
stdlib_typing_aliases.md [ty] Fix bug where ty would think all types had an `__mro__` attribute (#20995) 2025-10-27 11:19:12 +00:00
string.md [ty] Emit error for invalid binary operations in type expressions (#18991) 2025-06-30 10:06:01 +02:00
union.md [ty] Implicit type aliases: Support for PEP 604 unions (#21195) 2025-11-03 21:50:25 +01:00
unsupported_special_forms.md [ty] support PEP 613 type aliases (#21394) 2025-11-20 17:59:35 -08:00
unsupported_special_types.md Generalize special-casing for enums constructed with the functional syntax (#17885) 2025-05-06 11:02:55 +01:00
unsupported_type_qualifiers.md [ty] validate constructor call of `TypedDict` (#19810) 2025-08-25 14:45:52 +02:00