vyper icon indicating copy to clipboard operation
vyper copied to clipboard

Fix inconsistent clamp_basetype handling in make_setter function

Open m47e opened this issue 8 months ago • 0 comments

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:

  1. Caches complex values with cache_when_complex
  2. Creates a sequence operation with proper IR node construction
  3. 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_basetype handling 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

m47e avatar May 14 '25 18:05 m47e