Skip to content

Fix crash in decorator metadata emit for decorated object literal members - #64633

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
Andarist:fix-decorator-metadata-object-literal-crash
Oct 6, 2026
Merged

Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
Andarist:fix-decorator-metadata-object-literal-crash

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

fixes crash reported here #64613 (comment)

Copilot AI balanced review requested due to automatic review settings October 5, 2026 08:20
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 5, 2026
@typescript-automation

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

tx.currentLexicalScope = node
}

func (tx *MetadataTransformer) visitObjectLiteralExpression(node *ast.Node) *ast.Node {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. test code is intentionally invalid but parsing-wise permitted, it only has grammar errors
  2. the transforms/emitting is traditionally OK with such inputs, doing its best to emit "something"

The fix here matches Strada conceptually. Strada passed down parent (also in the case of object literal expressions). This patch just reuses the neighboring pattern (the same thing as in visitClassExpression) for doing the equivalent here in Corsa

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new compiler test is missing required reference baselines.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes a decorator metadata emit crash involving decorated object literal members.

Changes:

  • Tracks object literals as metadata-transform parents.
  • Adds a compiler regression test.
File Description
metadata.go Prevents object members from being treated as class elements.
decoratorMetadataObjectLiteralMethodNoCrash.ts Covers top-level and class-nested object literals.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused parent-tracking fix addresses the reported nil dereference and includes comprehensive regression baselines.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Oct 6, 2026
Merged via the queue into microsoft:main with commit c3f14c2 Oct 6, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants