diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-reassign-const.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-reassign-const.expect.md new file mode 100644 index 0000000000..14a29be062 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-reassign-const.expect.md @@ -0,0 +1,33 @@ + +## Input + +```javascript +import { Stringify } from "shared-runtime"; + +function Component({ foo }) { + let bar = foo.bar; + return ( + { + foo = true; + }} + /> + ); +} + +``` + + +## Error + +``` + 2 | + 3 | function Component({ foo }) { +> 4 | let bar = foo.bar; + | ^^^ [ReactForget] Invariant: Expected all references to a variable to be consistently local or context references. Identifier foo$1 is referenced as a context variable, but was previously referenced as a local variable (4:4) + 5 | return ( + 6 | { +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-reassign-const.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-reassign-const.js new file mode 100644 index 0000000000..3a54e0c599 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-reassign-const.js @@ -0,0 +1,12 @@ +import { Stringify } from "shared-runtime"; + +function Component({ foo }) { + let bar = foo.bar; + return ( + { + foo = true; + }} + /> + ); +}