Unique args: Handle embedded field that is *not* a struct #1088
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Aims to fix #1087.
One thing I hadn't accounted for is that it's actually possible to have
an embedded type that's not a struct. e.g.
The simplified example above is not because we short circuit unless
properties are exported (and
stringis not exported because it startswith a lower case letter), but if we have a similar case with a custom
type (e.g.
type MyString string) then we can reproduce the errordescribed in #1087.
Fix the problem by making sure to check that a field is really a struct
before recursing back into
getSortedUniqueFields. We're able tosimplify the function somewhat by handling all structs (anonymous or
not) in one spot since the logic is so similar.
Fixes #1087.