Skip to content

Add typeParameters to generic descriptors and always serialize parameters#8

Merged
knutwannheden merged 2 commits intomainfrom
wonky-koala
Feb 23, 2026
Merged

Add typeParameters to generic descriptors and always serialize parameters#8
knutwannheden merged 2 commits intomainfrom
wonky-koala

Conversation

@knutwannheden
Copy link
Contributor

Summary

  • Add typeParameters field to Function, ClassLiteral, and BoundMethod descriptors, surfacing PEP 695 generic type parameters in the wire protocol
  • Extract type parameters from Signature.generic_context and ClassLiteral.generic_context, filtering out implicit Self type variables
  • Fix TypeVar name to use the simple name (e.g. T) instead of the qualified display form (T@identity)
  • Always serialize parameters on Function and BoundMethod (even when empty)

Test plan

  • Added test_generic_function_type_parameters — verifies def identity[T](x: T) -> T has typeParameters pointing to a typeVar named T
  • Added test_generic_class_type_parameters — verifies class Box[T] has typeParameters on classLiteral
  • Added test_non_generic_function_no_type_parameters — verifies non-generic function omits typeParameters key
  • All 12 integration tests pass

…tors

Surface generic type parameters (PEP 695) in the wire protocol. Extracts
type parameters from Signature.generic_context and ClassLiteral.generic_context,
filtering out implicit Self type variables. Also fixes TypeVar name to use the
simple name (e.g. "T") instead of the qualified display form ("T@identity").
…tors

A function declaration should always include a parameters array, even
when empty, so consumers don't need to handle the absent-key case.
@knutwannheden knutwannheden merged commit 6585824 into main Feb 23, 2026
7 checks passed
@knutwannheden knutwannheden deleted the wonky-koala branch February 23, 2026 09:34
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant