Repository navigation
arguments.length counts an undefined given; optional to any is undefined when empty; yield* hands throw() to throw-only and parameter delegates (TSLANG 186) - #1024
Merged
Conversation
…alled through its base class, is a compile error (TSLANG 185) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a this-field of objects stays refused Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ned when empty; yield* hands throw() to throw-only and parameter delegates (TSLANG 186) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nto tslang-186 # Conflicts: # TSLANG_ISSUES.md # docs/whats-new.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TSLANG 186, stacked on #1023 (185). Will be retargeted to main once #1023 merges.
arguments.lengthofh(1, undefined)forh(a, b?)is 2, as in JavaScript (was 1). A function declaration whose body readsargumentsand has optional parameters (not a method, generic, exported, or with a rest parameter) gets a hidden trailing optional parameter.argc; a call by its name passes the count of its arguments (mlirGenCall). Called as a function value, the count is left out and worked out from the parameters as before. Capped at the parameter count.anythat holds nothing is boxed asundefined(an emptyb?: stringgiven toanycrashed where it was read); one holding a value is that value boxed. Previously only optionalanywas handled.yield*over a generator whose type hasthrowbut notreturn: the delegate is held for its throw(), and no return() is called that the type lacks.yield* itof a generator a parameter holds hands throw() to the delegate (numbers/booleans), with the thrown value exchanged out of the generator's field first.Still open (TSLANG_ISSUES.md 186):
argumentsof methods, generic functions, and calls through function values count anundefinedgiven as left out; own throw() at a yield* of strings/objects.Tests: cases added to
00arguments_length_given.ts; new00generator_yield_star_throw_only.tsand00generator_yield_star_throw_param.ts(gc, rc, own). Memory flat under rc/own (300k vs 3M calls). Full local suite: only the 10 known local failures.🤖 Generated with Claude Code