diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.expect.md new file mode 100644 index 0000000000..1e5ccbd8b6 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.expect.md @@ -0,0 +1,24 @@ + +## Input + +```javascript +function Component(props) { + // This `x` uses a context variable: + const items = props.items.filter((x) => x != null); + // and so does this one: + const x = items.map((y) => y); + // I think what's happening is that `x` is both a) used in a function expression and b) "reassigned", + // meeting the criteria for context variables. Except that these are different instances of x. + return x; +} + +``` + + +## Error + +``` +[ReactForget] Invariant: Expected value kind to be initialized at '8:9:8:10' (8:8) +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.js new file mode 100644 index 0000000000..e9c241b22a --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.repro-uninitialized-value-kind-with-function-expression-params.js @@ -0,0 +1,9 @@ +function Component(props) { + // This `x` uses a context variable: + const items = props.items.filter((x) => x != null); + // and so does this one: + const x = items.map((y) => y); + // I think what's happening is that `x` is both a) used in a function expression and b) "reassigned", + // meeting the criteria for context variables. Except that these are different instances of x. + return x; +}