Skip to content

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
ASDAlexander77 merged 4 commits into
mainfrom
tslang-186
Nov 24, 2026
Merged

ASDAlexander77 merged 4 commits into
mainfrom
tslang-186

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

TSLANG 186, stacked on #1023 (185). Will be retargeted to main once #1023 merges.

  • arguments.length of h(1, undefined) for h(a, b?) is 2, as in JavaScript (was 1). A function declaration whose body reads arguments and 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.
  • An optional value converted to any that holds nothing is boxed as undefined (an empty b?: string given to any crashed where it was read); one holding a value is that value boxed. Previously only optional any was handled.
  • yield* over a generator whose type has throw but not return: the delegate is held for its throw(), and no return() is called that the type lacks.
  • -mm=own: yield* it of 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): arguments of methods, generic functions, and calls through function values count an undefined given as left out; own throw() at a yield* of strings/objects.

Tests: cases added to 00arguments_length_given.ts; new 00generator_yield_star_throw_only.ts and 00generator_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

ASDAlexander77 and others added 3 commits November 24, 2026 16:47
…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>
Base automatically changed from tslang-185 to main November 24, 2026 17:53
…nto tslang-186

# Conflicts:
#	TSLANG_ISSUES.md
#	docs/whats-new.md
@ASDAlexander77
ASDAlexander77 merged commit e9b8c8c into main Nov 24, 2026
8 checks passed
@ASDAlexander77
ASDAlexander77 deleted the tslang-186 branch November 24, 2026 18:40
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