[compiler] Add repro for IIFE in ternary causing a bailout (#33546)
--- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33546). * #33548 * __->__ #33546
Jordan Brown committed
Jun 16, 2025 at 21:53 UTC
75e78d243f749d009fa1c5c09c3464301b992718
2 files changed
+41
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-iife-inline-ternary.expect.md
new
+33
@@ -0,0 +1,33 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+function Component(props) {
6
+ const x = props.foo
7
+ ? 1
8
+ : (() => {
9
+ throw new Error('Did not receive 1');
10
+ })();
11
+ return items;
12
+}
13
+
14
+```
15
+
16
+
17
+## Error
18
+
19
+```
20
+ 2 | const x = props.foo
21
+ 3 | ? 1
22
+> 4 | : (() => {
23
+ | ^^^^^^^^
24
+> 5 | throw new Error('Did not receive 1');
25
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
+> 6 | })();
27
+ | ^^^^^^^^^^^ Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (4:6)
28
+ 7 | return items;
29
+ 8 | }
30
+ 9 |
31
+```
32
+
33
+
\ No newline at end of file
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-iife-inline-ternary.js
new
+8
@@ -0,0 +1,8 @@
1
+function Component(props) {
2
+ const x = props.foo
3
+ ? 1
4
+ : (() => {
5
+ throw new Error('Did not receive 1');
6
+ })();
7
+ return items;
8
+}