[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
This commit is contained in:
Jordan Brown 2025-06-16 21:53:27 -04:00 committed by GitHub
parent 5d24c64cc9
commit 75e78d243f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,33 @@
## Input
```javascript
function Component(props) {
const x = props.foo
? 1
: (() => {
throw new Error('Did not receive 1');
})();
return items;
}
```
## Error
```
2 | const x = props.foo
3 | ? 1
> 4 | : (() => {
| ^^^^^^^^
> 5 | throw new Error('Did not receive 1');
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 6 | })();
| ^^^^^^^^^^^ Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (4:6)
7 | return items;
8 | }
9 |
```

View File

@ -0,0 +1,8 @@
function Component(props) {
const x = props.foo
? 1
: (() => {
throw new Error('Did not receive 1');
})();
return items;
}