diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-nested-method-calls-lower-property-load-into-temporary.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-nested-method-calls-lower-property-load-into-temporary.expect.md new file mode 100644 index 0000000000..74049c063c --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-nested-method-calls-lower-property-load-into-temporary.expect.md @@ -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 | +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-nested-method-calls-lower-property-load-into-temporary.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-nested-method-calls-lower-property-load-into-temporary.js new file mode 100644 index 0000000000..153412b0fd --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-nested-method-calls-lower-property-load-into-temporary.js @@ -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: [{}], +};