fix(chisel): correct dynamic type detection and .length semantics #12589
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.
This change implements accurate dynamic type detection in
Type::is_dynamic()and corrects.lengthhandling inType::map_special()to align with Solidity semantics. Previously, the dynamicness check treated arrays broadly and left a TODO that allowed fixed arrays of static elements and tuples of static elements to be considered dynamic, which is incorrect per ABI rules; the new logic recurses through tuples and fixed arrays to mark types as dynamic only when appropriate, while retaining dynamic behavior for bytes, string, and dynamic arrays. Additionally,.lengthshould not be available on fixed-size bytes(bytes1..bytes32)since they are value types and not arrays; the condition for exposing .length was adjusted to include only dynamic types and arrays, excluding fixed bytes. This change is localized:is_dynamic()is only referenced in the.lengthgate withinmap_special(), and pop remains unchanged viais_dynamic_array(). The result is stricter and more correct behavior for member access resolution without altering unrelated flows.