mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
This PR adds support for parsing and representing Type Parameters and Type Aliases as specified by PEP 695. What's missing are the scope rules, to be implemented in a future PR. Notable (user visible) changes: - new `TypeAlias` CST node, which is a `SmallStatement` - new CST nodes to represent TypeVarLikes: `TypeVar`, `TypeVarTuple`, `ParamSpec` - new helper CST nodes: `TypeParameters` to serve as a container for multiple TypeVarLikes, and `TypeParam` which is a single item in a `TypeParameters` (owning the separating comma) - extended `FunctionDef` and `ClassDef` with an optional `type_parameters` field, as well as `whitespace_after_type_parameters` to own the extra whitespace between type parameters and the following token - these new fields are added after all others to avoid breaking callers passing in fields as positional arguments - in `FunctionDef` and `ClassDef`, `whitespace_after_name` now owns the whitespace before the type parameters if they exist |
||
|---|---|---|
| .. | ||
| pyre | ||
| __init__.py | ||
| __main__.py | ||
| test_add_slots.py | ||
| test_batched_visitor.py | ||
| test_deep_clone.py | ||
| test_deep_replace.py | ||
| test_e2e.py | ||
| test_exceptions.py | ||
| test_fuzz.py | ||
| test_pyre_integration.py | ||
| test_tabs.py | ||
| test_tool.py | ||
| test_type_enforce.py | ||
| test_visitor.py | ||