diff --git a/compiler/forget/src/Babel/BabelPlugin.ts b/compiler/forget/src/Babel/BabelPlugin.ts index 180cde0fc3..615c9e5346 100644 --- a/compiler/forget/src/Babel/BabelPlugin.ts +++ b/compiler/forget/src/Babel/BabelPlugin.ts @@ -191,11 +191,55 @@ export default function ReactForgetBabelPlugin( opts: { ...pass.opts, ...options }, }); - if (options.gating != null && hasForgetCompiledCode) { - path.unshiftContainer( - "body", - buildImportForGatingModule(options.gating) - ); + // If there isn't already an import of * as React, insert it so React.useMemoCache doesn't + // throw + if (hasForgetCompiledCode) { + let didInsertUseMemoCache = false; + let hasExistingReactImport = false; + path.traverse({ + MemberExpression(memberExprPath) { + const obj = memberExprPath.get("object"); + const prop = memberExprPath.get("property"); + if ( + obj.isIdentifier() && + obj.node.name === "React" && + prop.isIdentifier() && + prop.node.name === "unstable_useMemoCache" + ) { + didInsertUseMemoCache = true; + memberExprPath.stop(); + } + }, + ImportDeclaration(importDeclPath) { + if ( + importDeclPath.get("source").node.value === "react" && + importDeclPath.get("specifiers").length === 1 && + importDeclPath + .get("specifiers")[0] + .isImportNamespaceSpecifier() && + importDeclPath.get("specifiers")[0].get("local").node.name === + "React" + ) { + hasExistingReactImport = true; + importDeclPath.stop(); + } + }, + }); + if (didInsertUseMemoCache && !hasExistingReactImport) { + path.unshiftContainer( + "body", + t.importDeclaration( + [t.importNamespaceSpecifier(t.identifier("React"))], + t.stringLiteral("react") + ) + ); + } + if (options.gating != null) { + path.unshiftContainer( + "body", + buildImportForGatingModule(options.gating) + ); + } } } catch (err) { if (options.logger && err) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/_bug.computed-call-evaluation-order.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/_bug.computed-call-evaluation-order.expect.md index f1aae9f1ee..c3f6d691c9 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/_bug.computed-call-evaluation-order.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/_bug.computed-call-evaluation-order.expect.md @@ -23,7 +23,7 @@ function Component() { ## Code ```javascript -// Should print A, B, arg, original +import * as React from "react"; // Should print A, B, arg, original function changeF(o) { o.f = () => console.log("new"); return undefined; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-reassign-shadowed-primitive.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-reassign-shadowed-primitive.expect.md index 3655fff153..42da1bf336 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-reassign-shadowed-primitive.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-reassign-shadowed-primitive.expect.md @@ -19,6 +19,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/_bug.property-call-evaluation-order.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/_bug.property-call-evaluation-order.expect.md index 6a82b6c302..d19fc984d0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/_bug.property-call-evaluation-order.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/_bug.property-call-evaluation-order.expect.md @@ -22,7 +22,7 @@ function Component() { ## Code ```javascript -// Should print A, arg, original +import * as React from "react"; // Should print A, arg, original function changeF(o) { o.f = () => console.log("new"); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md index bf05ccf359..6251e27a85 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md @@ -16,6 +16,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path-mutate.expect.md index 084b6b5d4a..7e54e507b8 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path-mutate.expect.md @@ -17,6 +17,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path.expect.md index 88c854c57f..5922aba3ad 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path.expect.md @@ -16,6 +16,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(3); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/alias-while.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/alias-while.expect.md index 3821b16036..46066bf54d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/alias-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/alias-while.expect.md @@ -26,6 +26,7 @@ function mutate(x, y) {} ## Code ```javascript +import * as React from "react"; function foo(cond) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== cond; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md index 1b9703f762..663cff8fef 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md @@ -19,7 +19,7 @@ function AllocatingPrimitiveAsDepNested(props) { ## Code ```javascript -// bar(props.b) is an allocating expression that produces a primitive, which means +import * as React from "react"; // bar(props.b) is an allocating expression that produces a primitive, which means // that Forget should memoize it. // Correctness: // - y depends on either bar(props.b) or bar(props.b) + 1 diff --git a/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md index 0e1a15a95d..e137d9f47a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md @@ -16,7 +16,7 @@ function AllocatingPrimitiveAsDep(props) { ## Code ```javascript -// bar(props.b) is an allocating expression that produces a primitive, which means +import * as React from "react"; // bar(props.b) is an allocating expression that produces a primitive, which means // that Forget should memoize it. // Correctness: // - y depends on either bar(props.b) or bar(props.b) + 1 diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md index 1e0cd1f8ef..e5a907ae33 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md @@ -16,6 +16,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(10); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md index c828bc29c0..c2c82da02a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== props.x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md index 4338597577..9971f4b499 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md @@ -17,7 +17,7 @@ function ArrayAtTest(props) { ## Code ```javascript -// arrayInstance.at should have the following effects: +import * as React from "react"; // arrayInstance.at should have the following effects: // - read on arg0 // - read on receiver // - mutate on lvalue diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-at-mutate-after-capture.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-at-mutate-after-capture.expect.md index 6500c946c3..fd17096e2d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-at-mutate-after-capture.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-at-mutate-after-capture.expect.md @@ -18,7 +18,7 @@ function Component(props) { ## Code ```javascript -// x's mutable range should extend to `mutate(y)` +import * as React from "react"; // x's mutable range should extend to `mutate(y)` function Component(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md index 5b239910a8..643e4299b2 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== props.foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md index eceef37fa3..589d335c0f 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md @@ -13,6 +13,7 @@ function component([a, b]) { ## Code ```javascript +import * as React from "react"; function component(t17) { const $ = React.unstable_useMemoCache(7); const [a, b] = t17; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-properties.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-properties.expect.md index 2c4bc324b0..baf036302e 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-properties.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-properties.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-property-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-property-call.expect.md index fa0d1c60f2..ece52482ea 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-property-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-property-call.expect.md @@ -15,6 +15,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(11); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md index 15c6128ebb..a3646f5d06 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md @@ -19,7 +19,7 @@ function Component(props) { ## Code ```javascript -// arrayInstance.push should have the following effects: +import * as React from "react"; // arrayInstance.push should have the following effects: // - read on all args (rest parameter) // - mutate on receiver function Component(props) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md index db8b34f1db..cfe56893e1 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md @@ -12,7 +12,8 @@ export default ErrorView; ## Code ```javascript -import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; // @gating +import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; +import * as React from "react"; // @gating function ErrorView_uncompiled(error, _retry) { return ; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md index d821dc3936..c27f69a275 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md @@ -15,6 +15,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md index ecf98361aa..01d8fd07f7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md @@ -14,6 +14,7 @@ function g(props) { ## Code ```javascript +import * as React from "react"; function g(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.c; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/assignment-in-nested-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/assignment-in-nested-if.expect.md index c7704f193d..a5955d7012 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/assignment-in-nested-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/assignment-in-nested-if.expect.md @@ -19,6 +19,7 @@ function useBar(props) { ## Code ```javascript +import * as React from "react"; function useBar(props) { const $ = React.unstable_useMemoCache(1); let z; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue-array.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue-array.expect.md index fd20e1d99c..ddf314aa26 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue-array.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue-array.expect.md @@ -14,6 +14,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(2); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue.expect.md index 7b9d0b57cd..f0676a5f86 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue.expect.md @@ -14,6 +14,7 @@ function g() { ## Code ```javascript +import * as React from "react"; function g() { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md index aabe9a208a..5494fe7fb4 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md @@ -13,6 +13,7 @@ async function Component(props) { ## Code ```javascript +import * as React from "react"; async function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.id; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/await.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/await.expect.md index f1b76412e7..5e8b27e59d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/await.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/await.expect.md @@ -12,6 +12,7 @@ async function Component(props) { ## Code ```javascript +import * as React from "react"; async function Component(props) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== props.id; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md new file mode 100644 index 0000000000..93cd603e8a --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md @@ -0,0 +1,75 @@ + +## Input + +```javascript +import * as React from "react"; +import { useMemo } from "react"; + +function Component(props) { + const [x] = React.useState(0); + const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]); + + return
{expensiveNumber}
; +} + +function Component2(props) { + const [x] = React.useState(0); + const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]); + + return
{expensiveNumber}
; +} + +``` + +## Code + +```javascript +import * as React from "react"; +import { useMemo } from "react"; + +function Component(props) { + const $ = React.unstable_useMemoCache(2); + let t0; + if ($[0] === Symbol.for("react.memo_cache_sentinel")) { + const [x] = React.useState(0); + t0 = calculateExpensiveNumber(x); + $[0] = t0; + } else { + t0 = $[0]; + } + const t17 = t0; + const expensiveNumber = t17; + let t1; + if ($[1] === Symbol.for("react.memo_cache_sentinel")) { + t1 =
{expensiveNumber}
; + $[1] = t1; + } else { + t1 = $[1]; + } + return t1; +} + +function Component2(props) { + const $ = React.unstable_useMemoCache(2); + let t0; + if ($[0] === Symbol.for("react.memo_cache_sentinel")) { + const [x] = React.useState(0); + t0 = calculateExpensiveNumber(x); + $[0] = t0; + } else { + t0 = $[0]; + } + const t17 = t0; + const expensiveNumber = t17; + let t1; + if ($[1] === Symbol.for("react.memo_cache_sentinel")) { + t1 =
{expensiveNumber}
; + $[1] = t1; + } else { + t1 = $[1]; + } + return t1; +} + +``` + \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.js b/compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.js new file mode 100644 index 0000000000..d177f8677f --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.js @@ -0,0 +1,16 @@ +import * as React from "react"; +import { useMemo } from "react"; + +function Component(props) { + const [x] = React.useState(0); + const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]); + + return
{expensiveNumber}
; +} + +function Component2(props) { + const [x] = React.useState(0); + const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]); + + return
{expensiveNumber}
; +} diff --git a/compiler/forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md index 6a0ab084e3..a9c414f2e8 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md @@ -13,6 +13,7 @@ function component(t) { ## Code ```javascript +import * as React from "react"; function component(t) { const $ = React.unstable_useMemoCache(2); const { a } = t; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/call-args-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/call-args-assignment.expect.md index 7c9fcbbad9..7d01e692a6 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/call-args-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/call-args-assignment.expect.md @@ -13,6 +13,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/call-args-destructuring-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/call-args-destructuring-assignment.expect.md index 3a7948ba5f..d00a0a0514 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/call-args-destructuring-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/call-args-destructuring-assignment.expect.md @@ -13,6 +13,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/call-spread.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/call-spread.expect.md index 4a7ee944d3..735ac5a295 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/call-spread.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/call-spread.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md index 57e76125a0..d89109a8cd 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/call.expect.md index a9b890a5a4..6753b86351 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/call.expect.md @@ -18,6 +18,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function foo() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capture-func-passed-to-jsx.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capture-func-passed-to-jsx.expect.md index 7d1ac8cade..9035692176 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capture-func-passed-to-jsx.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capture-func-passed-to-jsx.expect.md @@ -19,6 +19,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(9); const c_0 = $[0] !== b; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md index eea27b671c..f46388bcd4 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md @@ -19,6 +19,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md index e953b6fe2d..93a1b90fd0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md @@ -45,6 +45,7 @@ function getNativeLogFunction(level) { ## Code ```javascript +import * as React from "react"; function getNativeLogFunction(level) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== level; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md index 9a96663ded..d7cbe62d97 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md @@ -17,6 +17,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md index ff7f152d3e..c017d0033b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md @@ -15,6 +15,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md index 3567ab374e..9cd0fcb450 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md @@ -19,6 +19,7 @@ function component(foo, bar) { ## Code ```javascript +import * as React from "react"; function component(foo, bar) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md index 0ea345d456..705d280573 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md @@ -19,6 +19,7 @@ function component(foo, bar) { ## Code ```javascript +import * as React from "react"; function component(foo, bar) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md index b812a4d7e9..f521060a94 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md @@ -19,6 +19,7 @@ function component(foo, bar) { ## Code ```javascript +import * as React from "react"; function component(foo, bar) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md index 25265512ff..5cbe2af0f8 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md @@ -19,6 +19,7 @@ function component(foo, bar) { ## Code ```javascript +import * as React from "react"; function component(foo, bar) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md index 719852c856..6d535b8045 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md @@ -17,6 +17,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md index 9cbb684d4d..d0e5f11f15 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md @@ -17,6 +17,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md index 3bd06433c5..9d50010d65 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md @@ -18,6 +18,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md index 51d77c8f9b..46ce0f94c5 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md @@ -18,6 +18,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md index ba71fb8c5d..ac5556ab06 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md @@ -18,6 +18,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== b; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md index 845cf45022..c0cc63cd9b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md @@ -17,6 +17,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== b; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md index 8172b173ae..59898a86e9 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md @@ -16,6 +16,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md index 79308c81bf..f65830e8ef 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md @@ -18,6 +18,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md index 74f1151869..318a5a0b2e 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md @@ -17,6 +17,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md index 520aa9e334..886259ef99 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md @@ -15,6 +15,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md index 60be692813..9c3b4932e5 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md @@ -17,6 +17,7 @@ function bar(a) { ## Code ```javascript +import * as React from "react"; function bar(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md index 95dc2829d5..1563181d54 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md @@ -19,6 +19,7 @@ function bar(a, b) { ## Code ```javascript +import * as React from "react"; function bar(a, b) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md index bb860b98ca..e2ee3ad7b6 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md @@ -17,6 +17,7 @@ function bar(a) { ## Code ```javascript +import * as React from "react"; function bar(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md index 1c8780a0de..6a1858a080 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md @@ -17,6 +17,7 @@ function bar(a) { ## Code ```javascript +import * as React from "react"; function bar(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md index 8ba08649b5..51236d247c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md @@ -22,6 +22,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md index 9e2265fcce..2e3647d3aa 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md @@ -18,6 +18,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md index b56e2c01e3..14c90c8de3 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md @@ -16,6 +16,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md index a9060d21ee..7d190f7e11 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md @@ -18,6 +18,7 @@ function Foo(props) { ## Code ```javascript +import * as React from "react"; function Foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.router.location; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md index 183ad33557..d9ae831f0b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md @@ -19,6 +19,7 @@ function component({ mutator }) { ## Code ```javascript +import * as React from "react"; function component(t27) { const $ = React.unstable_useMemoCache(7); const { mutator } = t27; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md index 41a0241da9..4c1f44fc65 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md @@ -18,6 +18,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md index 02579f109e..b9599cac3d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md @@ -13,6 +13,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-shadow-captured.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-shadow-captured.expect.md index 56dda6c008..58511fa70b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-shadow-captured.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-shadow-captured.expect.md @@ -16,6 +16,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md index a1581e590c..2bfda3e422 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md @@ -12,6 +12,7 @@ function StoreLandingUnseenGiftModalContainer(a) { ## Code ```javascript +import * as React from "react"; function StoreLandingUnseenGiftModalContainer(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md index 778962238c..2c02fa7af3 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md @@ -18,6 +18,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md index 33bd7f09d3..8ac3d89070 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md @@ -15,6 +15,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md index bd82e67566..67d968814f 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md @@ -15,6 +15,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md index 72f6390e32..01179a0db8 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md @@ -17,6 +17,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md index 0f69bd2873..3e633e3d56 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md @@ -15,6 +15,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md index f67a1e32ef..dec6f542ee 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md @@ -17,6 +17,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md index 311ed47fad..a3fda1daa7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md @@ -17,6 +17,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/chained-assignment-expressions.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/chained-assignment-expressions.expect.md index 9bfa7c8b4f..d70f7879b3 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/chained-assignment-expressions.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/chained-assignment-expressions.expect.md @@ -16,6 +16,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); let z; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/component.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/component.expect.md index 4ca1f899fe..82e6d7af59 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/component.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/component.expect.md @@ -34,6 +34,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(8); const items = props.items; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md index 6507397cac..3253e6b056 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== props.method; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md index 12aa0694f9..31bfa64798 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const a = foo(); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md index a646741632..e154b81a29 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md @@ -15,6 +15,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md index 82a51fb6b0..5edd392921 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md @@ -13,6 +13,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(4); const [x, setX] = useState(0); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md index 970bf36fa4..71ee7e6890 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md @@ -17,7 +17,7 @@ function Component(props) { ## Code ```javascript -// To preserve the nullthrows behavior and reactive deps of this code, +import * as React from "react"; // To preserve the nullthrows behavior and reactive deps of this code, // Forget needs to add `props.a` as a dependency (since `props.a.b` is // a conditional dependency, i.e. gated behind control flow) diff --git a/compiler/forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md index d1122366eb..8e24d100c5 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md @@ -23,6 +23,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; /** * props.b *does* influence `a` */ diff --git a/compiler/forget/src/__tests__/fixtures/compiler/conditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/conditional-break.expect.md index dd7187221c..7ca2c4dda0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/conditional-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/conditional-break.expect.md @@ -61,6 +61,7 @@ function ComponentD(props) { ## Code ```javascript +import * as React from "react"; /** * props.b does *not* influence `a` */ diff --git a/compiler/forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md index 22d4ab32c5..bb048d86bf 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md @@ -34,6 +34,7 @@ function mayMutate() {} ## Code ```javascript +import * as React from "react"; function ComponentA(props) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/constant-computed.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/constant-computed.expect.md index 3ab3c2f61e..2e6402abf8 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/constant-computed.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/constant-computed.expect.md @@ -15,6 +15,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/constructor.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/constructor.expect.md index 1a15c92cb0..b4d74e5871 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/constructor.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/constructor.expect.md @@ -18,6 +18,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Foo() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/controlled-input.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/controlled-input.expect.md index cf714af29b..ca5596a767 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/controlled-input.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/controlled-input.expect.md @@ -13,6 +13,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(5); const [x, setX] = useState(0); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md index 19624226aa..750f670d43 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/delete-property.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/delete-property.expect.md index 9a02c751fe..e42e0a2ea6 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/delete-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/delete-property.expect.md @@ -13,6 +13,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md index f6ab76624c..d7f30200b0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md @@ -22,6 +22,7 @@ function foo(a, b) { ## Code ```javascript +import * as React from "react"; function foo(a, b) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/dependencies.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/dependencies.expect.md index fc6060193a..6ad952df97 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/dependencies.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/dependencies.expect.md @@ -23,6 +23,7 @@ function foo(x, y, z) { ## Code ```javascript +import * as React from "react"; function foo(x, y, z) { const $ = React.unstable_useMemoCache(3); const items = [z]; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md index 6d1fd6c295..502f862674 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md @@ -13,6 +13,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; let someGlobal = {}; function component(a) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md index 35d3dd2185..b3ac9c22e7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const [t0] = props.y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md index f6e7f6f8bd..05f3d05c85 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); let x = undefined; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md index fd4102c399..a51ed1a139 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md @@ -26,6 +26,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(5); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md index d5c533958a..6cf9c2eaab 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const { x: t0 } = props.y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/destructuring.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/destructuring.expect.md index 5b9f003f50..e5e8f46d44 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/destructuring.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/destructuring.expect.md @@ -27,6 +27,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(18); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md index 109b58a107..ed170bd12c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md index 33d9099030..9a30e4b579 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md @@ -18,6 +18,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/do-while-continue.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/do-while-continue.expect.md index 1584a36a0c..a50fbd678e 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/do-while-continue.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/do-while-continue.expect.md @@ -21,6 +21,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let ret; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/do-while-early-unconditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/do-while-early-unconditional-break.expect.md index bd02429583..a6aa7484ff 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/do-while-early-unconditional-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/do-while-early-unconditional-break.expect.md @@ -16,6 +16,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/do-while-simple.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/do-while-simple.expect.md index ae8022e626..fb170983c6 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/do-while-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/do-while-simple.expect.md @@ -17,6 +17,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let ret; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md index 955cf03386..b0356b54b4 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md @@ -15,6 +15,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md index 8ed5b42f64..37739c7713 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md @@ -19,6 +19,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(9); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md index cb67370a9b..ebb585cacd 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md @@ -16,6 +16,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(10); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md index 808e8bd7c5..9091012fa0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md @@ -23,6 +23,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md index d274bc3ac7..f9ea49ba9b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md @@ -32,6 +32,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md index 7b5a9c1f24..6f1b6a58b7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md @@ -25,6 +25,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md index 7ed39f1db9..9152dc9414 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md @@ -22,6 +22,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md index 52806f22e7..9b93f378d4 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; import fbt from "fbt"; function Component(props) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/fbt-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/fbt-call.expect.md index 4c103b38dd..f95ffb176e 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/fbt-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/fbt-call.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; import fbt from "fbt"; function Component(props) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md index 19185368ec..d5e9f09586 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; import fbt from "fbt"; function Component(props) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/fbt-params.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/fbt-params.expect.md index 3b0ec7e696..730880cf05 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/fbt-params.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/fbt-params.expect.md @@ -17,6 +17,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; import fbt from "fbt"; function Component(props) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/for-of-break.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/for-of-break.expect.md index c36b7d7f18..3ad0d1aa70 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/for-of-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/for-of-break.expect.md @@ -15,6 +15,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/for-of-conditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/for-of-conditional-break.expect.md index a015c656a0..f088ecc258 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/for-of-conditional-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/for-of-conditional-break.expect.md @@ -18,6 +18,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(2); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/for-of-continue.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/for-of-continue.expect.md index f89fa0eced..879d38c582 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/for-of-continue.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/for-of-continue.expect.md @@ -19,6 +19,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(2); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/for-of-destructure.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/for-of-destructure.expect.md index d42886a290..fac92414f0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/for-of-destructure.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/for-of-destructure.expect.md @@ -16,6 +16,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md index 205a02af1e..31461555a7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md @@ -16,6 +16,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); let results; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/for-of-simple.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/for-of-simple.expect.md index 2b200c3d71..a6e68f753f 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/for-of-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/for-of-simple.expect.md @@ -16,6 +16,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/frozen-after-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/frozen-after-alias.expect.md index 85c36263b1..cc6845fcec 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/frozen-after-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/frozen-after-alias.expect.md @@ -18,6 +18,7 @@ function foo(x) {} ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-reassign.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-reassign.expect.md index 5ece9e9958..499cf8d208 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-reassign.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-reassign.expect.md @@ -15,6 +15,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-redeclare.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-redeclare.expect.md index 79b7c04ca9..7dbf83bfe7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-redeclare.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-redeclare.expect.md @@ -15,6 +15,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md index a91bf0e61e..e8f13f257d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md @@ -16,6 +16,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md index 733827f403..bc07c95699 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md @@ -11,6 +11,7 @@ function Component(x = "default", y = [{}]) { ## Code ```javascript +import * as React from "react"; function Component(t24, t0) { const $ = React.unstable_useMemoCache(5); const x = t24 === undefined ? "default" : t24; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md index 3d26ae50f6..517ee00188 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md @@ -22,7 +22,8 @@ function Foo(props) { ## Code ```javascript -import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; // @gating @forgetDirective +import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; +import * as React from "react"; // @gating @forgetDirective function Bar_uncompiled(props) { "use forget"; return
{props.bar}
; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md index ec14689124..0973812619 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md @@ -22,7 +22,8 @@ export function Foo(props) { ## Code ```javascript -import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; // @gating @forgetDirective +import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; +import * as React from "react"; // @gating @forgetDirective function Bar_uncompiled(props) { "use forget"; return
{props.bar}
; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md index b83122f382..5e01f917e6 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md @@ -22,7 +22,8 @@ export function Foo(props) { ## Code ```javascript -import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; // @gating @forgetDirective +import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; +import * as React from "react"; // @gating @forgetDirective function Bar_uncompiled(props) { "use forget"; return
{props.bar}
; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/gating-test.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/gating-test.expect.md index e19ade1224..9bed203aa1 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/gating-test.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/gating-test.expect.md @@ -22,7 +22,8 @@ function Foo(props) { ## Code ```javascript -import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; // @gating @forgetDirective +import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; +import * as React from "react"; // @gating @forgetDirective function Bar_uncompiled(props) { "use forget"; return
{props.bar}
; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/hook-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/hook-call.expect.md index 2369b45120..2e3be7662e 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/hook-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/hook-call.expect.md @@ -22,6 +22,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function useFreeze() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-arguments.expect.md index 20c382a04e..885950e679 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-arguments.expect.md @@ -18,6 +18,7 @@ function call(x) {} ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-possibly-mutable-arguments.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-possibly-mutable-arguments.expect.md index a77cbe078e..e884906781 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-possibly-mutable-arguments.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-possibly-mutable-arguments.expect.md @@ -25,6 +25,7 @@ function call(x) {} ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(1); const cond = props.cond; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md index 64be9e6ec9..493ca50b49 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md @@ -21,6 +21,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(4); const [value, setValue] = useState(null); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md index c2cb756143..119c630446 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md @@ -36,6 +36,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function compute() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/independent.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/independent.expect.md index 5c7599e74b..c2d3c3375c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/independent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/independent.expect.md @@ -27,6 +27,7 @@ function Foo() {} ## Code ```javascript +import * as React from "react"; /** * Should produce 3 scopes: * diff --git a/compiler/forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md index 2f8442f41f..fba0659181 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md @@ -15,6 +15,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md index e8d7d99476..f06d8d77e3 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md @@ -21,7 +21,7 @@ function Component(props) { ## Code ```javascript -// Check that we correctly resolve type and effect lookups on the javascript +import * as React from "react"; // Check that we correctly resolve type and effect lookups on the javascript // global object. function Component(props) { const $ = React.unstable_useMemoCache(7); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md index 260436234b..d6eb9dea52 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md @@ -30,6 +30,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function compute() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/interdependent.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/interdependent.expect.md index 7f1e15f2ac..3c49a5d13a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/interdependent.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/interdependent.expect.md @@ -27,6 +27,7 @@ function Foo() {} ## Code ```javascript +import * as React from "react"; /** * Should produce 1 scope: * diff --git a/compiler/forget/src/__tests__/fixtures/compiler/inverted-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/inverted-if.expect.md index 3d9a33f887..4bd8da96f3 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/inverted-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/inverted-if.expect.md @@ -19,6 +19,7 @@ function foo(a, b, c, d) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c, d) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/issue933-disjoint-set-infinite-loop.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/issue933-disjoint-set-infinite-loop.expect.md index 6003678543..bbd5541b4e 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/issue933-disjoint-set-infinite-loop.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/issue933-disjoint-set-infinite-loop.expect.md @@ -16,7 +16,7 @@ function MyApp(props) { ## Code ```javascript -// This caused an infinite loop in the compiler +import * as React from "react"; // This caused an infinite loop in the compiler function MyApp(props) { const $ = React.unstable_useMemoCache(1); let y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md index 69fcea893c..4d38204522 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md @@ -16,6 +16,7 @@ export function Component(props) { ## Code ```javascript +import * as React from "react"; export function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md index 09b15eefae..074be553d2 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md @@ -18,6 +18,7 @@ function Foo(props) { ## Code ```javascript +import * as React from "react"; function Foo(props) { const $ = React.unstable_useMemoCache(4); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/jsx-member-expression.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/jsx-member-expression.expect.md index 215cf59dd1..9da02cb91f 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/jsx-member-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/jsx-member-expression.expect.md @@ -15,6 +15,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md index 3ae8bb889f..5a41b1481f 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md @@ -11,6 +11,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.version; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md index ae56eb3673..933217b9be 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md @@ -13,6 +13,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(5); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md index 2da3195a8b..2a30363728 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md @@ -26,7 +26,7 @@ function CaptureNotMutate(props) { ## Code ```javascript -// Here, element should not be memoized independently of aliasedElement, since +import * as React from "react"; // Here, element should not be memoized independently of aliasedElement, since // it is captured by fn. // AnalyzeFunctions currently does not find captured objects. // - mutated context refs are declared as `Capture` effect in `FunctionExpression.deps` diff --git a/compiler/forget/src/__tests__/fixtures/compiler/lambda-mutate-shadowed-object.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/lambda-mutate-shadowed-object.expect.md index 402749fe4e..adfd9c71ac 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/lambda-mutate-shadowed-object.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/lambda-mutate-shadowed-object.expect.md @@ -19,6 +19,7 @@ function Component() { ## Code ```javascript +import * as React from "react"; function Component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md index f0f7daea29..d3d55a2fcf 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md @@ -18,6 +18,7 @@ function component(props) { ## Code ```javascript +import * as React from "react"; function component(props) { const $ = React.unstable_useMemoCache(3); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/method-call-computed.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/method-call-computed.expect.md index 1350a34241..2f975e6f34 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/method-call-computed.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/method-call-computed.expect.md @@ -21,6 +21,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(8); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md index 110ced0ca0..1b35ebc16c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md @@ -18,6 +18,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/method-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/method-call.expect.md index ea898b3969..09363f2563 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/method-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/method-call.expect.md @@ -17,6 +17,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-export-gating-test.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-export-gating-test.expect.md index b8ce196950..129b37fa79 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-export-gating-test.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-export-gating-test.expect.md @@ -17,7 +17,8 @@ export const Renderer = (props) => ( ## Code ```javascript -import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; // @gating +import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; +import * as React from "react"; // @gating function ErrorView_uncompiled(error, _retry) { return ; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-gating-test.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-gating-test.expect.md index 96fd2f8a77..e312f2795b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-gating-test.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-gating-test.expect.md @@ -19,7 +19,8 @@ export default Renderer; ## Code ```javascript -import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; // @gating +import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag"; +import * as React from "react"; // @gating function ErrorView_uncompiled(error, _retry) { return ; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/nested-function-shadowed-identifiers.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/nested-function-shadowed-identifiers.expect.md index d817bb902c..3806f1d525 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/nested-function-shadowed-identifiers.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/nested-function-shadowed-identifiers.expect.md @@ -18,6 +18,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(5); const [x, setX] = useState(null); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/nested-optional-member-expr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/nested-optional-member-expr.expect.md index f7405a2052..7ca8997d51 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/nested-optional-member-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/nested-optional-member-expr.expect.md @@ -14,7 +14,7 @@ function Component(props) { ## Code ```javascript -// We should codegen nested optional properties correctly +import * as React from "react"; // We should codegen nested optional properties correctly // (i.e. placing `?` in the correct PropertyLoad) function Component(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/new-spread.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/new-spread.expect.md index 784e5a599c..c2e8422ec1 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/new-spread.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/new-spread.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== props.bar; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-cached-in-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-cached-in-if-else.expect.md index 23c7890ccb..7ead133179 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-cached-in-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-cached-in-if-else.expect.md @@ -18,6 +18,7 @@ function foo(a, b, c, d) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c, d) { const $ = React.unstable_useMemoCache(4); let x = undefined; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-mutated-after-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-mutated-after-if-else.expect.md index 587cc7786e..7613cf74eb 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-mutated-after-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/obj-literal-mutated-after-if-else.expect.md @@ -19,6 +19,7 @@ function foo(a, b, c, d) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c, d) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== b; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else-with-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else-with-alias.expect.md index 62629f6837..678d09baea 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else-with-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else-with-alias.expect.md @@ -21,6 +21,7 @@ function foo(a, b, c, d) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c, d) { const $ = React.unstable_useMemoCache(2); someObj(); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else.expect.md index 11902a16b4..fa3f8336c6 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else.expect.md @@ -19,6 +19,7 @@ function foo(a, b, c, d) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c, d) { const $ = React.unstable_useMemoCache(2); someObj(); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-nested-if-else-with-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-nested-if-else-with-alias.expect.md index 76cf26b7e6..180c7ec1a7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-nested-if-else-with-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-nested-if-else-with-alias.expect.md @@ -27,6 +27,7 @@ function foo(a, b, c, d) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c, d) { const $ = React.unstable_useMemoCache(3); someObj(); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/object-expression-string-literal-key.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/object-expression-string-literal-key.expect.md index 2cdc211ac5..3c960165ac 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/object-expression-string-literal-key.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/object-expression-string-literal-key.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/object-literal-spread-element.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/object-literal-spread-element.expect.md index fa0dbf5cb6..d86f47801b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/object-literal-spread-element.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/object-literal-spread-element.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.foo; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md index 16879d7c25..460abcdfbb 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md @@ -13,6 +13,7 @@ function component({ a, b }) { ## Code ```javascript +import * as React from "react"; function component(t17) { const $ = React.unstable_useMemoCache(7); const { a, b } = t17; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md index 97b1de17f5..dd2a906415 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md @@ -21,6 +21,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/optional-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/optional-call.expect.md index 3c30aeb83d..9dc9b8ae64 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/optional-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/optional-call.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/optional-member-expression-chain.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/optional-member-expression-chain.expect.md index 5d0661286c..b258ca1fc2 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/optional-member-expression-chain.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/optional-member-expression-chain.expect.md @@ -15,7 +15,7 @@ function Component(props) { ## Code ```javascript -// Note that `a?.b.c` is semantically different from `(a?.b).c` +import * as React from "react"; // Note that `a?.b.c` is semantically different from `(a?.b).c` // We should codegen the correct member expressions function Component(props) { const $ = React.unstable_useMemoCache(3); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/optional-method-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/optional-method-call.expect.md index 7b0c0ec820..2e17827187 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/optional-method-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/optional-method-call.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-method-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-method-call.expect.md index 942abb774e..89687e7588 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-method-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-method-call.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-optional-method.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-optional-method.expect.md index bca8669825..28f4e08c9c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-optional-method.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-optional-method.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-shadowing-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-shadowing-within-block.expect.md index d24c7ef2f9..01eee05f54 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-shadowing-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-shadowing-within-block.expect.md @@ -20,6 +20,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(9); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-within-block.expect.md index 0618885d00..761862be81 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-within-block.expect.md @@ -20,6 +20,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep-nested-scope.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep-nested-scope.expect.md index 924b8fa2af..2f57607737 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep-nested-scope.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep-nested-scope.expect.md @@ -20,7 +20,7 @@ function PrimitiveAsDepNested(props) { ## Code ```javascript -// props.b + 1 is an non-allocating expression, which means Forget can +import * as React from "react"; // props.b + 1 is an non-allocating expression, which means Forget can // emit it trivially and repeatedly (e.g. no need to memoize props.b + 1 // separately from props.b) // Correctness: diff --git a/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep.expect.md index 43cfdd5627..ded08e9750 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep.expect.md @@ -17,7 +17,7 @@ function PrimitiveAsDep(props) { ## Code ```javascript -// props.b + 1 is an non-allocating expression, which means Forget can +import * as React from "react"; // props.b + 1 is an non-allocating expression, which means Forget can // emit it trivially and repeatedly (e.g. no need to memoize props.b + 1 // separately from props.b) // Correctness: diff --git a/compiler/forget/src/__tests__/fixtures/compiler/prop-capturing-function-1.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/prop-capturing-function-1.expect.md index 276d9685c0..1688d69f4b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/prop-capturing-function-1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/prop-capturing-function-1.expect.md @@ -15,6 +15,7 @@ function component(a, b) { ## Code ```javascript +import * as React from "react"; function component(a, b) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/property-assignment.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/property-assignment.expect.md index f3974a2922..217d0d1e41 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/property-assignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/property-assignment.expect.md @@ -16,6 +16,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== props.p0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/property-call-spread.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/property-call-spread.expect.md index 34bac6fc07..7f7b201706 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/property-call-spread.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/property-call-spread.expect.md @@ -12,6 +12,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reactive-scope-grouping.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reactive-scope-grouping.expect.md index 136c5a00ff..1e7f65abce 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reactive-scope-grouping.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reactive-scope-grouping.expect.md @@ -17,6 +17,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(3); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes-if.expect.md index 3faf4cc51f..a9ce7259f0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes-if.expect.md @@ -19,6 +19,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(8); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes.expect.md index 006beeecae..3cda673f77 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes.expect.md @@ -18,6 +18,7 @@ function f(a, b) { ## Code ```javascript +import * as React from "react"; function f(a, b) { const $ = React.unstable_useMemoCache(5); const c_0 = $[0] !== a.length; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md index 811cd06afd..f1fb7621f9 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md @@ -27,6 +27,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== props.b; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md index f8cfd4a8d1..981553341e 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md @@ -16,6 +16,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(8); const c_0 = $[0] !== props.key; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md index 894071509d..9ca41ccdf4 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md @@ -16,6 +16,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(7); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md index a2d86d537a..d1af434ae2 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md @@ -21,6 +21,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(9); const c_0 = $[0] !== props.p0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md index 79d36dd99e..f62558fe3a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md @@ -33,6 +33,7 @@ function foo(a, b, c) { ## Code ```javascript +import * as React from "react"; function foo(a, b, c) { const $ = React.unstable_useMemoCache(11); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reassignment.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reassignment.expect.md index cfd6e3b074..29c6c6cece 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reassignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reassignment.expect.md @@ -20,6 +20,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(8); const c_0 = $[0] !== props.p0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-condexpr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-condexpr.expect.md index ec3b77d77a..3e1e41e1db 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-condexpr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-condexpr.expect.md @@ -16,7 +16,7 @@ function TestCondDepInConditionalExpr(props, other) { ## Code ```javascript -// props.a.b should be added as a unconditional dependency to the reactive +import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive // scope that produces x, since it is accessed unconditionally in all cfg // paths diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-ifelse.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-ifelse.expect.md index 53db1825ea..fab38ac206 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-ifelse.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-ifelse.expect.md @@ -21,7 +21,7 @@ function TestCondDepInDirectIfElse(props, other) { ## Code ```javascript -// props.a.b should be added as a unconditional dependency to the reactive +import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive // scope that produces x, since it is accessed unconditionally in all cfg // paths diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse-missing.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse-missing.expect.md index fcaafdcadd..323908a5e5 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse-missing.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse-missing.expect.md @@ -22,7 +22,7 @@ function TestCondDepInNestedIfElse(props, other) { ## Code ```javascript -// props.a.b should NOT be added as a unconditional dependency to the reactive +import * as React from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive // scope that produces x if it is not accessed in every path function TestCondDepInNestedIfElse(props, other) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse.expect.md index 2cb8a10eae..c9df7941b2 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse.expect.md @@ -27,7 +27,7 @@ function TestCondDepInNestedIfElse(props, other) { ## Code ```javascript -// props.a.b should be added as a unconditional dependency to the reactive +import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive // scope that produces x, since it is accessed unconditionally in all cfg // paths diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-case.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-case.expect.md index 032817f562..8aef4e4809 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-case.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-case.expect.md @@ -26,7 +26,7 @@ function TestCondDepInSwitchMissingCase(props, other) { ## Code ```javascript -// props.a.b should NOT be added as a unconditional dependency to the reactive +import * as React from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive // scope that produces x if it is not accessed in every path function TestCondDepInSwitchMissingCase(props, other) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-default.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-default.expect.md index 7c854282cb..634628bf27 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-default.expect.md @@ -23,7 +23,7 @@ function TestCondDepInSwitchMissingDefault(props, other) { ## Code ```javascript -// props.a.b should NOT be added as a unconditional dependency to the reactive +import * as React from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive // scope that produces x if it is not accessed in the default case. function TestCondDepInSwitchMissingDefault(props, other) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch.expect.md index 8ad41ad70e..04d5bf0a4a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch.expect.md @@ -26,7 +26,7 @@ function TestCondDepInSwitch(props, other) { ## Code ```javascript -// props.a.b should be added as a unconditional dependency to the reactive +import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive // scope that produces x, since it is accessed unconditionally in all cfg // paths diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-no-uncond.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-no-uncond.expect.md index 933fc1eac1..a38bfc48a5 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-no-uncond.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-no-uncond.expect.md @@ -18,7 +18,7 @@ function TestOnlyConditionalDependencies(props, other) { ## Code ```javascript -// When an object's properties are only read conditionally, we should +import * as React from "react"; // When an object's properties are only read conditionally, we should // track the base object as a dependency. function TestOnlyConditionalDependencies(props, other) { const $ = React.unstable_useMemoCache(3); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-promote-uncond.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-promote-uncond.expect.md index 98235bb24e..d39ae74790 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-promote-uncond.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-promote-uncond.expect.md @@ -19,7 +19,7 @@ function TestPromoteUnconditionalAccessToDependency(props, other) { ## Code ```javascript -// When a conditional dependency `props.a.b.c` has no unconditional dependency +import * as React from "react"; // When a conditional dependency `props.a.b.c` has no unconditional dependency // in its subpath or superpath, we should find the nearest unconditional access // and promote it to an unconditional dependency. function TestPromoteUnconditionalAccessToDependency(props, other) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order1.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order1.expect.md index b766b54e6c..b2b66aa18a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order1.expect.md @@ -21,7 +21,7 @@ function TestConditionalSubpath1(props, other) { ## Code ```javascript -// When a conditional dependency `props.a` is a subpath of an unconditional +import * as React from "react"; // When a conditional dependency `props.a` is a subpath of an unconditional // dependency `props.a.b`, we can access `props.a` while preserving program // semantics (with respect to nullthrows). // deps: {`props.a`, `props.a.b`} can further reduce to just `props.a` diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order2.expect.md index ee2e44ddd5..2cd8089bd9 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order2.expect.md @@ -21,7 +21,7 @@ function TestConditionalSubpath2(props, other) { ## Code ```javascript -// When a conditional dependency `props.a` is a subpath of an unconditional +import * as React from "react"; // When a conditional dependency `props.a` is a subpath of an unconditional // dependency `props.a.b`, we can access `props.a` while preserving program // semantics (with respect to nullthrows). // deps: {`props.a`, `props.a.b`} can further reduce to just `props.a` diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order1.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order1.expect.md index 0acc4dc3f1..3405d9edec 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order1.expect.md @@ -20,7 +20,7 @@ function TestConditionalSuperpath1(props, other) { ## Code ```javascript -// When an unconditional dependency `props.a` is the subpath of a conditional +import * as React from "react"; // When an unconditional dependency `props.a` is the subpath of a conditional // dependency `props.a.b`, we can safely overestimate and only track `props.a` // as a dependency // ordering of accesses should not matter diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order2.expect.md index b412156d50..07a604365d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order2.expect.md @@ -20,7 +20,7 @@ function TestConditionalSuperpath2(props, other) { ## Code ```javascript -// When an unconditional dependency `props.a` is the subpath of a conditional +import * as React from "react"; // When an unconditional dependency `props.a` is the subpath of a conditional // dependency `props.a.b`, we can safely overestimate and only track `props.a` // as a dependency // ordering of accesses should not matter diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-memberexpr-join.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-memberexpr-join.expect.md index 614b7a4d24..534a58f34a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-memberexpr-join.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-memberexpr-join.expect.md @@ -25,7 +25,7 @@ function Component(props) { ## Code ```javascript -// To preserve the nullthrows behavior and reactive deps of this code, +import * as React from "react"; // To preserve the nullthrows behavior and reactive deps of this code, // Forget needs to add `props.a.b` or a subpath as a dependency. // // (1) Since the reactive block producing x unconditionally read props.a.<...>, diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-cond-scope.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-cond-scope.expect.md index bbeca80f3a..31dadfc484 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-cond-scope.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-cond-scope.expect.md @@ -34,7 +34,7 @@ function TestReactiveDepsInCondScope(props) { ## Code ```javascript -// Some reactive scopes are created within a conditional. If a child scope +import * as React from "react"; // Some reactive scopes are created within a conditional. If a child scope // is within a conditional, its reactive dependencies should be propagated // as conditionals // diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-join-uncond-scopes-cond-deps.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-join-uncond-scopes-cond-deps.expect.md index 0c1f931056..3a294d07f0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-join-uncond-scopes-cond-deps.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-join-uncond-scopes-cond-deps.expect.md @@ -34,7 +34,7 @@ function TestJoinCondDepsInUncondScopes(props) { ## Code ```javascript -// This tests an optimization, NOT a correctness property. +import * as React from "react"; // This tests an optimization, NOT a correctness property. // When propagating reactive dependencies of an inner scope up to its parent, // we prefer to retain granularity. // diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-descendant.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-descendant.expect.md index 41b702bb21..c29d39b663 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-descendant.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-descendant.expect.md @@ -17,7 +17,7 @@ function TestNonOverlappingDescendantTracked(props) { ## Code ```javascript -// Test that we can track non-overlapping dependencies separately. +import * as React from "react"; // Test that we can track non-overlapping dependencies separately. // (not needed for correctness but for dependency granularity) function TestNonOverlappingDescendantTracked(props) { const $ = React.unstable_useMemoCache(4); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-direct.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-direct.expect.md index 0336312c4a..7763fcf6bc 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-direct.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-direct.expect.md @@ -16,7 +16,7 @@ function TestNonOverlappingTracked(props) { ## Code ```javascript -// Test that we can track non-overlapping dependencies separately. +import * as React from "react"; // Test that we can track non-overlapping dependencies separately. // (not needed for correctness but for dependency granularity) function TestNonOverlappingTracked(props) { const $ = React.unstable_useMemoCache(3); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-descendant.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-descendant.expect.md index 75cb92c532..0bfbb52eac 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-descendant.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-descendant.expect.md @@ -17,7 +17,7 @@ function TestOverlappingDescendantTracked(props) { ## Code ```javascript -// Test that we correctly track a subpath if the subpath itself is accessed as +import * as React from "react"; // Test that we correctly track a subpath if the subpath itself is accessed as // a dependency function TestOverlappingDescendantTracked(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-direct.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-direct.expect.md index 84da7c119e..8b6f408ffb 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-direct.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-direct.expect.md @@ -17,7 +17,7 @@ function TestOverlappingTracked(props) { ## Code ```javascript -// Test that we correctly track a subpath if the subpath itself is accessed as +import * as React from "react"; // Test that we correctly track a subpath if the subpath itself is accessed as // a dependency function TestOverlappingTracked(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order1.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order1.expect.md index 964fe4f067..9c12bfc203 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order1.expect.md @@ -17,7 +17,7 @@ function TestDepsSubpathOrder1(props) { ## Code ```javascript -// Determine that we only need to track p.a here +import * as React from "react"; // Determine that we only need to track p.a here // Ordering of access should not matter function TestDepsSubpathOrder1(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order2.expect.md index ec0e124308..e04e585cfb 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order2.expect.md @@ -17,7 +17,7 @@ function TestDepsSubpathOrder2(props) { ## Code ```javascript -// Determine that we only need to track p.a here +import * as React from "react"; // Determine that we only need to track p.a here // Ordering of access should not matter function TestDepsSubpathOrder2(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order3.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order3.expect.md index 4b5e191a35..c7da987d15 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order3.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order3.expect.md @@ -17,7 +17,7 @@ function TestDepsSubpathOrder3(props) { ## Code ```javascript -// Determine that we only need to track p.a here +import * as React from "react"; // Determine that we only need to track p.a here // Ordering of access should not matter function TestDepsSubpathOrder3(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/regexp-literal.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/regexp-literal.expect.md index c93caa89fb..a839f242be 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/regexp-literal.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/regexp-literal.expect.md @@ -18,6 +18,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(4); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md index c4f6052007..e8c55c23a0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md @@ -43,7 +43,7 @@ function foo(props) { ## Code ```javascript -// note: comments are for the ideal scopes, not what is currently +import * as React from "react"; // note: comments are for the ideal scopes, not what is currently // emitted function foo(props) { const $ = React.unstable_useMemoCache(16); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md index dc4c090b37..ed72505eb9 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md @@ -43,7 +43,7 @@ function foo(props) { ## Code ```javascript -// note: comments are for the ideal scopes, not what is currently +import * as React from "react"; // note: comments are for the ideal scopes, not what is currently // emitted function foo(props) { const $ = React.unstable_useMemoCache(15); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/sequence-expression.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/sequence-expression.expect.md index 9f9c67d0fa..c06c5b7e94 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/sequence-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/sequence-expression.expect.md @@ -17,6 +17,7 @@ function foo() {} ## Code ```javascript +import * as React from "react"; function sequence(props) { const $ = React.unstable_useMemoCache(2); Math.max(1, 2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/simple-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/simple-alias.expect.md index d91ecce436..f89f72de3c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/simple-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/simple-alias.expect.md @@ -19,6 +19,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function mutate() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/simple-function-1.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/simple-function-1.expect.md index e7be6f7969..d60a518544 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/simple-function-1.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/simple-function-1.expect.md @@ -14,6 +14,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/simple-scope.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/simple-scope.expect.md index b934e57fd9..0d486e4ee7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/simple-scope.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/simple-scope.expect.md @@ -12,6 +12,7 @@ function foo(a) { ## Code ```javascript +import * as React from "react"; function foo(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a.b; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/simple.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/simple.expect.md index 9e634dad95..828ff01bef 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/simple.expect.md @@ -14,6 +14,7 @@ export default function foo(x, y) { ## Code ```javascript +import * as React from "react"; export default function foo(x, y) { const $ = React.unstable_useMemoCache(4); if (x) { diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-arrayexpression.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-arrayexpression.expect.md index 770afae39d..b1751e3675 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-arrayexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-arrayexpression.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md index b46ce0278f..751fe5ebfd 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md @@ -21,7 +21,7 @@ function Component(props) { ## Code ```javascript -// @Pass runMutableRangeAnalysis +import * as React from "react"; // @Pass runMutableRangeAnalysis function foo() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md index 1c63d61676..cb1915daec 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md @@ -18,6 +18,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function foo() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-cascading-eliminated-phis.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-cascading-eliminated-phis.expect.md index 6451c8f766..62567583de 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-cascading-eliminated-phis.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-cascading-eliminated-phis.expect.md @@ -23,6 +23,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); let x = 0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-for-of.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-for-of.expect.md index 00cc2a1f5a..80ebf01701 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-for-of.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-for-of.expect.md @@ -18,6 +18,7 @@ function foo(cond) { ## Code ```javascript +import * as React from "react"; function foo(cond) { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md index 2cb59afc92..b279138a58 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md @@ -22,6 +22,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(6); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-newexpression.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-newexpression.expect.md index 7c0500e0a3..f026521241 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-newexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-newexpression.expect.md @@ -16,6 +16,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Foo() { return undefined; } diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-non-empty-initializer.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-non-empty-initializer.expect.md index 4c98edcb97..7039b5fc93 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-non-empty-initializer.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-non-empty-initializer.expect.md @@ -17,6 +17,7 @@ function foo(a, b) { ## Code ```javascript +import * as React from "react"; function foo(a, b) { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression-phi.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression-phi.expect.md index cacca08508..cc18aa68c7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression-phi.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression-phi.expect.md @@ -21,6 +21,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); const x = 1; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression.expect.md index ac74ec2403..1882cfd83a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression.expect.md @@ -14,6 +14,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-alias-mutate-if.expect.md index 219fbf00f0..d962fd188a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-alias-mutate-if.expect.md @@ -21,6 +21,7 @@ function foo(a) { ## Code ```javascript +import * as React from "react"; function foo(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-if.expect.md index c022fa68dc..e6b72040b6 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-if.expect.md @@ -19,6 +19,7 @@ function foo(a) { ## Code ```javascript +import * as React from "react"; function foo(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-if.expect.md index 47949d1f4b..218ae7812c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-if.expect.md @@ -20,6 +20,7 @@ function foo(a) { ## Code ```javascript +import * as React from "react"; function foo(a) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-inside-if.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-inside-if.expect.md index 175ce30d95..c3e93b763d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-inside-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-inside-if.expect.md @@ -20,6 +20,7 @@ function foo(a) { ## Code ```javascript +import * as React from "react"; function foo(a) { const $ = React.unstable_useMemoCache(3); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md index ec0f22a96c..ede749c008 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md @@ -18,6 +18,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); let y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-call.expect.md index fb24ad69f3..6ba201aeda 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-call.expect.md @@ -14,6 +14,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); let y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-2.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-2.expect.md index 1e30d6dbfa..f0fabe4067 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-2.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-2.expect.md @@ -15,6 +15,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); let y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-alias.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-alias.expect.md index 77b9cabcb2..4a68961841 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-alias.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-alias.expect.md @@ -18,6 +18,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); let y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate.expect.md index 050bfdffcd..031470cd5b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate.expect.md @@ -15,6 +15,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); let y; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property.expect.md index 38e4ce493b..466a42b7a5 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-property.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-property.expect.md @@ -14,6 +14,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(2); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-reassign-in-rval.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-reassign-in-rval.expect.md index 0f7973fee4..6b167dd54d 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-reassign-in-rval.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-reassign-in-rval.expect.md @@ -14,7 +14,7 @@ function Component() { ## Code ```javascript -// Forget should call the original x (x = foo()) to compute result +import * as React from "react"; // Forget should call the original x (x = foo()) to compute result function Component() { const $ = React.unstable_useMemoCache(3); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction-with-mutation.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction-with-mutation.expect.md index 001fc3a9cd..b0a33716fe 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction-with-mutation.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction-with-mutation.expect.md @@ -18,6 +18,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction.expect.md index 6e78a91384..4c72f86785 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction.expect.md @@ -17,6 +17,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== props.bar; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-with-mutation.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-with-mutation.expect.md index c5bf93da13..ab8bb979e2 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-with-mutation.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-with-mutation.expect.md @@ -16,6 +16,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary.expect.md index 91b3165c1a..0581295809 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary.expect.md @@ -15,6 +15,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== props.bar; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary-with-mutation.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary-with-mutation.expect.md index 8ca9286aed..8062cc74df 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary-with-mutation.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary-with-mutation.expect.md @@ -18,6 +18,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary.expect.md index fe41cad3c7..ea0a6e6c95 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary.expect.md @@ -17,6 +17,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== props.bar; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-with-mutation.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-with-mutation.expect.md index 5109b48d85..cfca44dd5c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-with-mutation.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-with-mutation.expect.md @@ -23,6 +23,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring-with-mutation.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring-with-mutation.expect.md index 741838448e..943461ecda 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring-with-mutation.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring-with-mutation.expect.md @@ -19,6 +19,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring.expect.md index 23c6be2ab4..6648f30cc5 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring.expect.md @@ -18,6 +18,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== props.bar; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-with-mutation.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-with-mutation.expect.md index b898ae5474..3212056dd9 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-with-mutation.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-with-mutation.expect.md @@ -19,6 +19,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming.expect.md index 96b7897aeb..f97e463a39 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming.expect.md @@ -18,6 +18,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== props.bar; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/store-via-call.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/store-via-call.expect.md index 2dcd063132..86507deeb0 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/store-via-call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/store-via-call.expect.md @@ -14,6 +14,7 @@ function foo() { ## Code ```javascript +import * as React from "react"; function foo() { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/store-via-new.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/store-via-new.expect.md index d4f4ddafa3..8a540e1a59 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/store-via-new.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/store-via-new.expect.md @@ -14,6 +14,7 @@ function Foo() { ## Code ```javascript +import * as React from "react"; function Foo() { const $ = React.unstable_useMemoCache(1); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md index 7a88ff0bb1..57af863674 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md @@ -31,6 +31,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(9); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/switch.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/switch.expect.md index 610f317624..9571df01d9 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/switch.expect.md @@ -26,6 +26,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(8); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/tagged-template-literal.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/tagged-template-literal.expect.md index 6a58dca5dc..68fbe43026 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/tagged-template-literal.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/tagged-template-literal.expect.md @@ -24,6 +24,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/temporary-at-start-of-value-block.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/temporary-at-start-of-value-block.expect.md index 29f79e4370..ef71c3c99c 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/temporary-at-start-of-value-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/temporary-at-start-of-value-block.expect.md @@ -13,6 +13,7 @@ function component(props) { ## Code ```javascript +import * as React from "react"; function component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/timers.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/timers.expect.md index 398278c470..009068d08a 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/timers.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/timers.expect.md @@ -18,6 +18,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const start = performance.now(); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/type-cast-expression.flow.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/type-cast-expression.flow.expect.md index 7c52ae4954..9fb169b413 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/type-cast-expression.flow.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/type-cast-expression.flow.expect.md @@ -16,7 +16,7 @@ function Component(props) { ## Code ```javascript -// @flow +import * as React from "react"; // @flow type Foo = { bar: string }; function Component(props) { const $ = React.unstable_useMemoCache(2); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/type-field-load.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/type-field-load.expect.md index 42357dd2b2..566ef9efae 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/type-field-load.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/type-field-load.expect.md @@ -13,6 +13,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(1); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-load-binary-op.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-load-binary-op.expect.md index bd346cd04f..3142ea7e98 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-load-binary-op.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-load-binary-op.expect.md @@ -19,6 +19,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(3); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-store.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-store.expect.md index cf977132de..bd257d89f7 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-store.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/type-test-field-store.expect.md @@ -15,6 +15,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(2); let x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md index e653b30f0e..c81bca6db8 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md @@ -22,6 +22,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(3); let t0; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/type-test-return-type-inference.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/type-test-return-type-inference.expect.md index 19f69faef0..7c2d57f7e2 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/type-test-return-type-inference.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/type-test-return-type-inference.expect.md @@ -18,6 +18,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(1); const x = foo(); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/unary-expr.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/unary-expr.expect.md index 05638fcee1..117be18550 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/unary-expr.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/unary-expr.expect.md @@ -19,6 +19,7 @@ function component(a) { ## Code ```javascript +import * as React from "react"; function component(a) { const $ = React.unstable_useMemoCache(8); const t = { t: a }; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/unused-object-element-with-rest.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/unused-object-element-with-rest.expect.md index 8a7576905a..964e15b23b 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/unused-object-element-with-rest.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/unused-object-element-with-rest.expect.md @@ -13,6 +13,7 @@ function Foo(props) { ## Code ```javascript +import * as React from "react"; function Foo(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/update-expression.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/update-expression.expect.md index 84ea1afeb3..fdb6a5a663 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/update-expression.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/update-expression.expect.md @@ -14,6 +14,7 @@ function foo(props) { ## Code ```javascript +import * as React from "react"; function foo(props) { const $ = React.unstable_useMemoCache(4); let x = props.x; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/use-callback-simple.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/use-callback-simple.expect.md index 6b1fa77f5c..3ac6573f65 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/use-callback-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/use-callback-simple.expect.md @@ -14,6 +14,7 @@ function component() { ## Code ```javascript +import * as React from "react"; function component() { const $ = React.unstable_useMemoCache(5); const [count, setCount] = useState(0); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/useEffect-arg-memoized.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/useEffect-arg-memoized.expect.md index 2a8c6040f7..144236e161 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/useEffect-arg-memoized.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/useEffect-arg-memoized.expect.md @@ -24,6 +24,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(7); const dispatch = useDispatch(); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md index f3a0520d8b..78893c0898 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md @@ -30,6 +30,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(3); const item = useMutable(props.itemId); diff --git a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-if-else-multiple-return.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-if-else-multiple-return.expect.md index 3e9a619690..0d3a3bb43f 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-if-else-multiple-return.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-if-else-multiple-return.expect.md @@ -18,7 +18,7 @@ function Component(props) { ## Code ```javascript -// @inlineUseMemo +import * as React from "react"; // @inlineUseMemo function Component(props) { const $ = React.unstable_useMemoCache(4); let t17 = undefined; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-independently-memoizeable.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-independently-memoizeable.expect.md index b4bd074dc3..a4fb6d314f 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-independently-memoizeable.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-independently-memoizeable.expect.md @@ -18,7 +18,7 @@ function Component(props) { ## Code ```javascript -// @inlineUseMemo +import * as React from "react"; // @inlineUseMemo function Component(props) { const $ = React.unstable_useMemoCache(10); const c_0 = $[0] !== props.a; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-inlining-block-return.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-inlining-block-return.expect.md index 50a93312b8..21d4a90e47 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-inlining-block-return.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-inlining-block-return.expect.md @@ -17,7 +17,7 @@ function component(a, b) { ## Code ```javascript -// @inlineUseMemo +import * as React from "react"; // @inlineUseMemo function component(a, b) { const $ = React.unstable_useMemoCache(2); let t14 = undefined; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-multiple-if-else.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-multiple-if-else.expect.md index 49276def4d..648af00d70 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-multiple-if-else.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-multiple-if-else.expect.md @@ -23,7 +23,7 @@ function Component(props) { ## Code ```javascript -// @inlineUseMemo +import * as React from "react"; // @inlineUseMemo function Component(props) { const $ = React.unstable_useMemoCache(2); const c_0 = $[0] !== props; diff --git a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-simple.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-simple.expect.md index 23ab9ec91a..eb059bf130 100644 --- a/compiler/forget/src/__tests__/fixtures/compiler/useMemo-simple.expect.md +++ b/compiler/forget/src/__tests__/fixtures/compiler/useMemo-simple.expect.md @@ -13,7 +13,7 @@ function component(a) { ## Code ```javascript -// @inlineUseMemo +import * as React from "react"; // @inlineUseMemo function component(a) { const $ = React.unstable_useMemoCache(4); const c_0 = $[0] !== a; diff --git a/compiler/forget/src/__tests__/fixtures/disableMemoizeJsxElements/Component.expect.md b/compiler/forget/src/__tests__/fixtures/disableMemoizeJsxElements/Component.expect.md index 398c9916c7..0daf18aff7 100644 --- a/compiler/forget/src/__tests__/fixtures/disableMemoizeJsxElements/Component.expect.md +++ b/compiler/forget/src/__tests__/fixtures/disableMemoizeJsxElements/Component.expect.md @@ -19,6 +19,7 @@ function Component(props) { ## Code ```javascript +import * as React from "react"; function Component(props) { const $ = React.unstable_useMemoCache(2); const [name, setName] = useState(null);