From 05c861fad2bbecb242cf875d7b1141d66c617a7b Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 14:15:00 -0700 Subject: [PATCH 01/11] Add copilot-setup-steps --- .github/workflows/copilot-setup-steps.yml | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/copilot-setup-steps.yml diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000000..f0f769d4f1 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,26 @@ +name: 'Copilot Setup Steps' + +on: workflow_dispatch + +jobs: + # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + + # Set the permissions to the lowest permissions possible needed for your steps. + # Copilot will be given its own token for its operations. + permissions: + # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. + contents: read + + # You can define any steps you want, and they will run before the agent starts. + # If you do not check out your code, Copilot will do this for you. + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable + - uses: ./.github/actions/setup-go + with: + cache-name: copilot-setup-steps + - run: npm ci + - run: npx hereby build From 885beee9c7b0e49b01198590b238dcb6dbf7dd0b Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 14:51:06 -0700 Subject: [PATCH 02/11] Clone submodule --- .github/workflows/copilot-setup-steps.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index f0f769d4f1..485244d239 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -17,6 +17,8 @@ jobs: # If you do not check out your code, Copilot will do this for you. steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From 85627c807aabbbe52002fe3be6d57d04a67cf760 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 15:00:12 -0700 Subject: [PATCH 03/11] Fetch submodule history --- .github/workflows/copilot-setup-steps.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 485244d239..5a2c33f718 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -19,6 +19,8 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: submodules: true + - run: git fetch # default fetch depth for submodules is 2 + working-directory: _submodules/TypeScript - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From 8888e79ac0fcff1d4e6e5d93ab413de4d895b155 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 15:13:13 -0700 Subject: [PATCH 04/11] Fix unshallowing? --- .github/workflows/copilot-setup-steps.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 5a2c33f718..f3e0405000 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -19,8 +19,10 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: submodules: true - - run: git fetch # default fetch depth for submodules is 2 - working-directory: _submodules/TypeScript + - run: | + cd _submodules/TypeScript + git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" + git fetch --unshallow - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From 6f23361b17521c87f37dbe634b00dbbdc5fe3a66 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 15:23:30 -0700 Subject: [PATCH 05/11] Fetch only back as far as the PR could be --- .github/workflows/copilot-setup-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index f3e0405000..c1ecb609f2 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,7 +22,7 @@ jobs: - run: | cd _submodules/TypeScript git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - git fetch --unshallow + git fetch --depth 170 # git rev-list --count 0693cc7...746c232 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From 20e97c3df15ec731ec355ac8010455fa84f597aa Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 16:20:25 -0700 Subject: [PATCH 06/11] Try to shallow fetch better --- .github/workflows/copilot-setup-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index c1ecb609f2..892cacccf2 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,7 +22,7 @@ jobs: - run: | cd _submodules/TypeScript git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - git fetch --depth 170 # git rev-list --count 0693cc7...746c232 + git fetch --depth 170 HEAD # git rev-list --count 0693cc7...746c232 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From a897d9752588f116f93f90b61df3aa7ec061cc10 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 16:31:17 -0700 Subject: [PATCH 07/11] Fix git fetch syntax --- .github/workflows/copilot-setup-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 892cacccf2..994a2ed20f 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,7 +22,7 @@ jobs: - run: | cd _submodules/TypeScript git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - git fetch --depth 170 HEAD # git rev-list --count 0693cc7...746c232 + git fetch origin --depth 170 HEAD # git rev-list --count 0693cc7...746c232 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From dcf4c574bd7249618608ed22a925f3bd9cb5c6a4 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 17:01:44 -0700 Subject: [PATCH 08/11] Try one more fetch thing --- .github/workflows/copilot-setup-steps.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 994a2ed20f..9db251a984 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,7 +22,8 @@ jobs: - run: | cd _submodules/TypeScript git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - git fetch origin --depth 170 HEAD # git rev-list --count 0693cc7...746c232 + git fetch origin 0693cc7 + git fetch origin --shallow-exclude=0693cc7 746c232 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From 0747ab648c25991fb716cd42ee2e84ce0809f953 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 5 Jun 2025 17:06:33 -0700 Subject: [PATCH 09/11] Give up --- .github/workflows/copilot-setup-steps.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 9db251a984..10c63fc184 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,8 +22,7 @@ jobs: - run: | cd _submodules/TypeScript git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - git fetch origin 0693cc7 - git fetch origin --shallow-exclude=0693cc7 746c232 + git fetch origin --unshallow - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable - uses: ./.github/actions/setup-go From c4b9294ab1e9fc3df5d4279a79adf7cec2c992eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 00:07:57 +0000 Subject: [PATCH 10/11] Initial plan for issue From 770eac5cf5c1aeb577e53aa6cde29c182e103689 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 00:36:25 +0000 Subject: [PATCH 11/11] Port TypeScript PR #60195: Allow reusing type nodes that resolve to error types 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..96e15e9844 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 annotationType != nil && 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 b.tryReuseExistingTypeNodeHelper(existing) + } if annotationType != nil && b.typeNodeIsEquivalentToType(host, t, annotationType) && b.existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, t) { result := b.tryReuseExistingTypeNodeHelper(existing) if result != nil {