Skip to content

[playground] Allow (Arrow)FunctionExpressions #30729

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 4 commits into from
Aug 16, 2024
Merged

Conversation

poteto
Copy link
Member

@poteto poteto commented Aug 16, 2024

Stack from ghstack (oldest at bottom):

This was a pet peeve where our playground could only compile top level
FunctionDeclarations. Just synthesize a fake identifier if it doesn't
have one.

[ghstack-poisoned]
Copy link

vercel bot commented Aug 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 16, 2024 9:48pm

poteto added a commit that referenced this pull request Aug 16, 2024
This was a pet peeve where our playground could only compile top level
FunctionDeclarations. Just synthesize a fake identifier if it doesn't
have one.

ghstack-source-id: 88342ef
Pull Request resolved: #30729
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Aug 16, 2024
[ghstack-poisoned]
poteto added a commit that referenced this pull request Aug 16, 2024
This was a pet peeve where our playground could only compile top level
FunctionDeclarations. Just synthesize a fake identifier if it doesn't
have one.

ghstack-source-id: f72f2da
Pull Request resolved: #30729
Copy link
Member

@josephsavona josephsavona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet

[ghstack-poisoned]
poteto added a commit that referenced this pull request Aug 16, 2024
This was a pet peeve where our playground could only compile top level
FunctionDeclarations. Just synthesize a fake identifier if it doesn't
have one.

ghstack-source-id: 49af543
Pull Request resolved: #30729
[ghstack-poisoned]
poteto added a commit that referenced this pull request Aug 16, 2024
This was a pet peeve where our playground could only compile top level
FunctionDeclarations. Just synthesize a fake identifier if it doesn't
have one.

ghstack-source-id: 882483c
Pull Request resolved: #30729
@poteto poteto merged commit cfd2c60 into gh/poteto/6/base Aug 16, 2024
19 checks passed
poteto added a commit that referenced this pull request Aug 16, 2024
This was a pet peeve where our playground could only compile top level
FunctionDeclarations. Just synthesize a fake identifier if it doesn't
have one.

ghstack-source-id: 882483c
Pull Request resolved: #30729
@poteto poteto deleted the gh/poteto/6/head branch August 16, 2024 22:12
): ReactFunctionType {
if (id && id.node && id.isIdentifier()) {
if (isHookName(id.node.name)) {
function getReactFunctionType(id: t.Identifier | null): ReactFunctionType {
Copy link
Contributor

@gsathya gsathya Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ArrowFunctionExpressions, we now incorrectly assume components to be of type 'Other' as they don't have an identifier. There are optimisations and assumptions that depend on getting this type correct, which cause incorrectly generated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants