Source generated formatters that support private members by AArnott · Pull Request #1802 · MessagePack-CSharp/MessagePack-CSharp · GitHub
Skip to content

Source generated formatters that support private members#1802

Merged
AArnott merged 5 commits into
developfrom
fix1745
May 7, 2024
Merged

Source generated formatters that support private members#1802
AArnott merged 5 commits into
developfrom
fix1745

Conversation

@AArnott

@AArnott AArnott commented Apr 20, 2024

Copy link
Copy Markdown
Collaborator

Closes #1745

@AArnott AArnott changed the base branch from master to develop April 20, 2024 03:44
@AArnott AArnott added this to the v3.0 milestone Apr 20, 2024
@AArnott AArnott force-pushed the fix1745 branch 3 times, most recently from cc9590f to 69a3911 Compare April 22, 2024 15:24
@AArnott AArnott requested a review from neuecc April 22, 2024 15:24
@AArnott AArnott marked this pull request as ready for review April 22, 2024 15:24
@AArnott

AArnott commented Apr 22, 2024

Copy link
Copy Markdown
Collaborator Author

AArnott added 4 commits April 27, 2024 11:03
As the formatter must have access (per C# rules) to the private members, the formatter must be nested under the data type.
This requires the data type (and any nesting types of that data type) to be declared as `partial` so that the source generated code can add the formatter as an `internal` member of it.
Since traditionally data types haven't been required to be partial, we only nest the formatter under the data type when private members must be serialized; otherwise we continue to generate the formatter as nested under the generated resolver.

Closes #1745
@neuecc

neuecc commented Apr 30, 2024

Copy link
Copy Markdown
Member

thanks, I'll check soon(1-2days)

@AArnott

AArnott commented May 6, 2024

Copy link
Copy Markdown
Collaborator Author

Last call, @neuecc. :)

@neuecc

neuecc commented May 7, 2024

Copy link
Copy Markdown
Member

@neuecc neuecc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the very delayed check.
I checked the feature and impl, it is good!

This was referenced Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source generate formatters as nested under the types they format for private member access

2 participants