diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-valid-functiondecl-hoisting.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-valid-functiondecl-hoisting.expect.md new file mode 100644 index 0000000000..fb8988c8f8 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-valid-functiondecl-hoisting.expect.md @@ -0,0 +1,46 @@ + +## Input + +```javascript +import {Stringify} from 'shared-runtime'; +/** + * Also see error.todo-functiondecl-hoisting.tsx which shows *invalid* + * compilation cases. + * + * This bailout specifically is a false positive for since this function's only + * reference-before-definition are within other functions which are not invoked. + */ +function Foo() { + 'use memo'; + + function foo() { + return bar(); + } + function bar() { + return 42; + } + + return ; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Foo, + params: [], +}; + +``` + + +## Error + +``` + 13 | return bar(); + 14 | } +> 15 | function bar() { + | ^^^ Todo: [PruneHoistedContexts] Rewrite hoisted function references (15:15) + 16 | return 42; + 17 | } + 18 | +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-valid-functiondecl-hoisting.tsx b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-valid-functiondecl-hoisting.tsx new file mode 100644 index 0000000000..063492b89c --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-valid-functiondecl-hoisting.tsx @@ -0,0 +1,25 @@ +import {Stringify} from 'shared-runtime'; +/** + * Also see error.todo-functiondecl-hoisting.tsx which shows *invalid* + * compilation cases. + * + * This bailout specifically is a false positive for since this function's only + * reference-before-definition are within other functions which are not invoked. + */ +function Foo() { + 'use memo'; + + function foo() { + return bar(); + } + function bar() { + return 42; + } + + return ; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Foo, + params: [], +};