mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-28 10:50:26 +00:00
## Summary
Rename `TypeAliasType::Bare` to `TypeAliasType::ManualPEP695`, and
`BareTypeAliasType` to `ManualPEP695TypeAliasType`.
Why?
Both existing variants of `TypeAliasType` are specific to features added
in PEP 695 (which introduced both the `type` statement and
`types.TypeAliasType`), so it doesn't make sense to name one with the
name `PEP695` and not the other.
A "bare" type alias, in my mind, is a legacy type alias like `IntOrStr =
int | str`, which is "bare" in that there is nothing at all
distinguishing it as a type alias. I will want to use the "bare" name
for this variant, in a future PR.
The renamed variant here describes a type alias created with `IntOrStr =
types.TypeAliasType("IntOrStr", int | str)`, which is not "bare", it's
just "manually" instantiated instead of using the `type` statement
syntax sugar. (This is useful when using the `typing_extensions`
backport of `TypeAliasType` on older Python versions.)
## Test Plan
Pure rename, existing tests pass.
|
||
|---|---|---|
| .. | ||
| module_resolver | ||
| semantic_index | ||
| types | ||
| util | ||
| ast_node_ref.rs | ||
| db.rs | ||
| dunder_all.rs | ||
| lib.rs | ||
| lint.rs | ||
| list.rs | ||
| module_name.rs | ||
| node_key.rs | ||
| place.rs | ||
| program.rs | ||
| pull_types.rs | ||
| python_platform.rs | ||
| rank.rs | ||
| semantic_index.rs | ||
| semantic_model.rs | ||
| site_packages.rs | ||
| suppression.rs | ||
| types.rs | ||
| unpack.rs | ||