From 84de4c9477e92721c828027204373e8db9682a2a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Jun 2025 00:26:39 +0000 Subject: [PATCH 1/2] Initial plan for issue From fba53fed47ad75c455be05b7db5fb475683ec824 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Jun 2025 00:44:28 +0000 Subject: [PATCH 2/2] Changes before error encountered Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> --- internal/checker/nodebuilderimpl.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/checker/nodebuilderimpl.go b/internal/checker/nodebuilderimpl.go index 591489e55d..e3cba7bd7d 100644 --- a/internal/checker/nodebuilderimpl.go +++ b/internal/checker/nodebuilderimpl.go @@ -304,6 +304,12 @@ func (b *nodeBuilderImpl) tryReuseExistingNonParameterTypeNode(existing *ast.Typ if annotationType == nil { annotationType = b.getTypeFromTypeNode(existing, true) } + if b.ch.isErrorType(annotationType) { + // allow "reusing" type nodes that resolve to error types + // those can't truly be reused but it prevents cascading errors in isolatedDeclarations + // for source with errors there is no guarantee to emit correct code anyway + return existing + } if annotationType != nil && b.typeNodeIsEquivalentToType(host, t, annotationType) && b.existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, t) { result := b.tryReuseExistingTypeNodeHelper(existing) if result != nil {