vyper
vyper copied to clipboard
Fix inconsistent clamp_basetype handling in make_setter function
Description
This PR addresses an inconsistency in the make_setter function in vyper/codegen/core.py. The function was handling clamp_basetype differently for primitive word types compared to other data types (like bytestrings and dynamic arrays).
For other data types, the function properly:
- Caches complex values with
cache_when_complex - Creates a sequence operation with proper IR node construction
- Wraps the result in an
IRnode.from_list()call
However, for primitive word types, it was directly assigning the result of clamp_basetype(right) back to right, which could lead to potential issues with complex values and IR node construction.
Changes
- Modified the
clamp_basetypehandling for primitive word types to use the same pattern as other data types - Added proper caching and sequence construction for clamping operations
- Ensured consistent IR node construction across all data type handlers