Skip to content

[compiler] Add repro for func properties bug with @gating #29802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

## Input

```javascript
// @gating

/**
* Fail: bug-gating-invalid-function-properties
* Unexpected error in Forget runner
* Component is not defined
*/
export default function Component() {
return <></>;
}

export function Component2() {
return <></>;
}

Component.displayName = "Component ONE";
Component2.displayName = "Component TWO";

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [],
sequentialRenders: [],
};

```

## Code

```javascript
import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
import { c as _c } from "react/compiler-runtime"; // @gating

/**
* Fail: bug-gating-invalid-function-properties
* Unexpected error in Forget runner
* Component is not defined
*/
export default isForgetEnabled_Fixtures()
? function Component() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <></>;
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}
: function Component() {
return <></>;
};

export const Component2 = isForgetEnabled_Fixtures()
? function Component2() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <></>;
$[0] = t0;
} else {
t0 = $[0];
}
return t0;
}
: function Component2() {
return <></>;
};

Component.displayName = "Component ONE";
Component2.displayName = "Component TWO";

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [],
sequentialRenders: [],
};

```

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// @gating

/**
* Fail: bug-gating-invalid-function-properties
* Unexpected error in Forget runner
* Component is not defined
*/
export default function Component() {
return <></>;
}

export function Component2() {
return <></>;
}

Component.displayName = "Component ONE";
Component2.displayName = "Component TWO";

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [],
sequentialRenders: [],
};
1 change: 1 addition & 0 deletions compiler/packages/snap/src/SproutTodoFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ const skipFilter = new Set([
"bug-invalid-hoisting-functionexpr",
"original-reactive-scopes-fork/bug-nonmutating-capture-in-unsplittable-memo-block",
"original-reactive-scopes-fork/bug-hoisted-declaration-with-scope",
"bug-gating-invalid-function-properties",

// 'react-compiler-runtime' not yet supported
"flag-enable-emit-hook-guards",
Expand Down