Python: Add parameter field_type attribution and call-site type arguments#6795
Merged
knutwannheden merged 3 commits intomainfrom Feb 23, 2026
Merged
Python: Add parameter field_type attribution and call-site type arguments#6795knutwannheden merged 3 commits intomainfrom
field_type attribution and call-site type arguments#6795knutwannheden merged 3 commits intomainfrom
Conversation
- Add type attribution tests to 13 existing parser test files covering method invocations, binary ops, type hints, collection literals, imports, field access, class instances, method declarations, async defs, for loops, unary ops, ternaries, and lambdas - Add `method_declaration_type()` to type_mapping.py to build JavaType.Method for function declarations using ty-types descriptor data with annotation fallback - Add type attribution to ParameterizedType nodes in type hint expressions - Fix pre-existing assign_test.py bug (simple_name access, FQN startswith) - Add typing.Text test to test_type_attribution.py - Bump ty-types dependency to >=0.0.19.dev20260223093555
- Add param_type_info() to PythonTypeMapping for function parameter Identifier nodes to get JavaType.Variable field_type - Update __convert_name() and map_arg() to flow field_type through to J.Identifier and NamedVariable - Use call signature returnTypeId for call-site-specific return types (e.g. int for identity(42) instead of generic T) - Populate _declared_formal_type_names on method invocation types from function descriptor type parameters - Bump ty-types to 0.0.19.dev20260223102528 for callSignature typeArguments/returnTypeId support
field_type attribution and call-site type arguments
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.
Summary
param_type_info()toPythonTypeMappingso function parameterJ.Identifiernodes getJavaType.Variablefield_type (matching howvisit_Nameandvisit_Attributealready work)returnTypeIdfor call-site-specific return types (e.g.,intforidentity(42)instead of genericT)_declared_formal_type_nameson method invocation types from function descriptor type parametersty-typesto0.0.19.dev20260223102528forcallSignaturetypeArguments/returnTypeIdsupportTest plan
test_param_identifier_field_type— verifiesJ.Identifier.field_typeisJavaType.Variablefor typed function parameterstest_generic_call_site_return_type— verifiesidentity(42)getsPrimitive.Intreturn type and['T']declared formal type namestest_generic_class_type_params— verifies type parameters on generic classBox[T]