[compiler][test fixtures] Add enablePropagateDepsInHIR to forked tests

Annotates fixtures added in #31030 with `@enablePropagateDepsInHIR` to fork behavior (and commit snapshot differences)
ghstack-source-id: e423e8c42db62f1bb87562b770761be09fc8ffc6
Pull Request resolved: https://github.com/facebook/react/pull/31031
This commit is contained in:
Mofei Zhang 2024-09-30 12:24:20 -04:00
parent 943e45e910
commit 1a779207a7
28 changed files with 210 additions and 124 deletions

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
/** /**
* props.b *does* influence `a` * props.b *does* influence `a`
*/ */
@ -29,13 +30,19 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; /** import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
/**
* props.b *does* influence `a` * props.b *does* influence `a`
*/ */
function Component(props) { function Component(props) {
const $ = _c(2); const $ = _c(5);
let a; let a;
if ($[0] !== props) { if (
$[0] !== props.a ||
$[1] !== props.b ||
$[2] !== props.c ||
$[3] !== props.d
) {
a = []; a = [];
a.push(props.a); a.push(props.a);
bb0: { bb0: {
@ -47,10 +54,13 @@ function Component(props) {
} }
a.push(props.d); a.push(props.d);
$[0] = props; $[0] = props.a;
$[1] = a; $[1] = props.b;
$[2] = props.c;
$[3] = props.d;
$[4] = a;
} else { } else {
a = $[1]; a = $[4];
} }
return a; return a;
} }

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
/** /**
* props.b *does* influence `a` * props.b *does* influence `a`
*/ */

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
/** /**
* props.b does *not* influence `a` * props.b does *not* influence `a`
*/ */
@ -66,14 +67,15 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; /** import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
/**
* props.b does *not* influence `a` * props.b does *not* influence `a`
*/ */
function ComponentA(props) { function ComponentA(props) {
const $ = _c(3); const $ = _c(5);
let a_DEBUG; let a_DEBUG;
let t0; let t0;
if ($[0] !== props) { if ($[0] !== props.a || $[1] !== props.b || $[2] !== props.d) {
t0 = Symbol.for("react.early_return_sentinel"); t0 = Symbol.for("react.early_return_sentinel");
bb0: { bb0: {
a_DEBUG = []; a_DEBUG = [];
@ -85,12 +87,14 @@ function ComponentA(props) {
a_DEBUG.push(props.d); a_DEBUG.push(props.d);
} }
$[0] = props; $[0] = props.a;
$[1] = a_DEBUG; $[1] = props.b;
$[2] = t0; $[2] = props.d;
$[3] = a_DEBUG;
$[4] = t0;
} else { } else {
a_DEBUG = $[1]; a_DEBUG = $[3];
t0 = $[2]; t0 = $[4];
} }
if (t0 !== Symbol.for("react.early_return_sentinel")) { if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0; return t0;
@ -102,9 +106,14 @@ function ComponentA(props) {
* props.b *does* influence `a` * props.b *does* influence `a`
*/ */
function ComponentB(props) { function ComponentB(props) {
const $ = _c(2); const $ = _c(5);
let a; let a;
if ($[0] !== props) { if (
$[0] !== props.a ||
$[1] !== props.b ||
$[2] !== props.c ||
$[3] !== props.d
) {
a = []; a = [];
a.push(props.a); a.push(props.a);
if (props.b) { if (props.b) {
@ -112,10 +121,13 @@ function ComponentB(props) {
} }
a.push(props.d); a.push(props.d);
$[0] = props; $[0] = props.a;
$[1] = a; $[1] = props.b;
$[2] = props.c;
$[3] = props.d;
$[4] = a;
} else { } else {
a = $[1]; a = $[4];
} }
return a; return a;
} }
@ -124,10 +136,15 @@ function ComponentB(props) {
* props.b *does* influence `a`, but only in a way that is never observable * props.b *does* influence `a`, but only in a way that is never observable
*/ */
function ComponentC(props) { function ComponentC(props) {
const $ = _c(3); const $ = _c(6);
let a; let a;
let t0; let t0;
if ($[0] !== props) { if (
$[0] !== props.a ||
$[1] !== props.b ||
$[2] !== props.c ||
$[3] !== props.d
) {
t0 = Symbol.for("react.early_return_sentinel"); t0 = Symbol.for("react.early_return_sentinel");
bb0: { bb0: {
a = []; a = [];
@ -140,12 +157,15 @@ function ComponentC(props) {
a.push(props.d); a.push(props.d);
} }
$[0] = props; $[0] = props.a;
$[1] = a; $[1] = props.b;
$[2] = t0; $[2] = props.c;
$[3] = props.d;
$[4] = a;
$[5] = t0;
} else { } else {
a = $[1]; a = $[4];
t0 = $[2]; t0 = $[5];
} }
if (t0 !== Symbol.for("react.early_return_sentinel")) { if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0; return t0;
@ -157,10 +177,15 @@ function ComponentC(props) {
* props.b *does* influence `a` * props.b *does* influence `a`
*/ */
function ComponentD(props) { function ComponentD(props) {
const $ = _c(3); const $ = _c(6);
let a; let a;
let t0; let t0;
if ($[0] !== props) { if (
$[0] !== props.a ||
$[1] !== props.b ||
$[2] !== props.c ||
$[3] !== props.d
) {
t0 = Symbol.for("react.early_return_sentinel"); t0 = Symbol.for("react.early_return_sentinel");
bb0: { bb0: {
a = []; a = [];
@ -173,12 +198,15 @@ function ComponentD(props) {
a.push(props.d); a.push(props.d);
} }
$[0] = props; $[0] = props.a;
$[1] = a; $[1] = props.b;
$[2] = t0; $[2] = props.c;
$[3] = props.d;
$[4] = a;
$[5] = t0;
} else { } else {
a = $[1]; a = $[4];
t0 = $[2]; t0 = $[5];
} }
if (t0 !== Symbol.for("react.early_return_sentinel")) { if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0; return t0;

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
/** /**
* props.b does *not* influence `a` * props.b does *not* influence `a`
*/ */

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
function ComponentA(props) { function ComponentA(props) {
const a = []; const a = [];
const b = []; const b = [];
@ -34,11 +35,11 @@ function mayMutate() {}
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
function ComponentA(props) { function ComponentA(props) {
const $ = _c(2); const $ = _c(4);
let t0; let t0;
if ($[0] !== props) { if ($[0] !== props.p0 || $[1] !== props.p1 || $[2] !== props.p2) {
const a = []; const a = [];
const b = []; const b = [];
if (b) { if (b) {
@ -49,18 +50,20 @@ function ComponentA(props) {
} }
t0 = <Foo a={a} b={b} />; t0 = <Foo a={a} b={b} />;
$[0] = props; $[0] = props.p0;
$[1] = t0; $[1] = props.p1;
$[2] = props.p2;
$[3] = t0;
} else { } else {
t0 = $[1]; t0 = $[3];
} }
return t0; return t0;
} }
function ComponentB(props) { function ComponentB(props) {
const $ = _c(2); const $ = _c(4);
let t0; let t0;
if ($[0] !== props) { if ($[0] !== props.p0 || $[1] !== props.p1 || $[2] !== props.p2) {
const a = []; const a = [];
const b = []; const b = [];
if (mayMutate(b)) { if (mayMutate(b)) {
@ -71,10 +74,12 @@ function ComponentB(props) {
} }
t0 = <Foo a={a} b={b} />; t0 = <Foo a={a} b={b} />;
$[0] = props; $[0] = props.p0;
$[1] = t0; $[1] = props.p1;
$[2] = props.p2;
$[3] = t0;
} else { } else {
t0 = $[1]; t0 = $[3];
} }
return t0; return t0;
} }

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
function ComponentA(props) { function ComponentA(props) {
const a = []; const a = [];
const b = []; const b = [];

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
let x = []; let x = [];
if (props.cond) { if (props.cond) {
@ -29,11 +30,11 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const $ = _c(5); const $ = _c(7);
let t0; let t0;
if ($[0] !== props) { if ($[0] !== props.cond || $[1] !== props.a || $[2] !== props.b) {
t0 = Symbol.for("react.early_return_sentinel"); t0 = Symbol.for("react.early_return_sentinel");
bb0: { bb0: {
const x = []; const x = [];
@ -41,12 +42,12 @@ function Component(props) {
x.push(props.a); x.push(props.a);
if (props.b) { if (props.b) {
let t1; let t1;
if ($[2] !== props.b) { if ($[4] !== props.b) {
t1 = [props.b]; t1 = [props.b];
$[2] = props.b; $[4] = props.b;
$[3] = t1; $[5] = t1;
} else { } else {
t1 = $[3]; t1 = $[5];
} }
const y = t1; const y = t1;
x.push(y); x.push(y);
@ -58,20 +59,22 @@ function Component(props) {
break bb0; break bb0;
} else { } else {
let t1; let t1;
if ($[4] === Symbol.for("react.memo_cache_sentinel")) { if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
t1 = foo(); t1 = foo();
$[4] = t1; $[6] = t1;
} else { } else {
t1 = $[4]; t1 = $[6];
} }
t0 = t1; t0 = t1;
break bb0; break bb0;
} }
} }
$[0] = props; $[0] = props.cond;
$[1] = t0; $[1] = props.a;
$[2] = props.b;
$[3] = t0;
} else { } else {
t0 = $[1]; t0 = $[3];
} }
if (t0 !== Symbol.for("react.early_return_sentinel")) { if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0; return t0;

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
let x = []; let x = [];
if (props.cond) { if (props.cond) {

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
import {makeArray} from 'shared-runtime'; import {makeArray} from 'shared-runtime';
function Component(props) { function Component(props) {
@ -41,13 +42,13 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { makeArray } from "shared-runtime"; import { makeArray } from "shared-runtime";
function Component(props) { function Component(props) {
const $ = _c(4); const $ = _c(6);
let t0; let t0;
if ($[0] !== props) { if ($[0] !== props.cond || $[1] !== props.a || $[2] !== props.b) {
t0 = Symbol.for("react.early_return_sentinel"); t0 = Symbol.for("react.early_return_sentinel");
bb0: { bb0: {
const x = []; const x = [];
@ -57,21 +58,23 @@ function Component(props) {
break bb0; break bb0;
} else { } else {
let t1; let t1;
if ($[2] !== props.b) { if ($[4] !== props.b) {
t1 = makeArray(props.b); t1 = makeArray(props.b);
$[2] = props.b; $[4] = props.b;
$[3] = t1; $[5] = t1;
} else { } else {
t1 = $[3]; t1 = $[5];
} }
t0 = t1; t0 = t1;
break bb0; break bb0;
} }
} }
$[0] = props; $[0] = props.cond;
$[1] = t0; $[1] = props.a;
$[2] = props.b;
$[3] = t0;
} else { } else {
t0 = $[1]; t0 = $[3];
} }
if (t0 !== Symbol.for("react.early_return_sentinel")) { if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0; return t0;

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
import {makeArray} from 'shared-runtime'; import {makeArray} from 'shared-runtime';
function Component(props) { function Component(props) {

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
function useFoo(props: {value: {x: string; y: string} | null}) { function useFoo(props: {value: {x: string; y: string} | null}) {
const value = props.value; const value = props.value;
return createArray(value?.x, value?.y)?.join(', '); return createArray(value?.x, value?.y)?.join(', ');
@ -22,13 +23,13 @@ export const FIXTURE_ENTRYPONT = {
## Error ## Error
``` ```
1 | function useFoo(props: {value: {x: string; y: string} | null}) { 2 | function useFoo(props: {value: {x: string; y: string} | null}) {
2 | const value = props.value; 3 | const value = props.value;
> 3 | return createArray(value?.x, value?.y)?.join(', '); > 4 | return createArray(value?.x, value?.y)?.join(', ');
| ^^^^^^^^ Todo: Unexpected terminal kind `optional` for optional test block (3:3) | ^^^^^^^^ Todo: Unexpected terminal kind `optional` for optional test block (4:4)
4 | } 5 | }
5 | 6 |
6 | function createArray<T>(...args: Array<T>): Array<T> { 7 | function createArray<T>(...args: Array<T>): Array<T> {
``` ```

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
function useFoo(props: {value: {x: string; y: string} | null}) { function useFoo(props: {value: {x: string; y: string} | null}) {
const value = props.value; const value = props.value;
return createArray(value?.x, value?.y)?.join(', '); return createArray(value?.x, value?.y)?.join(', ');

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const items = (() => { const items = (() => {
if (props.cond) { if (props.cond) {
@ -24,11 +25,11 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const $ = _c(2); const $ = _c(3);
let items; let items;
if ($[0] !== props) { if ($[0] !== props.cond || $[1] !== props.a) {
let t0; let t0;
if (props.cond) { if (props.cond) {
t0 = []; t0 = [];
@ -38,10 +39,11 @@ function Component(props) {
items = t0; items = t0;
items?.push(props.a); items?.push(props.a);
$[0] = props; $[0] = props.cond;
$[1] = items; $[1] = props.a;
$[2] = items;
} else { } else {
items = $[1]; items = $[2];
} }
return items; return items;
} }

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const items = (() => { const items = (() => {
if (props.cond) { if (props.cond) {

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
import {makeObject_Primitives} from 'shared-runtime'; import {makeObject_Primitives} from 'shared-runtime';
function Component(props) { function Component(props) {
@ -25,13 +26,13 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { makeObject_Primitives } from "shared-runtime"; import { makeObject_Primitives } from "shared-runtime";
function Component(props) { function Component(props) {
const $ = _c(2); const $ = _c(3);
let t0; let t0;
if ($[0] !== props) { if ($[0] !== props.cond || $[1] !== props.value) {
t0 = Symbol.for("react.early_return_sentinel"); t0 = Symbol.for("react.early_return_sentinel");
bb0: { bb0: {
const object = makeObject_Primitives(); const object = makeObject_Primitives();
@ -45,10 +46,11 @@ function Component(props) {
break bb0; break bb0;
} }
} }
$[0] = props; $[0] = props.cond;
$[1] = t0; $[1] = props.value;
$[2] = t0;
} else { } else {
t0 = $[1]; t0 = $[2];
} }
if (t0 !== Symbol.for("react.early_return_sentinel")) { if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0; return t0;

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
import {makeObject_Primitives} from 'shared-runtime'; import {makeObject_Primitives} from 'shared-runtime';
function Component(props) { function Component(props) {

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
let x = []; let x = [];
let y = null; let y = null;
@ -28,12 +29,12 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const $ = _c(4); const $ = _c(6);
let y; let y;
let t0; let t0;
if ($[0] !== props) { if ($[0] !== props.cond || $[1] !== props.a || $[2] !== props.b) {
t0 = Symbol.for("react.early_return_sentinel"); t0 = Symbol.for("react.early_return_sentinel");
bb0: { bb0: {
const x = []; const x = [];
@ -43,11 +44,11 @@ function Component(props) {
break bb0; break bb0;
} else { } else {
let t1; let t1;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) { if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
t1 = foo(); t1 = foo();
$[3] = t1; $[5] = t1;
} else { } else {
t1 = $[3]; t1 = $[5];
} }
y = t1; y = t1;
if (props.b) { if (props.b) {
@ -56,12 +57,14 @@ function Component(props) {
} }
} }
} }
$[0] = props; $[0] = props.cond;
$[1] = y; $[1] = props.a;
$[2] = t0; $[2] = props.b;
$[3] = y;
$[4] = t0;
} else { } else {
y = $[1]; y = $[3];
t0 = $[2]; t0 = $[4];
} }
if (t0 !== Symbol.for("react.early_return_sentinel")) { if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0; return t0;

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
let x = []; let x = [];
let y = null; let y = null;

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
import {makeArray} from 'shared-runtime'; import {makeArray} from 'shared-runtime';
function Component(props) { function Component(props) {
@ -45,11 +46,11 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { makeArray } from "shared-runtime"; import { makeArray } from "shared-runtime";
function Component(props) { function Component(props) {
const $ = _c(3); const $ = _c(6);
let t0; let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) { if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {}; t0 = {};
@ -59,7 +60,12 @@ function Component(props) {
} }
const x = t0; const x = t0;
let t1; let t1;
if ($[1] !== props) { if (
$[1] !== props.cond ||
$[2] !== props.cond2 ||
$[3] !== props.value ||
$[4] !== props.value2
) {
let y; let y;
if (props.cond) { if (props.cond) {
if (props.cond2) { if (props.cond2) {
@ -74,10 +80,13 @@ function Component(props) {
y.push(x); y.push(x);
t1 = [x, y]; t1 = [x, y];
$[1] = props; $[1] = props.cond;
$[2] = t1; $[2] = props.cond2;
$[3] = props.value;
$[4] = props.value2;
$[5] = t1;
} else { } else {
t1 = $[2]; t1 = $[5];
} }
return t1; return t1;
} }

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
import {makeArray} from 'shared-runtime'; import {makeArray} from 'shared-runtime';
function Component(props) { function Component(props) {

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const x = {}; const x = {};
let y; let y;
@ -34,9 +35,9 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const $ = _c(3); const $ = _c(4);
let t0; let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) { if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {}; t0 = {};
@ -46,7 +47,7 @@ function Component(props) {
} }
const x = t0; const x = t0;
let t1; let t1;
if ($[1] !== props) { if ($[1] !== props.cond || $[2] !== props.value) {
let y; let y;
if (props.cond) { if (props.cond) {
y = [props.value]; y = [props.value];
@ -57,10 +58,11 @@ function Component(props) {
y.push(x); y.push(x);
t1 = [x, y]; t1 = [x, y];
$[1] = props; $[1] = props.cond;
$[2] = t1; $[2] = props.value;
$[3] = t1;
} else { } else {
t1 = $[2]; t1 = $[3];
} }
return t1; return t1;
} }

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const x = {}; const x = {};
let y; let y;

View File

@ -2,7 +2,7 @@
## Input ## Input
```javascript ```javascript
// @debug // @debug @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const x = {}; const x = {};
let y; let y;
@ -30,9 +30,9 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; // @debug import { c as _c } from "react/compiler-runtime"; // @debug @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const $ = _c(3); const $ = _c(4);
let t0; let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) { if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {}; t0 = {};
@ -42,7 +42,7 @@ function Component(props) {
} }
const x = t0; const x = t0;
let t1; let t1;
if ($[1] !== props) { if ($[1] !== props.cond || $[2] !== props.a) {
let y; let y;
if (props.cond) { if (props.cond) {
y = {}; y = {};
@ -53,10 +53,11 @@ function Component(props) {
y.x = x; y.x = x;
t1 = [x, y]; t1 = [x, y];
$[1] = props; $[1] = props.cond;
$[2] = t1; $[2] = props.a;
$[3] = t1;
} else { } else {
t1 = $[2]; t1 = $[3];
} }
return t1; return t1;
} }

View File

@ -1,4 +1,4 @@
// @debug // @debug @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const x = {}; const x = {};
let y; let y;

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
return props.post.feedback.comments?.edges?.map(render); return props.post.feedback.comments?.edges?.map(render);
} }
@ -11,7 +12,7 @@ function Component(props) {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
const $ = _c(2); const $ = _c(2);
let t0; let t0;

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
function Component(props) { function Component(props) {
return props.post.feedback.comments?.edges?.map(render); return props.post.feedback.comments?.edges?.map(render);
} }

View File

@ -2,6 +2,7 @@
## Input ## Input
```javascript ```javascript
// @enablePropagateDepsInHIR
import {mutate} from 'shared-runtime'; import {mutate} from 'shared-runtime';
function useFoo(props) { function useFoo(props) {
@ -35,13 +36,13 @@ export const FIXTURE_ENTRYPOINT = {
## Code ## Code
```javascript ```javascript
import { c as _c } from "react/compiler-runtime"; import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { mutate } from "shared-runtime"; import { mutate } from "shared-runtime";
function useFoo(props) { function useFoo(props) {
const $ = _c(2); const $ = _c(4);
let x; let x;
if ($[0] !== props) { if ($[0] !== props.bar || $[1] !== props.cond || $[2] !== props.foo) {
x = []; x = [];
x.push(props.bar); x.push(props.bar);
if (props.cond) { if (props.cond) {
@ -53,10 +54,12 @@ function useFoo(props) {
} }
mutate(x); mutate(x);
$[0] = props; $[0] = props.bar;
$[1] = x; $[1] = props.cond;
$[2] = props.foo;
$[3] = x;
} else { } else {
x = $[1]; x = $[3];
} }
return x; return x;
} }

View File

@ -1,3 +1,4 @@
// @enablePropagateDepsInHIR
import {mutate} from 'shared-runtime'; import {mutate} from 'shared-runtime';
function useFoo(props) { function useFoo(props) {