@samitouri / QOS-React-2 / commits / 018899d778

[aliasing] Make aliasing account for MutableRange.end being exclusive

Sathya Gunasekaran committed Feb 2, 2023 at 17:41 UTC 018899d778bd6e33b4b2045122ab6ea82b5e68e0
3 files changed +15 -14
compiler/forget/src/Inference/InferAliasForStores.ts
+1 -1
@@ -64,7 +64,7 @@ function maybeAlias(
64 id: InstructionId
65 ): void {
66 if (
67 - lvalue.identifier.mutableRange.end > id ||
67 + lvalue.identifier.mutableRange.end > id + 1 ||
68 rvalue.identifier.mutableRange.end > id
69 ) {
70 aliases.union([lvalue.identifier, rvalue.identifier]);
compiler/forget/src/__tests__/fixtures/hir/logical-expression-object.expect.md renamed
+14 -13
@@ -21,22 +21,23 @@ function component(props) {
21 function component(props) {
22 const $ = React.useMemoCache();
23 const c_0 = $[0] !== props;
24 - let a;
24 + let t1;
25 if (c_0) {
26 - a = props.a || (props.b && props.c && props.d);
27 - const c_2 = $[2] !== props;
28 - let t3;
29 - if (c_2) {
30 - t3 = (props.a && props.b && props.c) || props.d;
31 - $[2] = props;
32 - $[3] = t3;
33 - } else {
34 - t3 = $[3];
35 - }
26 + t1 = props.a || (props.b && props.c && props.d);
27 $[0] = props;
37 - $[1] = a;
28 + $[1] = t1;
29 } else {
39 - a = $[1];
30 + t1 = $[1];
31 + }
32 + const a = t1;
33 + const c_2 = $[2] !== props;
34 + let t3;
35 + if (c_2) {
36 + t3 = (props.a && props.b && props.c) || props.d;
37 + $[2] = props;
38 + $[3] = t3;
39 + } else {
40 + t3 = $[3];
41 }
42 const b = t3;
43 const c_4 = $[4] !== a;
compiler/forget/src/__tests__/fixtures/hir/logical-expression-object.js renamed