From 501481ccea2dc1ba844a9f8a926db22a23e1f322 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Tue, 19 Mar 2024 15:21:55 -0700 Subject: [PATCH] Repro for fbt:enum source location issue Fbt enums appear to rely on source locations and something that we're doing (maybe destructuring?) isn't preserving locations such that the fbt plugin breaks. --- ...rror.todo-fbt-unknown-enum-value.expect.md | 25 +++++++++++++++++++ .../fbt/error.todo-fbt-unknown-enum-value.js | 10 ++++++++ 2 files changed, 35 insertions(+) create mode 100644 compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.expect.md create mode 100644 compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.js diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.expect.md new file mode 100644 index 0000000000..fefa98b7b0 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.expect.md @@ -0,0 +1,25 @@ + +## Input + +```javascript +import fbt from "fbt"; + +function Component({ a, b }) { + return ( + + {" "} + + + ); +} + +``` + + +## Error + +``` +avalue1 not found in { bvalue1: 'bvalue1', bvalue2: 'bvalue2' }. Attempting to re-use incompatible enums +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.js new file mode 100644 index 0000000000..a496c5b96e --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/fbt/error.todo-fbt-unknown-enum-value.js @@ -0,0 +1,10 @@ +import fbt from "fbt"; + +function Component({ a, b }) { + return ( + + {" "} + + + ); +}