Skip to content

Fix inconsistent clamp_basetype handling in make_setter function #4642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0xm4ze
Copy link

@0xm4ze 0xm4ze commented May 14, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant