Repository: facebook/react
Pull request: [compiler][repro] fixtures for fbt plural and macro bugs

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* #30536
* __->__ #30535
* #30524
* #30523
---

* Additional fbt incompatibilities not documented or handled by #30437
* Repro for macro calls not being flattened if the callee is a MethodCall (e.g. `importedMacro.foo(...)`


 See fixtures for comments.


Changed files:
filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/bug-fbt-plural-multiple-function-calls.expect.md
patch: @@ -3,6 +3,18 @@
 
 ```javascript
 import fbt from 'fbt';
+
+/**
+ * Similar to error.todo-multiple-fbt-plural
+ *
+ * Evaluator error:
+ *   Found differences in evaluator results
+ *   Non-forget (expected):
+ *   (kind: ok) <div>1 apple and 2 bananas</div>
+ *   Forget:
+ *   (kind: ok) <div>1 apples and 2 bananas</div>
+ */
+
 function useFoo({apples, bananas}) {
   return fbt(
     `${fbt.param('number of apples', apples)} ` +
@@ -25,6 +37,18 @@ export const FIXTURE_ENTRYPOINT = {
 ```javascript
 import { c as _c } from "react/compiler-runtime";
 import fbt from "fbt";
+
+/**
+ * Similar to error.todo-multiple-fbt-plural
+ *
+ * Evaluator error:
+ *   Found differences in evaluator results
+ *   Non-forget (expected):
+ *   (kind: ok) <div>1 apple and 2 bananas</div>
+ *   Forget:
+ *   (kind: ok) <div>1 apples and 2 bananas</div>
+ */
+
 function useFoo(t0) {
   const $ = _c(3);
   const { apples, bananas } = t0;

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/bug-fbt-plural-multiple-function-calls.ts
patch: @@ -1,4 +1,16 @@
 import fbt from 'fbt';
+
+/**
+ * Similar to error.todo-multiple-fbt-plural
+ *
+ * Evaluator error:
+ *   Found differences in evaluator results
+ *   Non-forget (expected):
+ *   (kind: ok) <div>1 apple and 2 bananas</div>
+ *   Forget:
+ *   (kind: ok) <div>1 apples and 2 bananas</div>
+ */
+
 function useFoo({apples, bananas}) {
   return fbt(
     `${fbt.param('number of apples', apples)} ` +

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/bug-fbt-plural-multiple-mixed-call-tag.expect.md
patch: @@ -4,16 +4,29 @@
 ```javascript
 import fbt from 'fbt';
 
+/**
+ * Similar to error.todo-multiple-fbt-plural, but note that we must
+ * count fbt plurals across both <fbt:plural /> namespaced jsx tags
+ * and fbt.plural(...) call expressions.
+ *
+ * Evaluator error:
+ *   Found differences in evaluator results
+ *   Non-forget (expected):
+ *   (kind: ok) <div>1 apple and 2 bananas</div>
+ *   Forget:
+ *   (kind: ok) <div>1 apples and 2 bananas</div>
+ */
 function useFoo({apples, bananas}) {
   return (
     <div>
-      <fbt desc="Comments ">
+      <fbt desc="Test Description">
         {fbt.param('number of apples', apples)}
         {'  '}
         {fbt.plural('apple', apples)} and
-        {fbt.param('number of bananas', bananas)}
         {'  '}
-        {fbt.plural('banana', bananas)}
+        <fbt:plural name={'number of bananas'} count={bananas} showCount="yes">
+          banana
+        </fbt:plural>
       </fbt>
     </div>
   );
@@ -32,6 +45,18 @@ export const FIXTURE_ENTRYPOINT = {
 import { c as _c } from "react/compiler-runtime";
 import fbt from "fbt";
 
+/**
+ * Similar to error.todo-multiple-fbt-plural, but note that we must
+ * count fbt plurals across both <fbt:plural /> namespaced jsx tags
+ * and fbt.plural(...) call expressions.
+ *
+ * Evaluator error:
+ *   Found differences in evaluator results
+ *   Non-forget (expected):
+ *   (kind: ok) <div>1 apple and 2 bananas</div>
+ *   Forget:
+ *   (kind: ok) <div>1 apples and 2 bananas</div>
+ */
 function useFoo(t0) {
   const $ = _c(3);
   const { apples, bananas } = t0;
@@ -44,17 +69,14 @@ function useFoo(t0) {
             "*": {
               "*": "{number of apples} apples and {number of bananas} bananas",
             },
-            _1: {
-              _1: "{number of apples} apple and {number of bananas} banana",
-            },
+            _1: { _1: "{number of apples} apple and 1 banana" },
           },
           [
             fbt._plural(apples),
-            fbt._plural(bananas),
+            fbt._plural(bananas, "number of bananas"),
             fbt._param("number of apples", apples),
-            fbt._param("number of bananas", bananas),
           ],
-          { hk: "2f5FtZ" },
+          { hk: "2xXrUW" },
         )}
       </div>
     );

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/bug-fbt-plural-multiple-mixed-call-tag.tsx
patch: @@ -1,15 +1,28 @@
 import fbt from 'fbt';
 
+/**
+ * Similar to error.todo-multiple-fbt-plural, but note that we must
+ * count fbt plurals across both <fbt:plural /> namespaced jsx tags
+ * and fbt.plural(...) call expressions.
+ *
+ * Evaluator error:
+ *   Found differences in evaluator results
+ *   Non-forget (expected):
+ *   (kind: ok) <div>1 apple and 2 bananas</div>
+ *   Forget:
+ *   (kind: ok) <div>1 apples and 2 bananas</div>
+ */
 function useFoo({apples, bananas}) {
   return (
     <div>
-      <fbt desc="Comments ">
+      <fbt desc="Test Description">
         {fbt.param('number of apples', apples)}
         {'  '}
         {fbt.plural('apple', apples)} and
-        {fbt.param('number of bananas', bananas)}
         {'  '}
-        {fbt.plural('banana', bananas)}
+        <fbt:plural name={'number of bananas'} count={bananas} showCount="yes">
+          banana
+        </fbt:plural>
       </fbt>
     </div>
   );