Repro for missing predecessor with try/catch

Found when running the compiler on a large swath of internal code. 
PruneMaybeThrows rewrites terminals, but the logic to update subsequent phis was 
incorrectly dropping phis rather than rewriting them. Fixed in the next PR.
This commit is contained in:
Joe Savona
2024-03-20 14:07:28 -07:00
parent 14d54869ed
commit 1cf8d9bc8b
2 changed files with 41 additions and 0 deletions
@@ -0,0 +1,28 @@
## Input
```javascript
// @enableAssumeHooksFollowRulesOfReact @enableTransitivelyFreezeFunctionExpressions
function useSupportsTouchEvent() {
return useMemo(() => {
if (checkforTouchEvents) {
try {
document.createEvent("TouchEvent");
return true;
} catch {
return false;
}
}
}, []);
}
```
## Error
```
Cannot read properties of undefined (reading 'preds')
```
@@ -0,0 +1,13 @@
// @enableAssumeHooksFollowRulesOfReact @enableTransitivelyFreezeFunctionExpressions
function useSupportsTouchEvent() {
return useMemo(() => {
if (checkforTouchEvents) {
try {
document.createEvent("TouchEvent");
return true;
} catch {
return false;
}
}
}, []);
}