diff --git a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.expect.md new file mode 100644 index 0000000000..0c52830e06 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.expect.md @@ -0,0 +1,21 @@ + +## Input + +```javascript +function Component(props) { + const x = []; +
{x}
; + x.push(props.value); + return x; +} + +``` + + +## Error + +``` +[ReactForget] InvalidInput: InferReferenceEffects: inferred mutation of known immutable value. Found mutation of $20:TObject (frozen) (4:4) +``` + + \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.js b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.js new file mode 100644 index 0000000000..3ede9c0463 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/compiler/error.invalid-array-push-frozen.js @@ -0,0 +1,6 @@ +function Component(props) { + const x = []; +
{x}
; + x.push(props.value); + return x; +}