Emit ArrayConverter for array payload members - #130
Merged
Conversation
An array payload member now generates ArrayConverter over the element type and count, so the generated module type-checks. Passing a sub-array dtype to IdentityConverter would type the member as np.void, which the NDArray annotation beside it does not accept. The converter builds the same IdentityConverter over the same dtype, so decoding is unchanged. The IdentityConverter import now belongs to the scalar path alone, so a module whose only passthrough is an array member no longer declares an import it does not use. Closes harp-tech#123
bruno-f-cruz
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
An array payload member now generates
ArrayConverterover the element type and its count, as inField(ArrayConverter(np.float32, 3), offset=3), so the generated module type-checks.Decoding is unchanged.
ArrayConverterbuilds anIdentityConverterover the equivalent sub-array dtype, so the runtime object is the same one it was before and the cross-stack interop test passes without modification.Notes for review
The
IdentityConverterimport now belongs to the scalar path alone, so a module whose only passthrough member is an array no longer declares an import it does not use. That has no effect on the expected output here, which has scalar members too, but it matters for device repositories that lint generated code.core.pyanddevice.coremasks.pyare unchanged, since neither declares an array payload member.device.pyis the only expected output affected, at one import and four descriptors.Closes #123