Skip to content

Tuple inference for (...args: A) => T with mixed parameter types; -mm=own throw() at a yield* reaches the delegate (TSLANG 184) - #1021

Merged
ASDAlexander77 merged 2 commits into
mainfrom
tslang-184
Nov 24, 2026
Merged

ASDAlexander77 merged 2 commits into
mainfrom
tslang-184

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

TSLANG 184, stacked on #1020 (183). Will be retargeted to main once #1020 merges.

  • A function whose parameters have different types given to (...args: A) => T (call2((a: number, b: string) => b + a, 1, "x")): A is inferred as the tuple [number, string] (tryInferFunction), the rest arguments are taken as that tuple instead of re-inferred as an array of their union, and an unnamed tuple extends an array whose element each element extends (extendsType). The adapters read parameters out of a rest tuple as out of a rest array. Works in every model for a function or arrow given directly.
  • -mm=own: throw() of a generator paused in yield* inner() is handed to the delegate's throw() for elements that own nothing (number, boolean), like own's return(). The delegate is exchanged into a local for the call and the thrown value out of the generator's field first. Memory flat at 300k vs 3M iterations.

Still open (TSLANG_ISSUES.md 184): own throw() at a yield* of strings/objects (throws at the yield as before); a delegate with throw but no return.

Tests: tuple cases added to 00generic_arrow_through_generic.ts (gc, rc); own legs added for 00generator_yield_star_throw.ts. Full local suite: only the 10 known local failures.

🤖 Generated with Claude Code

Base automatically changed from tslang-183 to main November 24, 2026 15:44
ASDAlexander77 and others added 2 commits November 24, 2026 15:44
…=own throw() at a yield* reaches the delegate (TSLANG 184)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a yield* is handed to the delegate there now)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 20893c6 into main Nov 24, 2026
8 checks passed
@ASDAlexander77
ASDAlexander77 deleted the tslang-184 branch November 24, 2026 16:29
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.

1 participant