Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
49ce902
chore(quest): claim quest/m3/ts-iter-back-folds.md
kixelated Nov 2, 2026
539823c
feat(ts): translate rfold and try_rfold, and a crate's own folds, nth…
kixelated Nov 3, 2026
20a14e2
Merge remote-tracking branch 'origin/main' into quest/m3/ts-iter-back…
kixelated Nov 3, 2026
b46c2f8
style(ts): format
kixelated Nov 3, 2026
6428d1c
fix(ts): keep Poll verbatim in the census
kixelated Nov 3, 2026
61ea38d
docs(ts): note rt.iterFrom's Own record in MIGRATE
kixelated Nov 3, 2026
8505cee
fix(ts): lend a fold's closure to the crate's own fold, and refuse fo…
kixelated Nov 3, 2026
f718af8
fix(ts): check the closures in a crate's own fold, and refuse its dro…
kixelated Nov 3, 2026
87285d7
style(ts): format
kixelated Nov 3, 2026
6c6d137
fix(ts): refuse a crate's own fold that tells its accumulator or clos…
kixelated Nov 3, 2026
3d36f72
test(ts): refresh the reject census
kixelated Nov 3, 2026
18c1b43
Merge origin/main into quest/m3/ts-iter-back-folds
kixelated Nov 3, 2026
c38d566
chore(quest): claim quest/m3/ts-closure-calls.md
kixelated Nov 3, 2026
99d5613
Merge branch 'quest/m3/ts-iter-back-folds' into quest/m3/ts-closure-c…
kixelated Nov 3, 2026
c590947
feat(ts): translate try_fold, try_for_each, partition, scan, repeat_w…
kixelated Nov 3, 2026
85aa1aa
test(ts): scan of items whose None is rt.None, now translated, in lang
kixelated Nov 3, 2026
eae28f1
docs(ts): closure-taking calls std's mappings now cover
kixelated Nov 3, 2026
fff1ddb
fix(ts): pair sort_by_cached_key's keys with a usize, as std's does o…
kixelated Nov 3, 2026
4c5332e
test(ts): cases for repeat_with's hint, scan's dropping state, and th…
kixelated Nov 3, 2026
28042e3
Merge origin/main into quest/m3/ts-iter-back-folds
kixelated Nov 3, 2026
f0a5883
Merge quest/m3/ts-iter-back-folds into quest/m3/ts-closure-calls
kixelated Nov 3, 2026
f1e9b4c
fix(ts): read a boxed crate iterator by std's box, which forwards onl…
kixelated Nov 3, 2026
a9194ba
Merge origin/main into quest/m3/ts-iter-back-folds
kixelated Nov 3, 2026
f33e88c
Merge quest/m3/ts-iter-back-folds into quest/m3/ts-closure-calls
kixelated Nov 3, 2026
c064c0b
fix(ts): read a boxed iterator as std's box does, by next where it fo…
kixelated Nov 3, 2026
9f62071
Merge origin/main into quest/m3/ts-iter-back-folds
kixelated Nov 3, 2026
afe5a21
test(ts): dyns' borrowed boxes read as rt.iterBoxed
kixelated Nov 3, 2026
3ae727b
fix(ts): Cell::update calls its function on the value itself
kixelated Nov 3, 2026
9f0a80c
Merge origin/main into quest/m3/ts-iter-back-folds
kixelated Nov 3, 2026
d219b25
Merge quest/m3/ts-iter-back-folds into quest/m3/ts-closure-calls
kixelated Nov 3, 2026
aa6616e
test(ts): regenerate ends after merging #463's box reader
kixelated Nov 3, 2026
99af981
style(ts): format the closure-call cases
kixelated Nov 3, 2026
de8f40a
Merge base into pr-463, retaining both migration notes
Nov 3, 2026
627bc41
Merge origin/main into quest/m3/ts-iter-back-folds
kixelated Nov 3, 2026
7b6a5f2
Merge quest/m3/ts-iter-back-folds into quest/m3/ts-closure-calls
kixelated Nov 3, 2026
f2b3bf8
test(ts): regenerate ends after merging #463
kixelated Nov 3, 2026
ee18327
Merge origin/main into quest/m3/ts-closure-calls
kixelated Nov 3, 2026
242d714
Merge origin/main into quest/m3/ts-closure-calls
kixelated Nov 3, 2026
3b93c48
Merge base into PR 473, preserving both lending match additions
Nov 3, 2026
93536a5
Merge origin/main into quest/m3/ts-closure-calls
kixelated Nov 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ generic std gap is planned here even when moq never calls it.
- [Waiting: type-check in process with tsrs](/quest/m3/ts-tsrs.md) - rust2-ts checks bindings through tsrs instead of `tsc` once it is a stable library
- [Drop order in std's folds and iterators](/quest/m3/ts-drop-order.md) - the values that drop still refused in std's consumers and collects drop as std's do
- [A slice of one value behind any &mut](/quest/m3/ts-slice-of-one.md) - `slice::from_mut` and `array::from_mut` of a `&mut u8`, or of an object no place names, translate
- [std's calls of a closure that have no mapping](/quest/m3/ts-closure-calls.md) - `try_fold`, `partition`, `repeat_with`, `sort_by_cached_key`, and `LazyCell::new` translate, dropping what their closures own as std's do
- [A function pointer or a boxed closure as a string pattern](/quest/m3/ts-fn-patterns.md) - `s.split(p)` of a `fn(char) -> bool` or a `Box<dyn FnMut(char) -> bool>` translates, dropping a box it owns where std does
- [std's char methods that have no mapping](/quest/m3/ts-char-methods.md) - `is_alphabetic`, `to_lowercase`, `len_utf8`, the escapes, and the rest of `char` translate, called or as values, by std's Unicode version
- [Waiting: a slice object for a mutable part of other values](/quest/m3/ts-slice-object.md) - waits on a moq profile showing the `Proxy` view's traps matter, then decides on an `rt.ByteSlice`-like form
Expand Down
25 changes: 0 additions & 25 deletions quest/m3/ts-closure-calls.md

This file was deleted.

17 changes: 10 additions & 7 deletions ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ crate translation reaches is refused, and so are two versions of one crate it re
| a type's function | a function of the type's module, taking `self` first: `Decoder.slice(dec, 4)` after `import * as Decoder` |
| `Arc<T>`, `Rc<T>`, `Weak<T>`, `Mutex<T>` | `rt.Arc` for either, with its strong and weak counts, and `new_cyclic`'s `Weak` upgrading only once its value is made, `get_mut` lending its value only while no other `Arc` or `Weak` shares it, `make_mut` cloning it into a new `rt.Arc` while another `Arc` shares it, or moving it there while only `Weak`s do, which then dangle, and `into_inner` giving it only from the last strong `Arc`, after which its `Weak`s no longer upgrade; `rt.Weak`, counted in its `rt.Arc` until it drops, and of no `Arc` once made by `Weak::new`; `rt.Mutex`, its own guard, which a lock gives as `Ok` and the guard's drop unlocks: locking it again while held panics and `try_lock` gives `WouldBlock`, as wasm32's do, and a guard's `map` and `filter_map` make `rt.MutexMap`s, each where the part it lends is, which hold the mutex locked until they drop, and a panic aborts, so nothing poisons it and `thread::panicking` is `false`; a `Mutex`'s, a `RefCell`'s, and an `RwLock`'s `into_inner` gives its value and `get_mut` lends it, or an `rt.Place` of it where JS copies it |
| `PoisonError<T>`, `TryLockError<T>` | the `T` it holds; `rt.TryLockError<T>`, tagged as `Bound` is |
| `Cell<T>`, `UnsafeCell<T>`, `RefCell<T>`, `RwLock<T>` | `rt.Cell`, the place holding its value in `v`, for either of the first two: `UnsafeCell::get`'s pointer is the cell where it is an `rt.Place`, and otherwise the object in `v`, refused where the crate may put another cell or object in its place; `rt.RefCell` for either of the others, its own guard, counting its borrows: borrowing it while that conflicts panics as `RefCell`'s does, and locking it so aborts as wasm32's `RwLock` does; `try_borrow` and `try_borrow_mut` fail with `rt.BorrowError` and `rt.BorrowMutError` instead, a clone borrows the cell, `Ref::clone` counts another borrow of it, and a guard's `map`, `filter_map`, `try_map`, and `map_split`, an `RwLock` guard's included, make `rt.RefMap`s, each where a part it lends is, which a write through a mapped `RefMut` reaches in place, sharing the cell's borrow until the last drops; `RwLockWriteGuard::downgrade` keeps the lock as one read, and `Ref::leak` and `RefMut::leak` keep the borrow until `RefCell::undo_leak` ends it; refused for a part of a sized type JS can't write in place, such as a binding's |
| `Cell<T>`, `UnsafeCell<T>`, `RefCell<T>`, `RwLock<T>` | `rt.Cell`, the place holding its value in `v`, for either of the first two: `UnsafeCell::get`'s pointer is the cell where it is an `rt.Place`, and otherwise the object in `v`, refused where the crate may put another cell or object in its place; `rt.RefCell` for either of the others, its own guard, counting its borrows: borrowing it while that conflicts panics as `RefCell`'s does, and locking it so aborts as wasm32's `RwLock` does; `try_borrow` and `try_borrow_mut` fail with `rt.BorrowError` and `rt.BorrowMutError` instead, a clone borrows the cell, `Ref::clone` counts another borrow of it, and a guard's `map`, `filter_map`, `try_map`, and `map_split`, an `RwLock` guard's included, make `rt.RefMap`s, each where a part it lends is, which a write through a mapped `RefMut` reaches in place, sharing the cell's borrow until the last drops; `RwLockWriteGuard::downgrade` keeps the lock as one read, and `Ref::leak` and `RefMut::leak` keep the borrow until `RefCell::undo_leak` ends it; `Cell::update` calls its function on a copy, and `RefCell::replace_with` on the value, borrowed as `borrow_mut` does, or its place where JS copies it; refused for a part of a sized type JS can't write in place, such as a binding's |
| `thread_local!`, `LocalKey<T>` | an `rt.LocalKey`, a module's value, which makes its value on first use from the `const` or the expression and never drops it, as wasm32's do; `with` calls its function on that value, `try_with` never fails, the `Cell` and `RefCell` helpers lower from std, and a `RefCell` key's `set` and `with_borrow_mut` borrow it as `borrow_mut` does |
| `OnceCell<T>`, `OnceLock<T>` | `rt.OnceCell` and `rt.OnceLock`, holding the `Option<T>` in `v`, which is the place `get_mut` lends where JS copies the value; a `OnceLock` initialized from within its own initialization panics, as wasm32's does, and `get_or_try_init`'s error leaves either empty |
| `Once`, `OnceState` | `rt.Once`, an `rt.OnceLock` that holds `true` once `call_once` or `call_once_force` ran its function, and panics as wasm32's does if run again from within it; `rt.OnceState`, that `Once`, which a panic never poisons, as it aborts |
| `LazyCell<T>`, `LazyLock<T>` in a `static` or `const` | `rt.LazyCell` and `rt.LazyLock`, which run their function on the first `force` or `Deref`, once; forced from within it, either panics as std's does |
| `LazyCell<T>`, `LazyLock<T>` | `rt.LazyCell` and `rt.LazyLock`, which run their function on the first `force` or `Deref`, once, and drop it then, or with the cell if it never ran; forced from within it, either panics as std's does |
| `AtomicU32` and the others of `bool` and integers, `AtomicPtr<T>` | `rt.Atomic<T>`, the `rt.Place` of its value; an `atomic::Ordering` is its discriminant, and one an operation can't take panics as std's does. An `AtomicPtr` compares pointers only to what JS keeps as an object or bytes, as raw pointers do |
| `async fn` | a function returning `rt.Future<T>`: a class of its own, its coroutine's state machine |
| async closure | a closure returning the future of each call, with what makes the future of a call that consumes it if it owns a value that drops and `Fn` or `FnMut` call it |
Expand Down Expand Up @@ -463,8 +463,10 @@ map's `drain` does, drops those it still holds by `[Symbol.dispose]`, an adaptor
what it skips or rejects, and a consumer that takes an iterator by value drops it:
through each `rt.Iter`'s own `fold` where std's folds, which drops each adaptor's closure
as its fold ends, before what it wraps, as std's does. The crate's own `fold` is given that
closure as a `Box<dyn FnMut>`, which drops it where its body does. A `try_rfold` drops its
closure as it returns, leaving what the iterator holds to drop with it. A `Vec`'s `drain` leaves the vector
closure as a `Box<dyn FnMut>`, which drops it where its body does. `try_fold`, `try_rfold`,
and `try_for_each` drop their closure as they return, leaving what the iterator holds to drop
with it. `scan` hands its closure its state, or the state's place where JS copies it, and
drops the state after the closure, as std's fields drop. A `Vec`'s `drain` leaves the vector
what precedes its range until it drops, then drops what it still holds and moves the tail
back, so one never dropped, as `mem::forget` leaves it, leaks the rest, as std's does.

Expand Down Expand Up @@ -871,7 +873,8 @@ they need.
`Freeze` and `Copy`, so each calls the comparator in std's order and leaves equal
elements where std's does: JS's `sort` moves `undefined`, a `None`, to the end without
comparing it, and each engine orders its comparisons differently. A byte slice's sorts
by its own `Ord` are its typed array's, whose order nothing observes.
by its own `Ord` are its typed array's, whose order nothing observes. `sort_by_cached_key`
sorts its keys paired with their indexes by that `sort_unstable`.
- A `BinaryHeap` is std's heap in an array, with std's sifts ported to the runtime: std's
move elements through raw pointers into its `Vec`, which no body of std's lowers
through, and the sifts decide which `PartialOrd` tests run and which of equal elements
Expand Down Expand Up @@ -919,13 +922,13 @@ that drops given to a std function that keeps it other than in an iterator or a
`poll_fn`, or whose mapping doesn't drop it where std's does, and values that drop in some
iterators ([drop order](/quest/m3/ts-drop-order.md)), a `Cow` of other than `str` or a slice, a std
function without a mapping of its own that makes or reads an `Option` whose `None` is
`rt.None`, as `Iterator::scan` of `Option`s does, an `Option` of an `Option` of `()` or another
`rt.None`, an `Option` of an `Option` of `()` or another
`Option`, an instance of a generic type whose field is an `Option` of a type parameter
that can be `undefined`, a `String`'s `capacity`, looking up a key by
another type it borrows as through the crate's own `Borrow`, a `&mut` to a value JS
copies that std makes, other than a map's, or hands a closure, as `iter_mut` and
`and_modify` do, one into a `Result`'s payload passed on or kept, the adaptors
without a mapping in `src/lower/iter.rs` (such as `partition`), an
without a mapping in `src/lower/iter.rs` (such as nightly's `intersperse`), an
own `impl Iterator` or `DoubleEndedIterator` that overrides a provided method other than
those, such as `find` or `for_each`, or whose own `fold` or `rfold` tells its accumulator or
closure apart from another, by an `Option` or a `Poll` of it, a call or constant generic over it
Expand Down
8 changes: 8 additions & 0 deletions ts/fixtures/lang/ends/expected/core/bool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ export function thenSome$0d5am30(self: boolean, t: rt.u8): rt.u8 | undefined {
return t;
}

export function then$19svsql(self: boolean, f: () => undefined): undefined | rt.None {
if (!self) {
return rt.None;
}
f();
return undefined;
}

//# sourceMappingURL=bool.ts.map
Loading