@samitouri / QOS-React-1 / commits / 56b0f971d0

[sprout] Port alias-capture-in-method-receiver-and-mutate test

Sathya Gunasekaran committed Aug 23, 2023 at 17:44 UTC 56b0f971d0459b60a262c3effbaca79265bdf67b
3 files changed +27 -4
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver-and-mutate.expect.md
+18 -2
@@ -2,10 +2,12 @@
2 ## Input
3
4 ```javascript
5 +import { makeObject_Primitives, mutate } from "shared-runtime";
6 +
7 function Component() {
8 // a's mutable range should be the same as x's mutable range,
9 // since a is captured into x (which gets mutated later)
8 - let a = someObj();
10 + let a = makeObject_Primitives();
11
12 let x = [];
13 x.push(a);
@@ -14,18 +16,26 @@ function Component() {
16 return [x, a];
17 }
18
19 +export const FIXTURE_ENTRYPOINT = {
20 + fn: Component,
21 + params: [],
22 + isComponent: false,
23 +};
24 +
25 ```
26
27 ## Code
28
29 ```javascript
30 import { unstable_useMemoCache as useMemoCache } from "react";
31 +import { makeObject_Primitives, mutate } from "shared-runtime";
32 +
33 function Component() {
34 const $ = useMemoCache(3);
35 let x;
36 let a;
37 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
28 - a = someObj();
38 + a = makeObject_Primitives();
39
40 x = [];
41 x.push(a);
@@ -47,5 +57,11 @@ function Component() {
57 return t0;
58 }
59
60 +export const FIXTURE_ENTRYPOINT = {
61 + fn: Component,
62 + params: [],
63 + isComponent: false,
64 +};
65 +
66 ```
67
\ No newline at end of file
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver-and-mutate.js
+9 -1
@@ -1,7 +1,9 @@
1 +import { makeObject_Primitives, mutate } from "shared-runtime";
2 +
3 function Component() {
4 // a's mutable range should be the same as x's mutable range,
5 // since a is captured into x (which gets mutated later)
4 - let a = someObj();
6 + let a = makeObject_Primitives();
7
8 let x = [];
9 x.push(a);
@@ -9,3 +11,9 @@ function Component() {
11 mutate(x);
12 return [x, a];
13 }
14 +
15 +export const FIXTURE_ENTRYPOINT = {
16 + fn: Component,
17 + params: [],
18 + isComponent: false,
19 +};
compiler/packages/sprout/src/SproutTodoFilter.ts
-1
@@ -181,7 +181,6 @@ const skipFilter = new Set([
181 * Category C:
182 * Tests with at 0 params and at least one ref to external values
183 */
184 - "alias-capture-in-method-receiver-and-mutate",
184 "alias-capture-in-method-receiver",
185 "alias-nested-member-path-mutate",
186 "chained-assignment-context-variable",