diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-func-simple-alias.expect.md b/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-func-simple-alias.expect.md new file mode 100644 index 0000000000..cdd4de6e59 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-func-simple-alias.expect.md @@ -0,0 +1,40 @@ + +## Input + +```javascript +function component(a) { + let x = { a }; + let y; + (function () { + y = x; + })(); + mutate(y); + return y; +} + +``` + +## Code + +```javascript +function component(a) { + const $ = React.unstable_useMemoCache(); + const c_0 = $[0] !== a; + let x; + if (c_0) { + x = { a: a }; + $[0] = a; + $[1] = x; + } else { + x = $[1]; + } + const y = undefined; + (function () { + y = x; + })(); + mutate(y); + return y; +} + +``` + \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-func-simple-alias.js b/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-func-simple-alias.js new file mode 100644 index 0000000000..513bc83336 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug.capturing-func-simple-alias.js @@ -0,0 +1,9 @@ +function component(a) { + let x = { a }; + let y; + (function () { + y = x; + })(); + mutate(y); + return y; +}