Skip to content

Conversation

mfazekas
Copy link
Contributor

@mfazekas mfazekas commented Sep 19, 2025

Summary:

Fixes: #53839

Codegen uses object propertyNames as variable names. This breaks if the same property names appears at multiple levels. Also breaks if a property is called payload as payload is a variable name already used.

Before the fix codegen could generate code like this:

payload.setProperty(runtime, "payload", payload);

Changelog:

[GENERAL] [FIXED] - Fix Codegen to use unique variable names to avoid name collisions in corner cases

Test Plan:

  • jest snapshot tests

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 19, 2025
@mfazekas mfazekas changed the title fix(codegen): use ${properyName}_${idx} pattern for naming variables to avoid using same variable for different properties fix(codegen): ensure unique c++ variable names to avoid collision for properties with the same name Sep 19, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Codegen variable naming can result in incorrect code
3 participants