Repro for nested method calls causing promoted property load invariant

This commit is contained in:
Joe Savona
2024-03-21 14:11:07 -07:00
parent 1b6afa1879
commit 0e72e2a00e
2 changed files with 45 additions and 0 deletions
@@ -0,0 +1,33 @@
## Input
```javascript
import { makeArray } from "shared-runtime";
function Component(props) {
const items = makeArray(0, 1, 2, null, 4, false, 6);
const max = Math.max(...items.filter(Boolean));
return max;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{}],
};
```
## Error
```
3 | function Component(props) {
4 | const items = makeArray(0, 1, 2, null, 4, false, 6);
> 5 | const max = Math.max(...items.filter(Boolean));
| ^^^^^^^^ [ReactForget] Invariant: [Codegen] Internal error: MethodCall::property must be an unpromoted + unmemoized MemberExpression. Got a 'Identifier' (5:5)
6 | return max;
7 | }
8 |
```
@@ -0,0 +1,12 @@
import { makeArray } from "shared-runtime";
function Component(props) {
const items = makeArray(0, 1, 2, null, 4, false, 6);
const max = Math.max(...items.filter(Boolean));
return max;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{}],
};