Skip to content

Conversation

Naunet
Copy link
Contributor

@Naunet Naunet commented Jul 23, 2024

The test case LotsOfFields only works because all of the fields have the same value. The actual code is allocating the first 32 (DEFAULT_STRUCT_FIELD_COUNT) fields to the correct position but then using the JSON order to define any other fields. If we rearrange the fields in the JSON and use unique values then the result is wrong (see the new test).

I propose to use the fieldcount function instead of a constant to determine the number of fields. The documentation states that this function may throw an error but I'm not sure that the rest of JSON3 can handle such abstract cases, and there are no test cases currently defined that are failing.

An error is thrown if the type is too abstract to determine this.

Copy link
Owner

@quinnj quinnj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@quinnj quinnj merged commit 4856272 into quinnj:main Oct 16, 2024
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.

2 participants