[repro] add fixture repro for destructuring bug

This commit is contained in:
Mofei Zhang
2024-01-18 18:29:18 -05:00
parent 241a615732
commit f88e7fe412
3 changed files with 61 additions and 0 deletions
@@ -0,0 +1,51 @@
## Input
```javascript
function Component(props) {
const {
x: { destructured },
sameName: renamed,
} = props;
const sameName = foo(destructured);
return [sameName, renamed];
}
```
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(6);
let sameName;
let renamed;
if ($[0] !== props) {
const { x: t20, sameName: t32 } = props;
renamed = t32;
sameName = foo(destructured);
$[0] = props;
$[1] = sameName;
$[2] = renamed;
} else {
sameName = $[1];
renamed = $[2];
}
const t0 = sameName;
let t1;
if ($[3] !== t0 || $[4] !== renamed) {
t1 = [t0, renamed];
$[3] = t0;
$[4] = renamed;
$[5] = t1;
} else {
t1 = $[5];
}
return t1;
}
```
@@ -0,0 +1,9 @@
function Component(props) {
const {
x: { destructured },
sameName: renamed,
} = props;
const sameName = foo(destructured);
return [sameName, renamed];
}
@@ -516,6 +516,7 @@ const skipFilter = new Set([
"bug-jsx-memberexpr-tag-in-lambda",
"bug-invalid-code-when-bailout",
"component-syntax-ref-gating.flow",
"bug-destructuring-same-property-identifier-names",
// 'react-forget-runtime' not yet supported
"flag-enable-emit-hook-guards",