diff --git a/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts b/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts index c68fc05ba0..74ab0b41eb 100644 --- a/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts +++ b/compiler/packages/babel-plugin-react-forget/src/HIR/BuildHIR.ts @@ -2058,6 +2058,25 @@ function lowerExpression( suggestions: null, }); } + const fbtEnumLocations: Array = []; + expr.traverse({ + JSXNamespacedName(path) { + if ( + path.node.namespace.name === "fbt" && + path.node.name.name === "enum" + ) { + fbtEnumLocations.push(path.node.loc ?? GeneratedSource); + } + }, + }); + if (fbtEnumLocations.length > 1) { + CompilerError.throwTodo({ + reason: `Support tags with multiple values`, + loc: fbtEnumLocations.at(-1) ?? GeneratedSource, + description: null, + suggestions: null, + }); + } } let children: Array; 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 index fefa98b7b0..bbd261aeef 100644 --- 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 @@ -19,7 +19,13 @@ function Component({ a, b }) { ## Error ``` -avalue1 not found in { bvalue1: 'bvalue1', bvalue2: 'bvalue2' }. Attempting to re-use incompatible enums + 5 | + 6 | {" "} +> 7 | + | ^^^^^^^^ [ReactForget] Todo: Support tags with multiple values (7:7) + 8 | + 9 | ); + 10 | } ``` \ No newline at end of file