From 4656101ee29fc0b2dc5752ec4b204494ee39d0af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Oct 2025 21:18:20 +0000 Subject: [PATCH 1/3] Initial plan From 9f25af2e5439cee6cd047dbd93eb765960aeef51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Oct 2025 21:38:09 +0000 Subject: [PATCH 2/3] Port PR#61261: Fixed accidentally reused comments between files in the emitter Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> --- internal/transformers/declarations/transform.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/transformers/declarations/transform.go b/internal/transformers/declarations/transform.go index 6217557d5f..ae259b41c7 100644 --- a/internal/transformers/declarations/transform.go +++ b/internal/transformers/declarations/transform.go @@ -571,13 +571,19 @@ func (tx *DeclarationTransformer) transformImportTypeNode(input *ast.ImportTypeN if !ast.IsLiteralImportTypeNode(input.AsNode()) { return input.AsNode() } + specifier := tx.rewriteModuleSpecifier(input.AsNode(), input.Argument.AsLiteralTypeNode().Literal) + var argument *ast.Node + if specifier == input.Argument.AsLiteralTypeNode().Literal { + // No change to the specifier, reuse the original argument to avoid creating new nodes + argument = input.Argument + } else { + // Specifier changed, create a new literal type node + argument = tx.Factory().NewLiteralTypeNode(specifier) + } return tx.Factory().UpdateImportTypeNode( input, input.IsTypeOf, - tx.Factory().UpdateLiteralTypeNode( - input.Argument.AsLiteralTypeNode(), - tx.rewriteModuleSpecifier(input.AsNode(), input.Argument.AsLiteralTypeNode().Literal), - ), + argument, input.Attributes, input.Qualifier, tx.Visitor().VisitNodes(input.TypeArguments), From cb825fdd85e253a258a012a3fc27d1fb021cc51d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 9 Oct 2025 21:41:05 +0000 Subject: [PATCH 3/3] Add clarifying comment about pointer comparison in transformImportTypeNode Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> --- internal/transformers/declarations/transform.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/transformers/declarations/transform.go b/internal/transformers/declarations/transform.go index ae259b41c7..ef30f95549 100644 --- a/internal/transformers/declarations/transform.go +++ b/internal/transformers/declarations/transform.go @@ -573,6 +573,8 @@ func (tx *DeclarationTransformer) transformImportTypeNode(input *ast.ImportTypeN } specifier := tx.rewriteModuleSpecifier(input.AsNode(), input.Argument.AsLiteralTypeNode().Literal) var argument *ast.Node + // Use pointer equality to check if the specifier changed - rewriteModuleSpecifier + // returns the same node instance when no rewriting is needed if specifier == input.Argument.AsLiteralTypeNode().Literal { // No change to the specifier, reuse the original argument to avoid creating new nodes argument = input.Argument