Update fixtures from workspace rebase

I updated these yesterday, looks like they got added back in the workspace PR. 
Rebases are hard, all good!
This commit is contained in:
Joe Savona
2023-06-05 14:16:14 -04:00
parent 66ca1c75cb
commit 39d837d918
18 changed files with 0 additions and 411 deletions
@@ -1,41 +0,0 @@
## Input
```javascript
function component(a) {
let x = { a };
let y = 1;
(function () {
y = x;
})();
mutate(y);
return y;
}
```
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function component(a) {
const $ = useMemoCache(2);
const c_0 = $[0] !== a;
let y;
if (c_0) {
const x = { a };
y = 1;
(function () {
y = x;
})();
mutate(y);
$[0] = a;
$[1] = y;
} else {
y = $[1];
}
return y;
}
```
@@ -1,9 +0,0 @@
function component(a) {
let x = { a };
let y = 1;
(function () {
y = x;
})();
mutate(y);
return y;
}
@@ -1,60 +0,0 @@
## Input
```javascript
// Should print A, B, arg, original
function Component() {
const changeF = (o) => {
o.f = () => console.log("new");
};
const x = {
f: () => console.log("original"),
};
(console.log("A"), x)[(console.log("B"), "f")](
(changeF(x), console.log("arg"), 1)
);
return x;
}
```
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // Should print A, B, arg, original
function Component() {
const $ = useMemoCache(3);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = (o) => {
o.f = () => console.log("new");
};
$[0] = t0;
} else {
t0 = $[0];
}
const changeF = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = () => console.log("original");
$[1] = t1;
} else {
t1 = $[1];
}
let x;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
x = { f: t1 };
(console.log("A"), x)[(console.log("B"), "f")](
(changeF(x), console.log("arg"), 1)
);
$[2] = x;
} else {
x = $[2];
}
return x;
}
```
@@ -1,14 +0,0 @@
// Should print A, B, arg, original
function Component() {
const changeF = (o) => {
o.f = () => console.log("new");
};
const x = {
f: () => console.log("original"),
};
(console.log("A"), x)[(console.log("B"), "f")](
(changeF(x), console.log("arg"), 1)
);
return x;
}
@@ -1,44 +0,0 @@
## Input
```javascript
function Component() {
const x = {};
{
let x = 56;
const fn = function () {
x = 42;
};
fn();
}
return x; // should return {}
}
```
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component() {
const $ = useMemoCache(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = {};
$[0] = t0;
} else {
t0 = $[0];
}
const x = t0;
let x_0;
x_0 = 56;
const fn = function () {
x_0 = 42;
};
fn();
return x;
}
```
@@ -1,11 +0,0 @@
function Component() {
const x = {};
{
let x = 56;
const fn = function () {
x = 42;
};
fn();
}
return x; // should return {}
}
@@ -1,58 +0,0 @@
## Input
```javascript
// Should print A, arg, original
function Component() {
const changeF = (o) => {
o.f = () => console.log("new");
};
const x = {
f: () => console.log("original"),
};
(console.log("A"), x).f((changeF(x), console.log("arg"), 1));
return x;
}
```
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // Should print A, arg, original
function Component() {
const $ = useMemoCache(3);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = (o) => {
o.f = () => console.log("new");
};
$[0] = t0;
} else {
t0 = $[0];
}
const changeF = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = () => console.log("original");
$[1] = t1;
} else {
t1 = $[1];
}
let x;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
x = { f: t1 };
(console.log("A"), x).f((changeF(x), console.log("arg"), 1));
$[2] = x;
} else {
x = $[2];
}
return x;
}
```
@@ -1,13 +0,0 @@
// Should print A, arg, original
function Component() {
const changeF = (o) => {
o.f = () => console.log("new");
};
const x = {
f: () => console.log("original"),
};
(console.log("A"), x).f((changeF(x), console.log("arg"), 1));
return x;
}
@@ -1,31 +0,0 @@
## Input
```javascript
function Component(props) {
let x = [];
let y = x;
if (props.p1) {
x = [];
}
let _ = <Component x={x} />;
// y is MaybeFrozen at this point, since it may alias to x
// (which is the above line freezes)
y.push(props.p2);
return <Component x={x} y={y} />;
}
```
## Error
```
[ReactForget] InvalidInput: InferReferenceEffects: inferred mutation of known immutable value. Found mutation of $46:TObject<BuiltInArray> (frozen) (13:13)
```
@@ -1,16 +0,0 @@
function Component(props) {
let x = [];
let y = x;
if (props.p1) {
x = [];
}
let _ = <Component x={x} />;
// y is MaybeFrozen at this point, since it may alias to x
// (which is the above line freezes)
y.push(props.p2);
return <Component x={x} y={y} />;
}
@@ -1,25 +0,0 @@
## Input
```javascript
function Component(props) {
let x = [];
let _ = <Component x={x} />;
// x is Frozen at this point
x.push(props.p2);
return <div>{_}</div>;
}
```
## Error
```
[ReactForget] InvalidInput: InferReferenceEffects: inferred mutation of known immutable value. Found mutation of $27:TObject<BuiltInArray> (frozen) (7:7)
```
@@ -1,10 +0,0 @@
function Component(props) {
let x = [];
let _ = <Component x={x} />;
// x is Frozen at this point
x.push(props.p2);
return <div>{_}</div>;
}
@@ -1,22 +0,0 @@
## Input
```javascript
/* eslint-disable react-hooks/rules-of-hooks */
function lowercasecomponent() {
"use forget";
const x = [];
return <div>{x}</div>;
}
/* eslint-enable react-hooks/rules-of-hooks */
```
## Error
```
[ReactForget] UnsafeInput: One or more React eslint rules is disabled. eslint-disable react-hooks/rules-of-hooks (1:1)
```
@@ -1,7 +0,0 @@
/* eslint-disable react-hooks/rules-of-hooks */
function lowercasecomponent() {
"use forget";
const x = [];
return <div>{x}</div>;
}
/* eslint-enable react-hooks/rules-of-hooks */
@@ -1,21 +0,0 @@
## Input
```javascript
function component(a, b) {
let x = useMemo(async () => {
await a;
}, []);
return x;
}
```
## Error
```
[ReactForget] InvalidInput: useMemo callbacks may not be async or generator functions (2:4)
```
@@ -1,6 +0,0 @@
function component(a, b) {
let x = useMemo(async () => {
await a;
}, []);
return x;
}
@@ -1,19 +0,0 @@
## Input
```javascript
function component(a, b) {
let x = useMemo((c) => a, []);
return x;
}
```
## Error
```
[ReactForget] InvalidInput: useMemo callbacks may not accept any arguments (2:2)
```
@@ -1,4 +0,0 @@
function component(a, b) {
let x = useMemo((c) => a, []);
return x;
}