Skip to content

own: no growth through a handle's payload (#982 regression in the library); optional interface member calls lend the object - #983

Merged
ASDAlexander77 merged 3 commits into
mainfrom
own-grow-shared
Nov 22, 2026
Merged

ASDAlexander77 merged 3 commits into
mainfrom
own-grow-shared

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Two -mm=own fixes the DefaultLib changes for TSLANG 153 needed.

A regression from #982: a[i] = v on an array reached through a handle's payload (s.value[i] = v) no longer grows the array under own. #982 made the write a grows-only SetLengthOf, and own's passes read that as a push into a Shared payload, which may move elements another handle's borrow reads (spec 23.3). So the library's TypedArray.set and MessageQueue.close (used by the workers) were taken for methods that release what their callers borrow. 8 DefaultLib tests stopped compiling under own:

  • array_toLocaleString
  • message_queue
  • typed_array_clamped
  • typed_array_float16
  • worker_echo, worker_errors, worker_objects, worker_terminate

The error was "a value that borrows 'this.elements' is used here after it may be released". The write is now as it was before #982. New test: 00array_write_shared.ts.

Calling an optional function-typed interface member: g.return(v) followed by g.next() was "'g' is used here after its value was moved" under own. The bound method value is wrapped in an optional, passed out of the If that tests the member (by then a branch's block argument), tested, and unwrapped for the call. All of that only calls it, so it now lends the object to the call, as a call of a non-optional member does (boundOnlyCalled). Storing the method value still moves the object, as before. The DefaultLib's Generator declares return? and throw? this way. They stay fields, not methods: a method member shifts the vtable, and a Generator could then no longer be cast to an Iterable. New test: 00interface_optional_member_call.ts; alpha133 fails it.

TSLANG 152 and 153 are updated.

Checked locally:

  • Full ctest: 8826 passed, 0 failed.
  • DefaultLib (TypeScriptCompilerDefaultLib branch generator-next-value) built with this compiler: every release test passes under gc, rc, none and own, compiled and JIT.

🤖 Generated with Claude Code

ASDAlexander77 and others added 3 commits November 21, 2026 22:50
…ad (library TypedArray.set, workers)

#982 made such a write a grows-only SetLengthOf, which own's passes read as a push into a
Shared payload - a possible release of what callers borrow - and 8 DefaultLib tests stopped
compiling under -mm=own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e object (g.return(v) then g.next())

The bound method value was wrapped in an optional, given out of the If that tests the
member (a branch's block argument by then), tested and unwrapped for the call; own read
that as moving the object into the method value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tor given to an Iterable as it is)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 3aa6cc6 into main Nov 22, 2026
8 checks passed
@ASDAlexander77
ASDAlexander77 deleted the own-grow-shared branch November 22, 2026 01:05
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