Skip to content

Commit

Permalink
Repro behavior where @dangerously_unaliased_fixme changes compiler ou…
Browse files Browse the repository at this point in the history
…tput

Reviewed By: gordyf

Differential Revision: D64374361

fbshipit-source-id: 67e45f386475da1f1585477cb98168c966915ca7
  • Loading branch information
captbaritone authored and facebook-github-bot committed Oct 15, 2024
1 parent ef00458 commit cf8a616
Show file tree
Hide file tree
Showing 5 changed files with 753 additions and 1 deletion.
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;
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
}
Loading

0 comments on commit cf8a616

Please sign in to comment.