forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler] Fork fixtures for enablePropagateDepsInHIR
- flip `enablePropagateDepsInHIR` to off by default - fork fixtures which produce compilation differences in facebook#30894 to separate directory `propagate-scope-deps-hir-fork`, to be cleaned up when we remove this flag ghstack-source-id: 7d5b8dc29788a65c272c846af9877b09fbf2cd60 Pull Request resolved: facebook#30949
- Loading branch information
Showing
69 changed files
with
2,445 additions
and
19 deletions.
There are no files selected for viewing
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
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
2 changes: 1 addition & 1 deletion
2
...-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep.js
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
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
2 changes: 1 addition & 1 deletion
2
...tests__/fixtures/compiler/optional-member-expression-inverted-optionals-parallel-paths.js
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
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
2 changes: 1 addition & 1 deletion
2
...r/src/__tests__/fixtures/compiler/optional-member-expression-single-with-unconditional.js
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
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
2 changes: 1 addition & 1 deletion
2
...lugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-single.js
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
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
2 changes: 1 addition & 1 deletion
2
...r/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional-optional.js
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
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
2 changes: 1 addition & 1 deletion
2
...t-compiler/src/__tests__/fixtures/compiler/optional-member-expression-with-conditional.js
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
48 changes: 48 additions & 0 deletions
48
.../propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.expect.md
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,48 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
function Component(props) { | ||
const data = useMemo(() => { | ||
return props?.items.edges?.nodes.map(); | ||
}, [props?.items.edges?.nodes]); | ||
return <Foo data={data} />; | ||
} | ||
|
||
``` | ||
## Code | ||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
function Component(props) { | ||
const $ = _c(4); | ||
|
||
props?.items.edges?.nodes; | ||
let t0; | ||
let t1; | ||
if ($[0] !== props?.items.edges?.nodes) { | ||
t1 = props?.items.edges?.nodes.map(); | ||
$[0] = props?.items.edges?.nodes; | ||
$[1] = t1; | ||
} else { | ||
t1 = $[1]; | ||
} | ||
t0 = t1; | ||
const data = t0; | ||
let t2; | ||
if ($[2] !== data) { | ||
t2 = <Foo data={data} />; | ||
$[2] = data; | ||
$[3] = t2; | ||
} else { | ||
t2 = $[3]; | ||
} | ||
return t2; | ||
} | ||
|
||
``` | ||
### Eval output | ||
(kind: exception) Fixture not implemented |
7 changes: 7 additions & 0 deletions
7
...fixtures/compiler/propagate-scope-deps-hir-fork/optional-member-expression-as-memo-dep.js
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,7 @@ | ||
// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
function Component(props) { | ||
const data = useMemo(() => { | ||
return props?.items.edges?.nodes.map(); | ||
}, [props?.items.edges?.nodes]); | ||
return <Foo data={data} />; | ||
} |
46 changes: 46 additions & 0 deletions
46
...hir-fork/optional-member-expression-inverted-optionals-parallel-paths.expect.md
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,46 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
import {ValidateMemoization} from 'shared-runtime'; | ||
function Component(props) { | ||
const data = useMemo(() => { | ||
const x = []; | ||
x.push(props?.a.b?.c.d?.e); | ||
x.push(props.a?.b.c?.d.e); | ||
return x; | ||
}, [props.a.b.c.d.e]); | ||
return <ValidateMemoization inputs={[props.a.b.c.d.e]} output={x} />; | ||
} | ||
|
||
``` | ||
## Code | ||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
import { ValidateMemoization } from "shared-runtime"; | ||
function Component(props) { | ||
const $ = _c(2); | ||
let t0; | ||
|
||
const x$0 = []; | ||
x$0.push(props?.a.b?.c.d?.e); | ||
x$0.push(props.a?.b.c?.d.e); | ||
t0 = x$0; | ||
let t1; | ||
if ($[0] !== props.a.b.c.d.e) { | ||
t1 = <ValidateMemoization inputs={[props.a.b.c.d.e]} output={x} />; | ||
$[0] = props.a.b.c.d.e; | ||
$[1] = t1; | ||
} else { | ||
t1 = $[1]; | ||
} | ||
return t1; | ||
} | ||
|
||
``` | ||
### Eval output | ||
(kind: exception) Fixture not implemented |
11 changes: 11 additions & 0 deletions
11
...agate-scope-deps-hir-fork/optional-member-expression-inverted-optionals-parallel-paths.js
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,11 @@ | ||
// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
import {ValidateMemoization} from 'shared-runtime'; | ||
function Component(props) { | ||
const data = useMemo(() => { | ||
const x = []; | ||
x.push(props?.a.b?.c.d?.e); | ||
x.push(props.a?.b.c?.d.e); | ||
return x; | ||
}, [props.a.b.c.d.e]); | ||
return <ValidateMemoization inputs={[props.a.b.c.d.e]} output={x} />; | ||
} |
62 changes: 62 additions & 0 deletions
62
...pe-deps-hir-fork/optional-member-expression-single-with-unconditional.expect.md
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,62 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
import {ValidateMemoization} from 'shared-runtime'; | ||
function Component(props) { | ||
const data = useMemo(() => { | ||
const x = []; | ||
x.push(props?.items); | ||
x.push(props.items); | ||
return x; | ||
}, [props.items]); | ||
return <ValidateMemoization inputs={[props.items]} output={data} />; | ||
} | ||
|
||
``` | ||
## Code | ||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
import { ValidateMemoization } from "shared-runtime"; | ||
function Component(props) { | ||
const $ = _c(7); | ||
let t0; | ||
let x; | ||
if ($[0] !== props.items) { | ||
x = []; | ||
x.push(props?.items); | ||
x.push(props.items); | ||
$[0] = props.items; | ||
$[1] = x; | ||
} else { | ||
x = $[1]; | ||
} | ||
t0 = x; | ||
const data = t0; | ||
let t1; | ||
if ($[2] !== props.items) { | ||
t1 = [props.items]; | ||
$[2] = props.items; | ||
$[3] = t1; | ||
} else { | ||
t1 = $[3]; | ||
} | ||
let t2; | ||
if ($[4] !== t1 || $[5] !== data) { | ||
t2 = <ValidateMemoization inputs={t1} output={data} />; | ||
$[4] = t1; | ||
$[5] = data; | ||
$[6] = t2; | ||
} else { | ||
t2 = $[6]; | ||
} | ||
return t2; | ||
} | ||
|
||
``` | ||
### Eval output | ||
(kind: exception) Fixture not implemented |
11 changes: 11 additions & 0 deletions
11
...ler/propagate-scope-deps-hir-fork/optional-member-expression-single-with-unconditional.js
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,11 @@ | ||
// @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enablePropagateDepsInHIR | ||
import {ValidateMemoization} from 'shared-runtime'; | ||
function Component(props) { | ||
const data = useMemo(() => { | ||
const x = []; | ||
x.push(props?.items); | ||
x.push(props.items); | ||
return x; | ||
}, [props.items]); | ||
return <ValidateMemoization inputs={[props.items]} output={data} />; | ||
} |
Oops, something went wrong.