Repository navigation
Type Parameter Modernization: Port TypeVarCheck to libcst - #281
Open
FrancescoPezzella wants to merge 108 commits into
Open
FrancescoPezzella wants to merge 108 commits into
FrancescoPezzella wants to merge 108 commits into
Conversation
FrancescoPezzella
added this pull request to stack #277
October 13, 2026 08:19
FrancescoPezzella
force-pushed
the
typing-recipes-2-cst-structure
branch
from
October 13, 2026 08:22
c99aa4d to
8ab7782
Compare
FrancescoPezzella
marked this pull request as ready for review
October 13, 2026 12:19
…rameter modernization feature page, define type hint, type parameter and type variable, and fix the test file name in the rewrite-semantics module doc.
… over NodeProtocol ASTNode now satisfies NodeProtocol, so adapters that don't subclass ASTNode (RST, CST, LST) type-check, and clang references keep their concrete node type (#269).
Overall around 10 % (600) PyRight issues solved with this PR
FrancescoPezzella
removed this pull request from stack #277
October 16, 2026 11:58
…pansThe three CST xfails in test_offset_encoding now pass; spans match the RST backend (decorators included, trailing newline excluded).
references/referenced_by link each use to its definition (string annotations included), so MatchFinder's reference matching now works on the CST backend.
PythonRefactoring is generic over the node class (RST by default), and body returns the module's top-level statements on both backends.
Add extra TODOs regarding AI docstrings.
libcst only links a use to definitions above it; annotations and type hints are evaluated lazily, so they now count too.
…rameters. Type Vars can now be safely converted, even if the imports cannot be deleted (before it was all or nothing), now a partial fix is applied.
…CONFLICT`. Detect name conflicts in the file when localizing a Type Var with for example a bound=Box, where Box is already defined in the file.
…fely while the import in __all__ is kept.
…n Covariant/Contravariant/Bound is added to ParamSpec/TypeVarTuple, the change becomes unsafe since a modern syntax for it does not exist.
Fixes the conflicting-rewrite ValueError on `from x import T, U`; each needed import is added once.
…file The origin's `from ._compat import TypeVar` is now rewritten relative to the importing file instead of losing its dots.
…tected after a numerous amount of checks).
…ze_import, moving its relative-import and alias cases to the localization tests. Documented a bug with comments being lost.
Analysis and rewriting now use libcst only, so uses in string annotations and names shadowed by a class's own type parameters are handled, multi-line strings and import comments are kept, and unparse_utils is removed.
… __is_ancestor_in_nodes can't just drop its `and False` (#286). Move import_from_module and imported_name to import_resolution, so the import-from logic exists once.
FrancescoPezzella
force-pushed
the
typing-recipes-2-cst-structure
branch
from
October 16, 2026 15:03
a581268 to
e12c0e7
Compare
FrancescoPezzella
added this pull request to stack #295
October 16, 2026 15:04
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.