-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repro behavior where @dangerously_unaliased_fixme changes compiler ou…
…tput Reviewed By: gordyf Differential Revision: D64374361 fbshipit-source-id: 67e45f386475da1f1585477cb98168c966915ca7
- Loading branch information
1 parent
ef00458
commit cf8a616
Showing
5 changed files
with
753 additions
and
1 deletion.
There are no files selected for viewing
325 changes: 325 additions & 0 deletions
325
...y_compiler_integration/fixtures/repro_dangerously_unaliased_changes_output_after.expected
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,325 @@ | ||
==================================== INPUT ==================================== | ||
//- ModuleName.js | ||
graphql` | ||
fragment ModuleName_node on Node { | ||
... on UserSearchResult { | ||
alias | ||
} | ||
} | ||
`; | ||
|
||
graphql` | ||
fragment ModuleName_user on User { | ||
id | ||
...ModuleName_node | ||
} | ||
`; | ||
|
||
graphql` | ||
query ModuleNameQuery { | ||
node(node_id: "4") { | ||
... on User { | ||
# Removing this seems to make it so there is no change | ||
alias | ||
} | ||
# Moving this into the User inline fragment makes this cause no change | ||
...ModuleName_user @dangerously_unaliased_fixme | ||
} | ||
} | ||
`; | ||
|
||
|
||
//- relay.config.json | ||
{ | ||
"language": "typescript", | ||
"schema": "./schema.graphql", | ||
"featureFlags": { | ||
"disable_deduping_common_structures_in_artifacts": { | ||
"kind": "enabled" | ||
} | ||
} | ||
} | ||
|
||
//- schema.graphql | ||
interface Node { | ||
id: ID! | ||
} | ||
type Query { | ||
node(node_id: ID!): Node | ||
} | ||
type User implements Node { | ||
id: ID! | ||
alias: String | ||
} | ||
type UserSearchResult implements Node { | ||
id: ID! | ||
alias: String | ||
} | ||
==================================== OUTPUT =================================== | ||
//- __generated__/ModuleNameQuery.graphql.ts | ||
/** | ||
* <auto-generated> SignedSource<<4f0ee5ff806a9f25428b594d432a805a>> | ||
* @lightSyntaxTransform | ||
* @nogrep | ||
*/ | ||
|
||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import { ConcreteRequest } from 'relay-runtime'; | ||
import { FragmentRefs } from "relay-runtime"; | ||
export type ModuleNameQuery$variables = Record<PropertyKey, never>; | ||
export type ModuleNameQuery$data = { | ||
readonly node: { | ||
readonly alias?: string | null | undefined; | ||
readonly " $fragmentSpreads": FragmentRefs<"ModuleName_user">; | ||
} | null | undefined; | ||
}; | ||
export type ModuleNameQuery = { | ||
response: ModuleNameQuery$data; | ||
variables: ModuleNameQuery$variables; | ||
}; | ||
|
||
const node: ConcreteRequest = { | ||
"fragment": { | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "ModuleNameQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Literal", | ||
"name": "node_id", | ||
"value": "4" | ||
} | ||
], | ||
"concreteType": null, | ||
"kind": "LinkedField", | ||
"name": "node", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "alias", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
}, | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "ModuleName_user" | ||
} | ||
], | ||
"storageKey": "node(node_id:\"4\")" | ||
} | ||
], | ||
"type": "Query", | ||
"abstractKey": null | ||
}, | ||
"kind": "Request", | ||
"operation": { | ||
"argumentDefinitions": [], | ||
"kind": "Operation", | ||
"name": "ModuleNameQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Literal", | ||
"name": "node_id", | ||
"value": "4" | ||
} | ||
], | ||
"concreteType": null, | ||
"kind": "LinkedField", | ||
"name": "node", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "__typename", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "alias", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
}, | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "alias", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "UserSearchResult", | ||
"abstractKey": null | ||
} | ||
], | ||
"type": "Node", | ||
"abstractKey": "__isNode" | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
} | ||
], | ||
"storageKey": "node(node_id:\"4\")" | ||
} | ||
] | ||
}, | ||
"params": { | ||
"cacheID": "4486f6eca895bdea633b44bef50a3569", | ||
"id": null, | ||
"metadata": {}, | ||
"name": "ModuleNameQuery", | ||
"operationKind": "query", | ||
"text": "query ModuleNameQuery {\n node(node_id: \"4\") {\n __typename\n ... on User {\n alias\n }\n ...ModuleName_user\n id\n }\n}\n\nfragment ModuleName_node on Node {\n __isNode: __typename\n ... on UserSearchResult {\n alias\n }\n}\n\nfragment ModuleName_user on User {\n id\n ...ModuleName_node\n}\n" | ||
} | ||
}; | ||
|
||
(node as any).hash = "cc17ed2b9fec1e22d68e8b3c8da43331"; | ||
|
||
export default node; | ||
|
||
//- __generated__/ModuleName_node.graphql.ts | ||
/** | ||
* <auto-generated> SignedSource<<fc1b7e0bdc6e0bcd8b4ea1d4e7a16962>> | ||
* @lightSyntaxTransform | ||
* @nogrep | ||
*/ | ||
|
||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import { ReaderFragment } from 'relay-runtime'; | ||
import { FragmentRefs } from "relay-runtime"; | ||
export type ModuleName_node$data = { | ||
readonly alias?: string | null | undefined; | ||
readonly " $fragmentType": "ModuleName_node"; | ||
}; | ||
export type ModuleName_node$key = { | ||
readonly " $data"?: ModuleName_node$data; | ||
readonly " $fragmentSpreads": FragmentRefs<"ModuleName_node">; | ||
}; | ||
|
||
const node: ReaderFragment = { | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "ModuleName_node", | ||
"selections": [ | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "alias", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "UserSearchResult", | ||
"abstractKey": null | ||
} | ||
], | ||
"type": "Node", | ||
"abstractKey": "__isNode" | ||
}; | ||
|
||
(node as any).hash = "b89613eb4089373194fac4abdce1009f"; | ||
|
||
export default node; | ||
|
||
//- __generated__/ModuleName_user.graphql.ts | ||
/** | ||
* <auto-generated> SignedSource<<aa0b7f9f1ec1f9a35524e682227ed2cb>> | ||
* @lightSyntaxTransform | ||
* @nogrep | ||
*/ | ||
|
||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import { ReaderFragment } from 'relay-runtime'; | ||
import { FragmentRefs } from "relay-runtime"; | ||
export type ModuleName_user$data = { | ||
readonly id: string; | ||
readonly " $fragmentSpreads": FragmentRefs<"ModuleName_node">; | ||
readonly " $fragmentType": "ModuleName_user"; | ||
}; | ||
export type ModuleName_user$key = { | ||
readonly " $data"?: ModuleName_user$data; | ||
readonly " $fragmentSpreads": FragmentRefs<"ModuleName_user">; | ||
}; | ||
|
||
const node: ReaderFragment = { | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "ModuleName_user", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "ModuleName_node" | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
}; | ||
|
||
(node as any).hash = "fdc866618612175df61eea90c737dae2"; | ||
|
||
export default node; |
56 changes: 56 additions & 0 deletions
56
...elay_compiler_integration/fixtures/repro_dangerously_unaliased_changes_output_after.input
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
//- ModuleName.js | ||
graphql` | ||
fragment ModuleName_node on Node { | ||
... on UserSearchResult { | ||
alias | ||
} | ||
} | ||
`; | ||
|
||
graphql` | ||
fragment ModuleName_user on User { | ||
id | ||
...ModuleName_node | ||
} | ||
`; | ||
|
||
graphql` | ||
query ModuleNameQuery { | ||
node(node_id: "4") { | ||
... on User { | ||
# Removing this seems to make it so there is no change | ||
alias | ||
} | ||
# Moving this into the User inline fragment makes this cause no change | ||
...ModuleName_user @dangerously_unaliased_fixme | ||
} | ||
} | ||
`; | ||
|
||
|
||
//- relay.config.json | ||
{ | ||
"language": "typescript", | ||
"schema": "./schema.graphql", | ||
"featureFlags": { | ||
"disable_deduping_common_structures_in_artifacts": { | ||
"kind": "enabled" | ||
} | ||
} | ||
} | ||
|
||
//- schema.graphql | ||
interface Node { | ||
id: ID! | ||
} | ||
type Query { | ||
node(node_id: ID!): Node | ||
} | ||
type User implements Node { | ||
id: ID! | ||
alias: String | ||
} | ||
type UserSearchResult implements Node { | ||
id: ID! | ||
alias: String | ||
} |
Oops, something went wrong.