-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
transform: flatten mangler: handle nil subfields
Fix the FlattenMangler so it doesn't populate intermediate struct-fields of pointer-type. Since pointerification pretty much always converts these fields to pointers, this is the common case. There was a bit of missing accounting, so with two structs: ```go type A struct { Field1 *int Field2 *string } struct B struct{ Field3 *A } ``` `B.Field3` was always populated with the zero-value, even if both `B.Field3_Field1` and `B.Field3_Field2` are `nil`. This change fixes the case where all underlying fields are `nil`, and prevents those intermediate fields from getting set to non-`nil` values.
- Loading branch information
Showing
2 changed files
with
110 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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