Python: Add type attribution tests and fix method declaration/type hint types#6794
Merged
knutwannheden merged 1 commit intomainfrom Feb 23, 2026
Merged
Python: Add type attribution tests and fix method declaration/type hint types#6794knutwannheden merged 1 commit intomainfrom
knutwannheden merged 1 commit 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
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
method_declaration_type()totype_mapping.pythat buildsJavaType.Methodfor function/method declarations — uses structured descriptor data from ty-types when available, falls back to resolving parameter annotations individuallyParameterizedTypenodes (e.g.,List[int]) in the parser visitorassign_test.pybug:method.simple_name→method.name.simple_name, and FQN assertions to usestartswithfor types that include type parametersty-typesdependency to>=0.0.19.dev20260223093555which now populatesparametersandreturnTypeon function descriptorsTest plan
from-importdeclaring_type is None (genuine type mapping gap for direct function imports)parametersandreturnType