Skip to content

fix: preserve non-null assertion dependencies in compiler#36709

Open
scarab-systems wants to merge 1 commit into
facebook:mainfrom
scarab-systems:test/react-33054-rerun-20260607
Open

fix: preserve non-null assertion dependencies in compiler#36709
scarab-systems wants to merge 1 commit into
facebook:mainfrom
scarab-systems:test/react-33054-rerun-20260607

Conversation

@scarab-systems
Copy link
Copy Markdown

Summary

Fixes #33054.

React Compiler preserves TypeScript non-null expressions through HIR/codegen, but non-null assertions still needed dependency/effect handling so property reads inside callbacks are not evaluated during render.

This updates the non-null expression handling so it is treated as an assign-through value for mutation/aliasing effects, and adds regression coverage for a non-null assertion inside an event handler.

How did you test this change?

  • yarn prettier-check
  • yarn linc
  • yarn flow dom-node
  • cd compiler && yarn snap:build
  • cd compiler && yarn snap -p non-null-assertion-event-handler
  • cd compiler && yarn snap -p non-null-expression
  • cd compiler && yarn snap -p non-null-assertion

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Jun 7, 2026

Hi @scarab-systems!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label Jun 7, 2026
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Jun 7, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@vishnuvardhan43-tech
Copy link
Copy Markdown

🤖 AI Code Review

Overall Score: 0.0/10

AI review generation failed. Failed to parse AI response: Unexpected character ('/' (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 3, column: 23]

⚠️ Concerns

  • AI review could not be completed

🤖 This review was generated by AI Code Review Assistant using local inference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler Bug]: non-null assertion on objects produces non working js

2 participants