diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.expect.md new file mode 100644 index 0000000000..9fb8c349e0 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.expect.md @@ -0,0 +1,26 @@ + +## Input + +```javascript +function Component() { + return ; + + // This is unreachable from a control-flow perspective, but it gets hoisted + function Foo() {} +} + +``` + + +## Error + +``` + 1 | function Component() { +> 2 | return ; + | ^^^ [ReactForget] Invariant: [hoisting] Expected value for identifier to be initialized. Foo$0 (2:2) + 3 | + 4 | // This is unreachable from a control-flow perspective, but it gets hoisted + 5 | function Foo() {} +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.js new file mode 100644 index 0000000000..ce7215e0c8 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-hoisted-function-in-unreachable-code.js @@ -0,0 +1,6 @@ +function Component() { + return ; + + // This is unreachable from a control-flow perspective, but it gets hoisted + function Foo() {} +}