Conversation
Emit homogeneous V arrays/maps for typed variadic arguments. Detect *args: T and similar annotations and emit as ...T instead of ...Any. Handle **kwargs: T as map[string]T instead of map[string]Any. Default untyped variadics to ...Any and map[string]Any. Improve Mypy plugin to store types by simple name for better inference lookup. Update v_types.py to handle lowercase dict and tuple identifiers from Mypy. Co-authored-by: yaskhan <3676373+yaskhan@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Pull request #248 has conflicts that needs to be resolved. |
- Modified `FunctionsMixin` to handle explicit annotations and inferred types for `*args` and `**kwargs`. - Updated `*args` to emit `...T` and `**kwargs` to emit `map[string]T`. - Fixed `NameError` and key mismatch in `mypy_plugin.py`. - Enhanced `v_types.py` for Mypy's lowercase `dict`/`tuple` and `builtins.` stripping. - Improved `CallsMixin` to correctly transpile `bytes`, `bytearray`, and `memoryview`. - Fixed PEP 695 test expectation for `tuple[*Ts]`. - Added `test_variadic_typing.py` and updated existing variadic tests. Co-authored-by: yaskhan <3676373+yaskhan@users.noreply.github.com>
|
Pull request #248 has conflicts that needs to be resolved. |
592f0b8 to
db8e305
Compare
This PR implements statically typed variadic arguments in the Python-to-V transpiler.
Key changes:
FunctionsMixininpy2v_transpiler/core/translator/functions.pyto correctly handle explicit annotations and inferred types for*argsand**kwargs.*argshandling to strip V array brackets[]and emit variadic syntax...T.**kwargshandling to ensure it is always emitted as a map (map[string]T).int/map[string]stringtoAny/map[string]Any.py2v_transpiler/core/mypy_plugin.pyto store inferred types by simple variable name, enabling more reliable type lookups during translation.py2v_transpiler/models/v_types.pyto support lowercasedictandtupleidentifiers (often emitted by Mypy) and to stripbuiltins.prefixes.py2v_transpiler/tests/translator/test_variadic_typing.pyand updated existing tests intest_varargs.pyandtest_kwargs_def.pyto reflect the improved defaults.Fixes #178
PR created automatically by Jules for task 16994163937431969794 started by @yaskhan