[pull] main from fern-api:main#802
Merged
Merged
Conversation
…#16554) * feat(go): add dedupeUnionBaseProperties flag to drop duplicated union base properties When a discriminated union has base properties that every variant already carries (e.g. lifted from a shared parent by infer-discriminated-union-base-properties), the new opt-in dedupeUnionBaseProperties config (default false) suppresses the duplicate top-level fields and exposes them via discriminant-switching getters that read from the active variant. * fix(go): keep literal base properties out of union dedup A literal base property carried by every variant must not be suppressed: the union and each variant expose literals via a `<Name>()` getter (no `Get` prefix), so a delegating `Get<Name>()` would call a non-existent variant method and fail to compile. Exclude literals from the suppression set so they stay on the normal literal path. * fix(go): only dedupe union base properties when variant getters match Suppression previously matched base↔variant properties by name only and assumed each variant exposed a Get<Name>() returning the base property's type. A same-named variant property with a different type, or a literal (whose getter is <Name>() with no Get prefix), produced a delegating getter that did not compile. Now suppress a base property only when every variant declares a non-literal property of the same name whose getter type matches the base property's getter type; otherwise keep the top-level field. Type comparison runs against a throwaway scope so a variant's (unused) type never leaks in as an import. Also pass the precomputed set into getTypeFieldsForUnion instead of recomputing it.
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )