Skip to content
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

RSDK-9370: change param prefix check in module generation #4654

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

purplenicole730
Copy link
Member

@purplenicole730 purplenicole730 commented Dec 23, 2024

Ticket found a bug where pointer param types weren't attributing to the resource subtype.
Return and param types were treated differently and separately, so even though return types were attributing pointer types correctly, params were not. Now, types are being formatted the same in both returns and types. Instead of a switch statement, a for loop was introduced for scalability and readability.

Tested locally with arm, board, and camera components and vision service. Not sure if there's other resources with more kinds of types that should be tested.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Dec 23, 2024
@purplenicole730 purplenicole730 marked this pull request as ready for review December 23, 2024 19:57
@purplenicole730 purplenicole730 requested a review from a team as a code owner December 23, 2024 19:57
Copy link
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

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

Abstractly this code all looks reasonable to me, but it's a lot of indexing math and string manipulation that I don't really have context for. It would be great if we could add a test somewhere to show that we're now correctly generating type names for maps, pointers, channels, etc., or at a minimum add a screenshot showing the corrected behavior (as opposed to the behavior in the screenshot on the ticket).

typeString := buf.String()

prefixes := []string{"*", "[]*", "[]", "chan "}
// checkUpper attributes to <resourceSubtype> if type is capitalized after prefix.
Copy link
Member

Choose a reason for hiding this comment

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

(minor) I think there's a word missing between "checkUpper" and "attributes"? Either that or i'm just having trouble parsing the grammar here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants