Skip to content

Complete port of TS PR #61668: revert #57403 remnants missing from Go port#2979

Merged
ahejlsberg merged 2 commits intomainfrom
copilot/compare-pr-61668-and-pr-1795
Mar 4, 2026
Merged

Complete port of TS PR #61668: revert #57403 remnants missing from Go port#2979
ahejlsberg merged 2 commits intomainfrom
copilot/compare-pr-61668-and-pr-1795

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

The Go port of TypeScript PR #61668 (PR #1795) only ported the new createOuterReturnMapper machinery but omitted the revert of TS PR #57403 that the original PR also performed. This leaves the Go checker with dead/conflicting code that was supposed to be removed.

Missing changes now ported

  • Remove isTupleOfSelf (inference.go): Discarded the early-exit for inferences of the form A → [A[0]]. The new createOuterReturnMapper approach handles circular inference prevention more generally.

  • Remove getImplementationSignature / SignatureKeyImplementation (checker.go): Eliminated the candidate-cloning path that was triggered when resolving a call from inside the called function's own body. No longer needed with the revised contextual type instantiation strategy.

  • Remove instantiateTypes wrapping around inferTypeArguments (checker.go, chooseOverload): Both the first-pass (nonFixingMapper) and second-pass (mapper) wrappings were TS PR #57403 additions and are now dropped, so inferTypeArguments results are used directly.

  • Remove inferenceContext parameter from isSignatureApplicable (checker.go): The parameter was only used to instantiate argument types via nonFixingMapper before assignability checks—another TS PR #57403 artifact. Simplified to always use the plain (possibly regularized) argument type.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…nSignature, and inferenceContext from isSignatureApplicable

Co-authored-by: ahejlsberg <4226954+ahejlsberg@users.noreply.github.com>
Copilot AI changed the title [WIP] Compare differences between TypeScript PR 61668 and typescript-go PR 1795 Complete port of TS PR #61668: revert #57403 remnants missing from Go port Mar 4, 2026
@ahejlsberg ahejlsberg marked this pull request as ready for review March 4, 2026 20:39
Copilot AI review requested due to automatic review settings March 4, 2026 20:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the Go port of TypeScript PR #61668 by including the missing “revert PR #57403” cleanups in the checker, removing now-obsolete inference and overload-resolution machinery that conflicts with the newer createOuterReturnMapper approach.

Changes:

  • Removes the isTupleOfSelf early-exit inference heuristic from inferFromTypes.
  • Removes the “implementation signature” cloning path (getImplementationSignature / SignatureKeyImplementation) used when resolving calls inside a function’s own body.
  • Simplifies overload applicability/type inference flow by dropping instantiateTypes(...) wrapping around inferTypeArguments(...), and removing the inferenceContext parameter from isSignatureApplicable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/checker/inference.go Removes isTupleOfSelf and its use in inference candidate handling.
internal/checker/checker.go Removes implementation-signature caching/cloning and simplifies overload applicability and inference plumbing to match upstream revert.

@ahejlsberg ahejlsberg requested a review from jakebailey March 4, 2026 21:10
@ahejlsberg
Copy link
Member

I have manually verified that this adds the missing parts of TS PR #61668.

@ahejlsberg ahejlsberg enabled auto-merge March 4, 2026 21:12
@ahejlsberg ahejlsberg added this pull request to the merge queue Mar 4, 2026
Merged via the queue into main with commit 7f8651c Mar 4, 2026
25 checks passed
@ahejlsberg ahejlsberg deleted the copilot/compare-pr-61668-and-pr-1795 branch March 4, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants