Fix: experimentalDecorators renames class name in object literal key/member name positions#4650
Draft
RyanCavanaugh with Copilot wants to merge 2 commits into
Draft
Fix: experimentalDecorators renames class name in object literal key/member name positions#4650RyanCavanaugh with Copilot wants to merge 2 commits into
RyanCavanaugh with Copilot wants to merge 2 commits into
Conversation
…4632) Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix emitted class name with experimental decorators
Fix: experimentalDecorators renames class name in object literal key/member name positions
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
experimentalDecorators, the emitter incorrectly renamed identifiers matching the class name even in name positions (object literal keys, method shorthand names, field names) — which are not value references to the class and must not be substituted with the self-reference alias.Root cause
visitIdentifiercallsGetReferencedValueDeclaration, which falls through toResolveNamefor declaration/key positions (the checker doesn't cache symbols there). This finds the class by textual name lookup, causing false substitutions. The prior fix (#3147) coveredPropertyAccessExpression.namebut missed other name positions.Changes
visitPropertyAssignment(new): Added to the visit switch. Skips the property key identifier for non-computed keys; visits only the initializer (and computed key expression when present).visitPropertyNameOfClassElement: Non-computed member names are now returned as-is without callingVisitNode, preventingvisitIdentifierfrom substituting class member declaration names.hasInternalStaticReference: Added explicit switch cases forKindPropertyAssignment,KindPropertyDeclaration,KindMethodDeclaration,KindGetAccessor,KindSetAccessorthat skip declaration name children and only recurse into expression/initializer/body subtrees. No.Parentaccess (forbidden byforbidparentaccesslint rule in transformers).