Skip to content

Update Struct/Array codegen to recursively use operator<<#968

Open
Kronos3 wants to merge 3 commits intomainfrom
improve-ut-codegen
Open

Update Struct/Array codegen to recursively use operator<<#968
Kronos3 wants to merge 3 commits intomainfrom
improve-ut-codegen

Conversation

@Kronos3
Copy link
Collaborator

@Kronos3 Kronos3 commented Mar 21, 2026

Before this PR, operator<< was implemented for structs and arrays by calling out to toString().

There are two problems with this approach:

  1. If you define operator<< for an abstract type inside a struct, it will not be called.
  2. If you try to implement toString() and run out of space in the Fw::StringBase buffer you are writing to, the string gets truncated
  • This is not at all optimal for unit tests where operator<< is enabled.

I needed this change when working on nasa/fprime#4890 (not a tandem just useful for debugging).

@bocchino
Copy link
Collaborator

Some notes:

  • We will need to review and merge Issue 939 empty structs #966 before merging this PR. Some conflict resolution will be required, but it shouldn't be too bad, as the Scala code changes are localized.
  • We should defer this merge until after releasing v3.2.0 (or make a release branch and merge this into main).

@bocchino bocchino added the blocked Issue is blocked pending resolution of another issue label Mar 21, 2026
@bocchino
Copy link
Collaborator

Also I think this is a tandem PR because it changes the behavior of <<, so it will require tandem changes to FppTest.

@bocchino bocchino added the fprime-fpp tandem F Prime and FPP tandem development label Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Issue is blocked pending resolution of another issue fprime-fpp tandem F Prime and FPP tandem development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants