Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix merged selection set name ambiguity at definition root #3168

Merged
merged 4 commits into from
Aug 1, 2023

Conversation

AnthonyMDev
Copy link
Contributor

@AnthonyMDev AnthonyMDev commented Jul 31, 2023

When merging a selection set with a nested child selection set into a type case that does not also select additional fields on that child selection set, we use a direct reference to the generated selection set in the defining entity selection set. This directly merged child selection set is referenced by its name relative to the type case.

To calculate the relative name, we determine where the shared root between the definition of the merged child and the target it is being merged into was, and generated the name as only up to their shared root. When the shared root of the directly merged child is the root of the operation, this causes a naming ambiguity problem and a compliation error.

We must use the fully qualified name in this situation.

In the example for this test, the innerChild field on AsEventA.Child.AsChildA would previously have the
type Child.AsChildA.InnerChild, which does not exist, because the first component (Child) was inferred to be the AsEventA.Child. The intention was to point to the TestFragment.Child.AsChildA.InnerChild.

@netlify
Copy link

netlify bot commented Jul 31, 2023

Deploy Preview for apollo-ios-docs canceled.

Name Link
🔨 Latest commit 023c25d
🔍 Latest deploy log https://app.netlify.com/sites/apollo-ios-docs/deploys/64c84ac7ad26650008dde0ed

Copy link
Member

@calvincestari calvincestari left a comment

Choose a reason for hiding this comment

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

Nice work, LGTM!

@AnthonyMDev AnthonyMDev merged commit 5065f51 into main Aug 1, 2023
@AnthonyMDev AnthonyMDev deleted the fix-selection-set-name-ambiguity branch August 1, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x is not member of x in generated files error after using selectionSetInitializers
3 participants