Skip to content

Conversation

@knutwannheden
Copy link
Contributor

@knutwannheden knutwannheden commented Jan 16, 2026

Also adds parser tests as Pytest modules, as these are way quicker to run (~200ms total).

knutwannheden and others added 9 commits January 16, 2026 12:25
- Implement parsing and printing for Python 3.12+ type parameters
  (TypeVar, TypeVarTuple, ParamSpec) in class and function definitions
- Add support for subscript decorators (e.g., @[property][0])
- Fix f-string debug expression trailing newline issue
- Add comprehensive tests for type parameters and decorators

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add support for PEP 695 type parameters on type alias statements
(e.g., `type Foo[T] = list[T]`).

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Detect and strip BOM character (U+FEFF) before parsing
- Store BOM presence in CompilationUnit.charset_bom_marked
- Output BOM when printing if file originally had one

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The parser was incorrectly determining whether parentheses belong to a
tuple or its first element. The heuristic only checked column offset,
but for multi-line tuples like:

    for (
        window,
        in_entry,
    ) in buf_out:

The tuple and first element have the same column offset (4) but are on
different lines. The fix now checks both line AND column to correctly
identify that the '(' belongs to the tuple itself.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@knutwannheden knutwannheden merged commit 7bf9bc9 into main Jan 16, 2026
2 checks passed
@knutwannheden knutwannheden deleted the parser-fixes branch January 16, 2026 17:00
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants