repro-capturing-func-maybealias-captured-mutate.ts — react Source File
Architecture documentation for repro-capturing-func-maybealias-captured-mutate.ts, a typescript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 359137ab_41b5_1e83_ec94_7b85d17f581b["repro-capturing-func-maybealias-captured-mutate.ts"] 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"] 359137ab_41b5_1e83_ec94_7b85d17f581b --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05 style 359137ab_41b5_1e83_ec94_7b85d17f581b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @enableNewMutationAliasingModel
import {makeArray, mutate} from 'shared-runtime';
/**
* Bug repro, fixed in the new mutability/aliasing inference.
*
* Previous issue:
*
* Fork of `capturing-func-alias-captured-mutate`, but instead of directly
* aliasing `y` via `[y]`, we make an opaque call.
*
* Note that the bug here is that we don't infer that `a = makeArray(y)`
* potentially captures a context variable into a local variable. As a result,
* we don't understand that `a[0].x = b` captures `x` into `y` -- instead, we're
* currently inferring that this lambda captures `y` (for a potential later
* mutation) and simply reads `x`.
*
* Concretely `InferReferenceEffects.hasContextRefOperand` is incorrectly not
* used when we analyze CallExpressions.
*/
function Component({foo, bar}: {foo: number; bar: number}) {
let x = {foo};
let y: {bar: number; x?: {foo: number}} = {bar};
const f0 = function () {
let a = makeArray(y); // a = [y]
let b = x;
// this writes y.x = x
a[0].x = b;
};
f0();
mutate(y.x);
return y;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{foo: 3, bar: 4}],
sequentialRenders: [
{foo: 3, bar: 4},
{foo: 3, bar: 5},
],
};
Domain
Subdomains
Functions
Dependencies
- shared-runtime
Source
Frequently Asked Questions
What does repro-capturing-func-maybealias-captured-mutate.ts do?
repro-capturing-func-maybealias-captured-mutate.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in repro-capturing-func-maybealias-captured-mutate.ts?
repro-capturing-func-maybealias-captured-mutate.ts defines 1 function(s): Component.
What does repro-capturing-func-maybealias-captured-mutate.ts depend on?
repro-capturing-func-maybealias-captured-mutate.ts imports 1 module(s): shared-runtime.
Where is repro-capturing-func-maybealias-captured-mutate.ts in the architecture?
repro-capturing-func-maybealias-captured-mutate.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-capturing-func-maybealias-captured-mutate.ts (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free