diff --git a/quest/m3/README.md b/quest/m3/README.md index 48c107267..a42ead5fb 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -28,13 +28,13 @@ generic std gap is planned here even when moq never calls it. - [Drop order in std's folds and iterators](/quest/m3/ts-drop-order.md) - the values that drop still refused in std's folds, zips, flattens, and collects drop as std's do - [Set operations](/quest/m3/ts-set-ops.md) - `union`, `intersection`, `difference`, and `symmetric_difference` of hash and B-tree sets translate - [References to byte arrays std takes](/quest/m3/ts-byte-refs-taken.md) - `extend` by references to arrays, adaptors' closures over held arrays, and a collection of both forms translate -- [A closure's () result as a value](/quest/m3/ts-unit-closures.md) - a closure returning `()` whose result is a value, as in a `Vec<()>` collected from `map`, type-checks - [std accessors with no mapping](/quest/m3/ts-unmapped-accessors.md) - `VecDeque::swap_remove_*`, `HashSet::replace`, `BTreeSet::get`, `take`, and `replace`, `Vec::pop_if`, and `Arc` and `Rc::into_inner` translate - [Equality of std containers of unlike elements](/quest/m3/ts-eq-unlike.md) - `==` and `next_if_eq` of a `Vec` against a `&[Right]`, and of `VecDeque` against `Vec`, translate - [Integers' little- and native-endian bytes](/quest/m3/ts-int-ne-bytes.md) - each integer's `from_le_bytes`, `to_ne_bytes`, and `from_ne_bytes` translate - [mul_add rounded once](/quest/m3/ts-mul-add.md) - `f64::mul_add` and `f32::mul_add` translate, rounding once as std's fused multiply-add does - [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 - [Port the workflow guard to kixelated/quest](/quest/m3/quest-workflow-guard.md) - quest's environment guard parses YAML as this repository's does +- [A VecDeque's Debug](/quest/m3/ts-deque-debug.md) - `{:?}` of a `VecDeque` translates, writing std's list - [A parameter read only where lowering leaves nothing](/quest/m3/ts-unread-params.md) - an instance whose lowering drops every read of a parameter marks it unused, so `tsc` accepts it - [Zero-sized values made out of sight](/quest/m3/ts-zero-sized.md) - unit structs and empty arrays returned, and std adaptors of only zero-sized fields, translate - [Array keys a collection holds](/quest/m3/ts-array-keys.md) - collections of `[T; N]` keys type-check diff --git a/quest/m3/ts-deque-debug.md b/quest/m3/ts-deque-debug.md new file mode 100644 index 000000000..b3d5ad6c6 --- /dev/null +++ b/quest/m3/ts-deque-debug.md @@ -0,0 +1,15 @@ +# [XS] A VecDeque's Debug + +## Goal + +[rust2-ts](/ts/README.md) translates `{:?}` of a `VecDeque`, writing the same text as +std's list, proven by a differential test against native Rust. + +## Plan + +Found by [#303](https://github.com/moq-dev/rust2/pull/303): `format!("{q:?}")` of a +`VecDeque<()>` refuses with `unsupported call to as Debug>::fmt`, for any +`T`. `fmt.rs` maps `Vec`'s and `BinaryHeap`'s `Debug` to `rt.list`; a deque needs its +elements in order from its head, as its iterator reads them. + +Public API: the translator's output. diff --git a/quest/m3/ts-unit-closures.md b/quest/m3/ts-unit-closures.md deleted file mode 100644 index 730bd8527..000000000 --- a/quest/m3/ts-unit-closures.md +++ /dev/null @@ -1,26 +0,0 @@ -# [S] A closure's () result as a value - -## Goal - -A closure returning `()` whose result is a value, such as the items of -`data.iter().map(|_| ()).collect::>()`, translates to TypeScript that `tsc` -accepts, proven by a differential test against native Rust. - -## Plan - -Reproduced on `dadd60a9`: with the result bound and read twice, the lowering is -`const units: undefined[] = rt.iterToArray(rt.iterMap(..., (_2: rt.u8): void => {}))`, -which `tsc` refuses: `Type 'void[]' is not assignable to type 'undefined[]'`. `fn_ty` -and `ret_ty` in `ts/src/lower/mod.rs` type every `()` return as `void`, so `iterMap` -infers its item as `void`. - -Recommended: type a closure's `()` return as `undefined`, which the dev shell's `tsc` -(7.0) accepts on a function with no `return`, and which still satisfies a parameter -typed `=> void`. Keep `void` elsewhere, where only the effect is read, to avoid -churning every function's output. Cover `Vec<()>`, `VecDeque<()>`, and an `Option<()>` -a closure returns, in the lang fixture's `nested`. - -Found by [#292](https://github.com/moq-dev/rust2/pull/292), whose fixture builds its -units with `vec![(); n]` to avoid this. - -Public API: the translator's output. diff --git a/quest/m3/ts-unread-params.md b/quest/m3/ts-unread-params.md index 616b55368..3ec0ede84 100644 --- a/quest/m3/ts-unread-params.md +++ b/quest/m3/ts-unread-params.md @@ -15,4 +15,9 @@ nothing to drop the `if` lowers to nothing. `analyze` in `ts/src/lower/mir/mod.r parameters by MIR's reads, before lowering drops the empty branch. moq's collector drops, so no consumer hits it at the pin. +[#303](https://github.com/moq-dev/rust2/pull/303) found another: comparing `()`s folds to +`true`, so `units.iter().filter(|u| **u == ())` lowers to +`(u: undefined): boolean => { return true; }`, which `tsc` refuses as `'u' is declared but +its value is never read`. + Public API: the translator's output. diff --git a/quest/m3/ts-zero-sized.md b/quest/m3/ts-zero-sized.md index e19587303..46825ba8c 100644 --- a/quest/m3/ts-zero-sized.md +++ b/quest/m3/ts-zero-sized.md @@ -11,8 +11,8 @@ zero-sized fields, as `iter::from_fn` of a closure capturing nothing is. Found by `hints.rs` in the lang fixture. The first emits `return _0` of a return place `unassigned` skips, which `tsc` rejects, and the second refuses as "constructing -`std::iter::FromFn<..>` from another crate". Once they translate, along with -[ts-unit-closures](/quest/m3/ts-unit-closures.md), `hints::reserves` covers a `Vec` of +`std::iter::FromFn<..>` from another crate". Once they translate (a closure's `()` result +already does, since [#303](https://github.com/moq-dev/rust2/pull/303)), `hints::reserves` covers a `Vec` of zero-sized elements, which holds `usize::MAX`, and `hints::hints` a flatten of `[T; 0]`. Public API: the translator's output. diff --git a/ts/MIGRATE.md b/ts/MIGRATE.md index f7a0ab1f9..704b7a474 100644 --- a/ts/MIGRATE.md +++ b/ts/MIGRATE.md @@ -2,6 +2,9 @@ ## Unreleased +- A closure, a `fn` pointer, a `dyn Fn`, or a function item as a value returns + `undefined` for `()`, not `void`, as in `(a0: rt.u8) => undefined`: a caller passes such + a parameter a function typed `=> undefined`. - An instance of a generic std function, such as `core/option.ts`'s, is named for a hash of its text, `map$1cf8u0y`, rather than for its type arguments and the closure of one of the instances merged into it, `map$Option_u64_u64_rescale_closure0`. A caller that diff --git a/ts/README.md b/ts/README.md index afadb6d6f..97c344d62 100644 --- a/ts/README.md +++ b/ts/README.md @@ -103,6 +103,7 @@ crate translation reaches is refused, and so are two versions of one crate it re | `Ordering`, `DefaultHasher`, `RandomState` | `rt.Ordering`, which is `-1`, `0`, or `1`; `rt.Hasher`; `rt.RandomState`, the keys of the `DefaultHasher` it builds, never changed once made | | `Duration` | `rt.Duration`: `{ secs, nanos }`, std's whole seconds as an `rt.u64` and the nanoseconds past them, never changed once made | | closure | an arrow function, with `[Symbol.dispose]` if it owns a value that drops | +| `fn` pointer, function item as a value | the function, as a closure is typed: a `()` result is `undefined`, where a declared function returns `void` | | `&dyn Trait`, `&mut dyn Trait`, `Box`, `Arc` | an object with the trait's methods, its supertraits' included: `shape.area$Shape()`; behind an `Arc`, an `rt.ArcDyn` sharing the count of the `Arc` it was made from | | `dyn Any` | an instance of the class its value's type was wrapped in, which a downcast checks for: `a instanceof Any.Square ? a.v : undefined` | | `dyn Fn`, `dyn FnMut`, `dyn FnOnce` | the closure or function it was made of: `(a0: rt.u8) => rt.u32` | diff --git a/ts/fixtures/bind/expected/harness.ts b/ts/fixtures/bind/expected/harness.ts index f73fad43b..acfa6aa8a 100644 --- a/ts/fixtures/bind/expected/harness.ts +++ b/ts/fixtures/bind/expected/harness.ts @@ -84,8 +84,8 @@ export function run(input: rt.ByteSlice): rt.ByteVec { export function keys(input: rt.ByteSlice, bytes: Blob.Blob, out: rt.ByteVec): void { let _12!: rt.usize; let _143!: rt.u8; - const seen: rt.HashSet = rt.hashNew(rt.hashing(Blob.hash$Hash, Blob.eq$PartialEq, true)) as rt.HashSet; - const counts: rt.HashMap = rt.hashNew(rt.hashing(Blob.hash$Hash, Blob.eq$PartialEq, true)) as rt.HashMap; + const seen: rt.HashSet = rt.hashNew(rt.hashing(Blob.hash$Hash as (a0: Blob.Blob, a1: rt.Hasher) => undefined, Blob.eq$PartialEq, true)) as rt.HashSet; + const counts: rt.HashMap = rt.hashNew(rt.hashing(Blob.hash$Hash as (a0: Blob.Blob, a1: rt.Hasher) => undefined, Blob.eq$PartialEq, true)) as rt.HashMap; const sorted: rt.BTreeSet = rt.btreeNew(Blob.cmp$Ord) as rt.BTreeSet; const firsts: rt.BTreeMap = rt.btreeNew(Blob.cmp$Ord) as rt.BTreeMap; const _10: rt.usize = Blob.len(bytes); @@ -125,8 +125,8 @@ export function keys(input: rt.ByteSlice, bytes: Blob.Blob, out: rt.ByteVec): vo rt.byteVecPush(out, rt.hashDelete(seen, probe) ? 1 : 0); rt.byteVecPush(out, rt.btreeDelete(sorted, probe) ? 1 : 0); rt.byteVecPush(out, rt.hashLen(seen) & 0xff); - const nibbles: rt.HashSet = rt.hashNew(rt.hashing(Nibble.hash$Hash, Nibble.eq$PartialEq, true)) as rt.HashSet; - const lasts: rt.HashMap = rt.hashNew(rt.hashing(Nibble.hash$Hash, Nibble.eq$PartialEq, true)) as rt.HashMap; + const nibbles: rt.HashSet = rt.hashNew(rt.hashing(Nibble.hash$Hash as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq, true)) as rt.HashSet; + const lasts: rt.HashMap = rt.hashNew(rt.hashing(Nibble.hash$Hash as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq, true)) as rt.HashMap; const ordered: rt.BTreeSet = rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet; const values: rt.BTreeMap = rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeMap; for (const byte of rt.byteSliceView(input)) { diff --git a/ts/fixtures/codec/expected/coding/decode.Decoder.ts b/ts/fixtures/codec/expected/coding/decode.Decoder.ts index 305bd5dfb..a68e58405 100644 --- a/ts/fixtures/codec/expected/coding/decode.Decoder.ts +++ b/ts/fixtures/codec/expected/coding/decode.Decoder.ts @@ -4,7 +4,7 @@ import * as rt from "../rt.ts"; import * as DecodeError from "../coding/decode.DecodeError.ts"; import { read } from "../coding/varint.ts"; import type * as Form from "../coding/varint.Form.ts"; -import { mapErr$06mnjtr, inspectErr$0f2ndta } from "../core/result.ts"; +import { mapErr$06mnjtr, inspectErr$156koiv } from "../core/result.ts"; import type * as Control from "../stats.Control.ts"; /** @@ -158,7 +158,7 @@ export function bytes(self: Decoder): rt.Result { + return inspectErr$156koiv(slice(self, _3.value), (_22: DecodeError.DecodeError): undefined => { self.buf = start; }); } diff --git a/ts/fixtures/codec/expected/core/result.ts b/ts/fixtures/codec/expected/core/result.ts index 700d81936..7df0be5cd 100644 --- a/ts/fixtures/codec/expected/core/result.ts +++ b/ts/fixtures/codec/expected/core/result.ts @@ -34,7 +34,7 @@ export function mapErr$06mnjtr(self: rt.Result, op return rt.Err(op(self.error)); } -export function inspectErr$0f2ndta(self: rt.Result, f: (a0: DecodeError.DecodeError) => void): rt.Result { +export function inspectErr$156koiv(self: rt.Result, f: (a0: DecodeError.DecodeError) => undefined): rt.Result { if (!self.ok) { f(self.error); } diff --git a/ts/fixtures/codec/expected/harness.ts b/ts/fixtures/codec/expected/harness.ts index abf95018f..894670e97 100644 --- a/ts/fixtures/codec/expected/harness.ts +++ b/ts/fixtures/codec/expected/harness.ts @@ -20,8 +20,8 @@ import type * as Version from "./lite/version.Version.ts"; * Each case, which the first byte picks modulo their count, so a case added at the end * moves no other. */ -export function cases(): Array<(a0: rt.ByteSlice, a1: rt.ByteVec) => void> { - return [decodeScript, encodeScript, zigzag, sizes, roundtrip$Versions, roundtripLite$Group, roundtripLite$Probe, encodeMessages, errors]; +export function cases(): Array<(a0: rt.ByteSlice, a1: rt.ByteVec) => undefined> { + return [decodeScript as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, encodeScript as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, zigzag as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, sizes as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, roundtrip$Versions as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, roundtripLite$Group as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, roundtripLite$Probe as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, encodeMessages as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, errors as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined]; } /** Run one case. */ @@ -29,7 +29,7 @@ export function run(input: rt.ByteSlice): rt.ByteVec { const out: rt.ByteVec = new rt.ByteVec(); if (input.length !== 0) { const op: rt.u8 = input.data[input.start]; - const cases_: Array<(a0: rt.ByteSlice, a1: rt.ByteVec) => void> = cases(); + const cases_: Array<(a0: rt.ByteSlice, a1: rt.ByteVec) => undefined> = cases(); cases_[rt.idx(cases_, rt.usizeRem(op as rt.usize, cases_.length))](new rt.ByteSlice(input.data, input.start + 1, input.length - 1), out); return out; } diff --git a/ts/fixtures/lang/expected/bounds.ts b/ts/fixtures/lang/expected/bounds.ts index 411fee8bd..7755943d1 100644 --- a/ts/fixtures/lang/expected/bounds.ts +++ b/ts/fixtures/lang/expected/bounds.ts @@ -13,14 +13,14 @@ export function LOG$init(): rt.RefCell { } export function log(entry: rt.u8): void { - rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): undefined => { rt.byteVecPush(log_, entry); }); } /** Puts what was logged since the last flush. */ export function flush(out: rt.ByteVec): void { - rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): undefined => { rt.byteVecExtendFromSlice(out, rt.byteVecSlice(log_)); rt.byteVecClear(log_); }); @@ -115,8 +115,8 @@ export function within$Bound_u8_Bound_u8(set: rt.BTreeSet, range: [rt.Ran * kinds of the range's bounds, the next two their values, and the rest are the items. */ export function bounds(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - rt.localKeyWithBorrowMut(LOG, (a0: rt.ByteVec): void => { - return rt.byteVecClear(a0); + rt.localKeyWithBorrowMut(LOG, (a0: rt.ByteVec): undefined => { + rt.byteVecClear(a0); }); if (data.length >= 4) { const s: rt.u8 = data.data[data.start]; diff --git a/ts/fixtures/lang/expected/captures.ts b/ts/fixtures/lang/expected/captures.ts index 9543627de..515f013a5 100644 --- a/ts/fixtures/lang/expected/captures.ts +++ b/ts/fixtures/lang/expected/captures.ts @@ -21,7 +21,7 @@ export function u8s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.u8 = ([rt.u8FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.u8, rt.ByteSlice])[0]; - const put: (a0: rt.u8) => void = (v: rt.u8): void => { + const put: (a0: rt.u8) => undefined = (v: rt.u8): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u8ToBeBytes(v))); }; let n3: rt.u8 = a; @@ -122,7 +122,7 @@ export function u16s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.u16 = ([rt.u16FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.u16, rt.ByteSlice])[0]; - const put: (a0: rt.u16) => void = (v: rt.u16): void => { + const put: (a0: rt.u16) => undefined = (v: rt.u16): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u16ToBeBytes(v))); }; let n3: rt.u16 = a; @@ -223,7 +223,7 @@ export function u32s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.u32 = ([rt.u32FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.u32, rt.ByteSlice])[0]; - const put: (a0: rt.u32) => void = (v: rt.u32): void => { + const put: (a0: rt.u32) => undefined = (v: rt.u32): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u32ToBeBytes(v))); }; let n3: rt.u32 = a; @@ -324,7 +324,7 @@ export function u64s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.u64 = ([rt.u64FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.u64, rt.ByteSlice])[0]; - const put: (a0: rt.u64) => void = (v: rt.u64): void => { + const put: (a0: rt.u64) => undefined = (v: rt.u64): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u64ToBeBytes(v))); }; let n3: rt.u64 = a; @@ -425,7 +425,7 @@ export function u128s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.u128 = ([rt.u128FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.u128, rt.ByteSlice])[0]; - const put: (a0: rt.u128) => void = (v: rt.u128): void => { + const put: (a0: rt.u128) => undefined = (v: rt.u128): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u128ToBeBytes(v))); }; let n3: rt.u128 = a; @@ -526,7 +526,7 @@ export function usizes(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.usize = ([rt.usizeFromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.usize, rt.ByteSlice])[0]; - const put: (a0: rt.usize) => void = (v: rt.usize): void => { + const put: (a0: rt.usize) => undefined = (v: rt.usize): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.usizeToBeBytes(v))); }; let n3: rt.usize = a; @@ -620,7 +620,7 @@ export function i8s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.i8 = ([rt.i8FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.i8, rt.ByteSlice])[0]; - const put: (a0: rt.i8) => void = (v: rt.i8): void => { + const put: (a0: rt.i8) => undefined = (v: rt.i8): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.i8ToBeBytes(v))); }; let n3: rt.i8 = a; @@ -721,7 +721,7 @@ export function i16s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.i16 = ([rt.i16FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.i16, rt.ByteSlice])[0]; - const put: (a0: rt.i16) => void = (v: rt.i16): void => { + const put: (a0: rt.i16) => undefined = (v: rt.i16): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.i16ToBeBytes(v))); }; let n3: rt.i16 = a; @@ -822,7 +822,7 @@ export function i32s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.i32 = ([rt.i32FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.i32, rt.ByteSlice])[0]; - const put: (a0: rt.i32) => void = (v: rt.i32): void => { + const put: (a0: rt.i32) => undefined = (v: rt.i32): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.i32ToBeBytes(v))); }; let n3: rt.i32 = a; @@ -923,7 +923,7 @@ export function i64s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.i64 = ([rt.i64FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.i64, rt.ByteSlice])[0]; - const put: (a0: rt.i64) => void = (v: rt.i64): void => { + const put: (a0: rt.i64) => undefined = (v: rt.i64): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.i64ToBeBytes(v))); }; let n3: rt.i64 = a; @@ -1024,7 +1024,7 @@ export function i128s(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.i128 = ([rt.i128FromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.i128, rt.ByteSlice])[0]; - const put: (a0: rt.i128) => void = (v: rt.i128): void => { + const put: (a0: rt.i128) => undefined = (v: rt.i128): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.i128ToBeBytes(v))); }; let n3: rt.i128 = a; @@ -1125,7 +1125,7 @@ export function isizes(data: rt.ByteSlice, out: rt.ByteVec): void { const n2: rt.usize = rt.min(_20.length, rt.byteSliceFrom(buf2).length); rt.byteSliceCopyFromSlice(rt.byteSliceRange(rt.byteSliceFrom(buf2), 0, n2), rt.byteSliceRange(_20, 0, n2)); const b: rt.isize = ([rt.isizeFromBeBytes(buf2), rt.byteSliceRange(_20, n2)] as [rt.isize, rt.ByteSlice])[0]; - const put: (a0: rt.isize) => void = (v: rt.isize): void => { + const put: (a0: rt.isize) => undefined = (v: rt.isize): undefined => { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.isizeToBeBytes(v))); }; let n3: rt.isize = a; diff --git a/ts/fixtures/lang/expected/cells.ts b/ts/fixtures/lang/expected/cells.ts index cbb7c279d..765af876b 100644 --- a/ts/fixtures/lang/expected/cells.ts +++ b/ts/fixtures/lang/expected/cells.ts @@ -6,7 +6,7 @@ import { thenSome$0d5am30 } from "./core/bool.ts"; /** Steps of an operation and an operand on one cell, each putting what it read. */ export function cellOption(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => rt.u8 | undefined = maybe; - const put: (a0: rt.ByteVec, a1: rt.u8 | undefined) => void = putMaybe; + const put: (a0: rt.ByteVec, a1: rt.u8 | undefined) => undefined = putMaybe as (a0: rt.ByteVec, a1: rt.u8 | undefined) => undefined; let cell: rt.OnceCell = new rt.OnceCell(rt.None); let dataData: Uint8Array = data.data; let dataStart: number = data.start; @@ -106,7 +106,7 @@ export function cellString(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => string = (v3: rt.u8): string => { return rt.fmtToString((f: rt.Formatter) => rt.u8Display(v3, f)); }; - const put: (a0: rt.ByteVec, a1: string) => void = (out2: rt.ByteVec, t6: string): void => { + const put: (a0: rt.ByteVec, a1: string) => undefined = (out2: rt.ByteVec, t6: string): undefined => { rt.byteVecExtendFromSlice(out2, rt.stringAsBytes(t6)); }; let cell: rt.OnceCell = new rt.OnceCell(undefined); @@ -206,7 +206,7 @@ export function cellString(data: rt.ByteSlice, out: rt.ByteVec): void { /** Steps of an operation and an operand on one cell, each putting what it read. */ export function cellU64(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => rt.u64 = wide; - const put: (a0: rt.ByteVec, a1: rt.u64) => void = (out2: rt.ByteVec, t6: rt.u64): void => { + const put: (a0: rt.ByteVec, a1: rt.u64) => undefined = (out2: rt.ByteVec, t6: rt.u64): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u64ToBeBytes(t6))); }; let cell: rt.OnceCell = new rt.OnceCell(undefined); @@ -308,7 +308,7 @@ export function cellU8(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => rt.u8 = (v3: rt.u8): rt.u8 => { return v3; }; - const put: (a0: rt.ByteVec, a1: rt.u8) => void = (out2: rt.ByteVec, t6: rt.u8): void => { + const put: (a0: rt.ByteVec, a1: rt.u8) => undefined = (out2: rt.ByteVec, t6: rt.u8): undefined => { rt.byteVecPush(out2, t6); }; let cell: rt.OnceCell = new rt.OnceCell(undefined); @@ -407,8 +407,8 @@ export function cellU8(data: rt.ByteSlice, out: rt.ByteVec): void { /** Steps of an operation and an operand on one cell, each putting what it read. */ export function cellUnit(data: rt.ByteSlice, out: rt.ByteVec): void { - const make: (a0: rt.u8) => void = (_2: rt.u8): void => {}; - const put: (a0: rt.ByteVec, a1: undefined) => void = (out2: rt.ByteVec, _3: undefined): void => { + const make: (a0: rt.u8) => undefined = (_2: rt.u8): undefined => {}; + const put: (a0: rt.ByteVec, a1: undefined) => undefined = (out2: rt.ByteVec, _3: undefined): undefined => { rt.byteVecPush(out2, 170); }; let cell: rt.OnceCell = new rt.OnceCell(rt.None); @@ -445,14 +445,14 @@ export function cellUnit(data: rt.ByteSlice, out: rt.ByteVec): void { put(out, undefined); } } else if (_18 === 2) { - const _34: undefined = rt.onceGetOrInit(cell, (): void => { + const _34: undefined = rt.onceGetOrInit(cell, (): undefined => { make(v2); }, undefined, rt.None); put(out, _34); } else if (_18 === 3) { let seen: rt.u8 = 2; const _44: rt.OnceCell = cell; - const t: undefined = rt.onceGetOrInit(cell, (): void => { + const t: undefined = rt.onceGetOrInit(cell, (): undefined => { seen = _44.v !== rt.None ? 1 : 0; make(v2); }, undefined, rt.None); @@ -467,7 +467,7 @@ export function cellUnit(data: rt.ByteSlice, out: rt.ByteVec): void { } } else if (_18 === 5) { const _60: rt.OnceCell = cell; - const _57: undefined = rt.onceGetOrInit(cell, (): void => { + const _57: undefined = rt.onceGetOrInit(cell, (): undefined => { make(v2 ^ 1); rt.onceSet(_60, undefined, rt.None); make(v2); @@ -476,8 +476,8 @@ export function cellUnit(data: rt.ByteSlice, out: rt.ByteVec): void { } else if (_18 === 6) { const inner: rt.ByteVec = new rt.ByteVec(); const _69: rt.OnceCell = cell; - const t2: undefined = rt.onceGetOrInit(cell, (): void => { - put(inner, rt.onceGetOrInit(_69, (): void => { + const t2: undefined = rt.onceGetOrInit(cell, (): undefined => { + put(inner, rt.onceGetOrInit(_69, (): undefined => { make(v2 ^ 1); }, undefined, rt.None)); make(v2); @@ -485,7 +485,7 @@ export function cellUnit(data: rt.ByteSlice, out: rt.ByteVec): void { put(out, t2); rt.byteVecExtendFromSlice(out, rt.byteVecSlice(inner)); } else if (_18 === 7) { - const _76: undefined = rt.onceGetOrInit(cell, (): void => { + const _76: undefined = rt.onceGetOrInit(cell, (): undefined => { const args2: rt.Fmt[] = [(f: rt.Formatter) => rt.u8Display(v2, f)]; rt.panicFmt(["init ", args2[0]]); }, undefined, rt.None); @@ -506,14 +506,14 @@ export function cellUnit(data: rt.ByteSlice, out: rt.ByteVec): void { /** Steps on the cell and value type `kind` picks. */ export function cells(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const cases: Array<(a0: rt.ByteSlice, a1: rt.ByteVec) => void> = [cellU8, lockU8, cellU64, lockU64, cellOption, lockOption, cellUnit, lockUnit, cellString, lockString]; + const cases: Array<(a0: rt.ByteSlice, a1: rt.ByteVec) => undefined> = [cellU8 as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, lockU8 as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, cellU64 as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, lockU64 as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, cellOption as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, lockOption as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, cellUnit as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, lockUnit as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, cellString as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined, lockString as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined]; cases[rt.idx(cases, rt.usizeRem(kind as rt.usize, cases.length))](data, out); } /** Steps of an operation and an operand on one cell, each putting what it read. */ export function lockOption(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => rt.u8 | undefined = maybe; - const put: (a0: rt.ByteVec, a1: rt.u8 | undefined) => void = putMaybe; + const put: (a0: rt.ByteVec, a1: rt.u8 | undefined) => undefined = putMaybe as (a0: rt.ByteVec, a1: rt.u8 | undefined) => undefined; let cell: rt.OnceLock = new rt.OnceLock(rt.None); let dataData: Uint8Array = data.data; let dataStart: number = data.start; @@ -613,7 +613,7 @@ export function lockString(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => string = (v3: rt.u8): string => { return rt.fmtToString((f: rt.Formatter) => rt.u8Display(v3, f)); }; - const put: (a0: rt.ByteVec, a1: string) => void = (out2: rt.ByteVec, t6: string): void => { + const put: (a0: rt.ByteVec, a1: string) => undefined = (out2: rt.ByteVec, t6: string): undefined => { rt.byteVecExtendFromSlice(out2, rt.stringAsBytes(t6)); }; let cell: rt.OnceLock = new rt.OnceLock(undefined); @@ -713,7 +713,7 @@ export function lockString(data: rt.ByteSlice, out: rt.ByteVec): void { /** Steps of an operation and an operand on one cell, each putting what it read. */ export function lockU64(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => rt.u64 = wide; - const put: (a0: rt.ByteVec, a1: rt.u64) => void = (out2: rt.ByteVec, t6: rt.u64): void => { + const put: (a0: rt.ByteVec, a1: rt.u64) => undefined = (out2: rt.ByteVec, t6: rt.u64): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u64ToBeBytes(t6))); }; let cell: rt.OnceLock = new rt.OnceLock(undefined); @@ -815,7 +815,7 @@ export function lockU8(data: rt.ByteSlice, out: rt.ByteVec): void { const make: (a0: rt.u8) => rt.u8 = (v3: rt.u8): rt.u8 => { return v3; }; - const put: (a0: rt.ByteVec, a1: rt.u8) => void = (out2: rt.ByteVec, t6: rt.u8): void => { + const put: (a0: rt.ByteVec, a1: rt.u8) => undefined = (out2: rt.ByteVec, t6: rt.u8): undefined => { rt.byteVecPush(out2, t6); }; let cell: rt.OnceLock = new rt.OnceLock(undefined); @@ -914,8 +914,8 @@ export function lockU8(data: rt.ByteSlice, out: rt.ByteVec): void { /** Steps of an operation and an operand on one cell, each putting what it read. */ export function lockUnit(data: rt.ByteSlice, out: rt.ByteVec): void { - const make: (a0: rt.u8) => void = (_2: rt.u8): void => {}; - const put: (a0: rt.ByteVec, a1: undefined) => void = (out2: rt.ByteVec, _3: undefined): void => { + const make: (a0: rt.u8) => undefined = (_2: rt.u8): undefined => {}; + const put: (a0: rt.ByteVec, a1: undefined) => undefined = (out2: rt.ByteVec, _3: undefined): undefined => { rt.byteVecPush(out2, 170); }; let cell: rt.OnceLock = new rt.OnceLock(rt.None); @@ -952,14 +952,14 @@ export function lockUnit(data: rt.ByteSlice, out: rt.ByteVec): void { put(out, undefined); } } else if (_18 === 2) { - const _34: undefined = rt.onceGetOrInit(cell, (): void => { + const _34: undefined = rt.onceGetOrInit(cell, (): undefined => { make(v2); }, undefined, rt.None); put(out, _34); } else if (_18 === 3) { let seen: rt.u8 = 2; const _44: rt.OnceLock = cell; - const t: undefined = rt.onceGetOrInit(cell, (): void => { + const t: undefined = rt.onceGetOrInit(cell, (): undefined => { seen = _44.v !== rt.None ? 1 : 0; make(v2); }, undefined, rt.None); @@ -974,7 +974,7 @@ export function lockUnit(data: rt.ByteSlice, out: rt.ByteVec): void { } } else if (_18 === 5) { const _60: rt.OnceLock = cell; - const _57: undefined = rt.onceGetOrInit(cell, (): void => { + const _57: undefined = rt.onceGetOrInit(cell, (): undefined => { make(v2 ^ 1); rt.onceSet(_60, undefined, rt.None); make(v2); @@ -983,8 +983,8 @@ export function lockUnit(data: rt.ByteSlice, out: rt.ByteVec): void { } else if (_18 === 6) { const inner: rt.ByteVec = new rt.ByteVec(); const _69: rt.OnceLock = cell; - const t2: undefined = rt.onceGetOrInit(cell, (): void => { - put(inner, rt.onceGetOrInit(_69, (): void => { + const t2: undefined = rt.onceGetOrInit(cell, (): undefined => { + put(inner, rt.onceGetOrInit(_69, (): undefined => { make(v2 ^ 1); }, undefined, rt.None)); make(v2); @@ -992,7 +992,7 @@ export function lockUnit(data: rt.ByteSlice, out: rt.ByteVec): void { put(out, t2); rt.byteVecExtendFromSlice(out, rt.byteVecSlice(inner)); } else if (_18 === 7) { - const _76: undefined = rt.onceGetOrInit(cell, (): void => { + const _76: undefined = rt.onceGetOrInit(cell, (): undefined => { const args2: rt.Fmt[] = [(f: rt.Formatter) => rt.u8Display(v2, f)]; rt.panicFmt(["init ", args2[0]]); }, undefined, rt.None); diff --git a/ts/fixtures/lang/expected/collections.ts b/ts/fixtures/lang/expected/collections.ts index 2fb647c1c..ad019775f 100644 --- a/ts/fixtures/lang/expected/collections.ts +++ b/ts/fixtures/lang/expected/collections.ts @@ -149,9 +149,9 @@ export function hashMaps(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void rt.byteVecPush(out, rt.hashIndex(map2, _163)); } } else if (_4 === 2) { - const map3: rt.HashMap = rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashMap; - const pairs: rt.HashMap = rt.hashNew(rt.hashing(Pair.hash$Hash_DefaultHasher, Pair.eq$PartialEq)) as rt.HashMap; - const ranks: rt.HashMap = rt.hashNew(rt.hashing(Rank.hash$Hash_DefaultHasher, Rank.eq$PartialEq)) as rt.HashMap; + const map3: rt.HashMap = rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashMap; + const pairs: rt.HashMap = rt.hashNew(rt.hashing(Pair.hash$Hash_DefaultHasher as (a0: Pair.Pair, a1: rt.Hasher) => undefined, Pair.eq$PartialEq)) as rt.HashMap; + const ranks: rt.HashMap = rt.hashNew(rt.hashing(Rank.hash$Hash_DefaultHasher as (a0: Rank.Rank, a1: rt.Hasher) => undefined, Rank.eq$PartialEq)) as rt.HashMap; const tuples: rt.HashMap<[rt.u8, string], rt.u8> = rt.hashNew(rt.hashing(rt.hashTuple([rt.hash8, rt.hashStr]), rt.eqTuple([rt.same, rt.same]))) as rt.HashMap<[rt.u8, string], rt.u8>; let iterStart: rt.usize = 1; const iterEnd: rt.usize = data.length; @@ -237,7 +237,7 @@ export function hashMaps(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void const a2: rt.u8 = _306; const b4: rt.u8 = _305[1]; const _318: Rank.Rank = rank(b4, a2); - const t4: Tally.Tally = rt.entryOrInsertWith(rt.entryAndModify(rt.entry(ranks, _318), (t9: Tally.Tally): void => { + const t4: Tally.Tally = rt.entryOrInsertWith(rt.entryAndModify(rt.entry(ranks, _318), (t9: Tally.Tally): undefined => { t9.n = t9.n ^ 3; }), (): Tally.Tally => { return { n: b4 as rt.u16 }; @@ -382,7 +382,7 @@ export function hashMaps(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void return _2[1].length; }), rt.usizeAdd, 0) & 0xff); rt.byteVecPush(out, rt.hashLen(words) === 0 ? 1 : 0); - const clashes: rt.HashMap = rt.hashNew(rt.hashing(Clash.hash$Hash_DefaultHasher, Clash.eq$PartialEq)) as rt.HashMap; + const clashes: rt.HashMap = rt.hashNew(rt.hashing(Clash.hash$Hash_DefaultHasher as (a0: Clash.Clash, a1: rt.Hasher) => undefined, Clash.eq$PartialEq)) as rt.HashMap; const iter18: rt.Iter<[rt.usize, rt.u8]> = rt.iterEnumerate(rt.iterSlice(rt.byteSliceView(data))); while (true) { const _568: [rt.usize, rt.u8] | rt.Done = iter18.next(); @@ -499,7 +499,7 @@ export function sets(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { }), undefined, true); } else if (_4 === 1) { const nibbles: rt.BTreeSet = rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet; - const seen: rt.HashSet = rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet; + const seen: rt.HashSet = rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashSet; for (const b2 of rt.byteSliceView(data)) { rt.byteVecPush(out, rt.btreeAdd(nibbles, { _0: b2 }) ? 1 : 0); rt.byteVecPush(out, rt.hashAdd(seen, { _0: b2 }) ? 1 : 0); @@ -526,7 +526,7 @@ export function sets(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { } } rt.byteVecPush(out, rt.hashLen(seen) & 0xff); - const dirs: rt.HashSet = rt.hashNew(rt.hashing(Dir.hash$Hash_DefaultHasher, Dir.eq$PartialEq, true)) as rt.HashSet; + const dirs: rt.HashSet = rt.hashNew(rt.hashing(Dir.hash$Hash_DefaultHasher as (a0: Dir.Dir, a1: rt.Hasher) => undefined, Dir.eq$PartialEq, true)) as rt.HashSet; for (const _151 of rt.byteSliceView(data)) { const _160: rt.usize = rt.usizeRem(_151 as rt.usize, 3); if (!(_160 < 3)) { @@ -1430,7 +1430,7 @@ export function optional$Option_u8_HashMap_u8_Option_u8(map: rt.HashMap, data: rt.ByteSlice, value: (a0: rt.u8) => void, out: rt.ByteVec): void { +export function optional$unit_BTreeMap_u8_unit(map: rt.BTreeMap, data: rt.ByteSlice, value: (a0: rt.u8) => undefined, out: rt.ByteVec): void { let read!: string; for (const b of rt.byteSliceView(data)) { const k: rt.u8 = rt.u8Rem(b, 8); @@ -1471,7 +1471,7 @@ export function optional$unit_BTreeMap_u8_unit(map: rt.BTreeMap, data: rt.ByteSlice, value: (a0: rt.u8) => void, out: rt.ByteVec): void { +export function optional$unit_HashMap_u8_unit(map: rt.HashMap, data: rt.ByteSlice, value: (a0: rt.u8) => undefined, out: rt.ByteVec): void { let read!: string; for (const b of rt.byteSliceView(data)) { const k: rt.u8 = rt.u8Rem(b, 8); @@ -1535,9 +1535,9 @@ export function optionals(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi } else if (_4 === 1) { optional$Option_u8_BTreeMap_u8_Option_u8(made$BTreeMap_u8_Option_u8(), data, some, out); } else if (_4 === 2) { - optional$unit_HashMap_u8_unit(rt.hashNew() as rt.HashMap, data, (_22: rt.u8): void => {}, out); + optional$unit_HashMap_u8_unit(rt.hashNew() as rt.HashMap, data, (_22: rt.u8): undefined => {}, out); } else if (_4 === 3) { - optional$unit_BTreeMap_u8_unit(rt.btreeNew(rt.cmp) as rt.BTreeMap, data, (_2: rt.u8): void => {}, out); + optional$unit_BTreeMap_u8_unit(rt.btreeNew(rt.cmp) as rt.BTreeMap, data, (_2: rt.u8): undefined => {}, out); } else if (_4 === 4) { optional$Option_String_HashMap_u8_Option_String(made$HashMap_u8_Option_String(), data, (b2: rt.u8): string | undefined => { return map$0oc32h1(some(b2), (b3: rt.u8): string => { diff --git a/ts/fixtures/lang/expected/combinators.ts b/ts/fixtures/lang/expected/combinators.ts index 51031540a..9fcd34fe3 100644 --- a/ts/fixtures/lang/expected/combinators.ts +++ b/ts/fixtures/lang/expected/combinators.ts @@ -2,8 +2,8 @@ import * as rt from "./rt.ts"; import { copy$Result_u32s_u16, copy$u32s } from "./lib.ts"; -import { isSomeAnd$09tpccf, isNoneOr$1s1o3ss, unwrapOr$0r2bmpr, unwrapOrElse$1badkpb, unwrapOrElse$13moxzl, unwrapOrDefault$165pyh5, unwrapOrDefault$0wx44sw, unwrapOrDefault$1q0ps0j, map$0oc32h1, map$0ejznqm, map$0jg2jop, map$0cs071d, inspect$0sxbahk, mapOr$099335t, mapOr$1surhce, mapOr$0mmpeqx, mapOrElse$1g6d36t, okOr$07zal2e, okOr$0m6xlfp, okOr$1vxk0yk, okOrElse$0awp3vn, okOrElse$1v98j0a, and$06om98g, andThen$17ch833, filter$1855tjj, filter$0v80fk8, or$1loyskh, orElse$05gzawv, orElse$15bv4ho, xor$0kctyix, zip$1deudzj, clone$14nprly } from "./core/option.ts"; -import { isOkAnd$0jj0nkw, isErrAnd$0b01a39, ok$1c77lmd, err$05f656d, asRef$1glrxiq, map$1qqg34g, map$132mdj8, mapOr$1mu5bvh, mapOrElse$0jxx67n, mapErr$12w1s5x, mapErr$1lsqfgi, inspect$07pitc0, inspectErr$0vdsz1l, unwrapOrDefault$1exw7nd, and$0l7ltae, andThen$0hd6ik8, or$1xcfx3w, orElse$13ay4um, unwrapOr$0a4h2e7, unwrapOrElse$1reohq9, unwrapOrElse$009ibtw, copied$0ma6p21, clone$04fntvl } from "./core/result.ts"; +import { isSomeAnd$09tpccf, isNoneOr$1s1o3ss, unwrapOr$0r2bmpr, unwrapOrElse$1badkpb, unwrapOrElse$13moxzl, unwrapOrDefault$165pyh5, unwrapOrDefault$0wx44sw, unwrapOrDefault$1q0ps0j, map$0oc32h1, map$0ejznqm, map$0jg2jop, map$0cs071d, inspect$0di0vx1, mapOr$099335t, mapOr$1surhce, mapOr$0mmpeqx, mapOrElse$1g6d36t, okOr$07zal2e, okOr$0m6xlfp, okOr$1vxk0yk, okOrElse$0awp3vn, okOrElse$1v98j0a, and$06om98g, andThen$17ch833, filter$1855tjj, filter$0v80fk8, or$1loyskh, orElse$05gzawv, orElse$15bv4ho, xor$0kctyix, zip$1deudzj, clone$14nprly } from "./core/option.ts"; +import { isOkAnd$0jj0nkw, isErrAnd$0b01a39, ok$1c77lmd, err$05f656d, asRef$1glrxiq, map$1qqg34g, map$132mdj8, mapOr$1mu5bvh, mapOrElse$0jxx67n, mapErr$12w1s5x, mapErr$1lsqfgi, inspect$16o3gle, inspectErr$06tv5sa, unwrapOrDefault$1exw7nd, and$0l7ltae, andThen$0hd6ik8, or$1xcfx3w, orElse$13ay4um, unwrapOr$0a4h2e7, unwrapOrElse$1reohq9, unwrapOrElse$009ibtw, copied$0ma6p21, clone$04fntvl } from "./core/result.ts"; /** Run case `kind % 4` over `data`, whose bytes pick each `Some` or `None`, `Ok` or `Err`. */ export function combinators(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { @@ -67,7 +67,7 @@ export function options(a: rt.u8 | undefined, b: rt.u8 | undefined, limit: rt.u8 rt.byteVecPush(out, mapOr$0mmpeqx(zip$1deudzj(a, b), 0, (_2: [rt.u8, rt.u8]): rt.u8 => { return rt.u8WrappingAdd(_2[0], _2[1]); })); - rt.byteVecPush(out, inspect$0sxbahk(a, (x9: rt.u8): void => { + rt.byteVecPush(out, inspect$0di0vx1(a, (x9: rt.u8): undefined => { rt.byteVecPush(out, x9); }) !== undefined ? 1 : 0); push(map$132mdj8(okOrElse$1v98j0a(b, (): rt.u16 => { @@ -122,9 +122,9 @@ export function results(a: rt.u8 | undefined, b: rt.u8 | undefined, limit: rt.u8 rt.byteVecPush(out, unwrapOrElse$1reohq9(or$1xcfx3w(r, s), (e6: rt.u16): rt.u8 => { return e6 & 0xff; })); - rt.byteVecPush(out, inspectErr$0vdsz1l(inspect$07pitc0(s, (v4: rt.u8): void => { + rt.byteVecPush(out, inspectErr$06tv5sa(inspect$16o3gle(s, (v4: rt.u8): undefined => { rt.byteVecPush(out, v4); - }), (e7: rt.u16): void => { + }), (e7: rt.u16): undefined => { rt.byteVecPush(out, e7 & 0xff); }).ok ? 1 : 0); rt.byteVecPush(out, unwrapOr$0a4h2e7(copied$0ma6p21(mapErr$1lsqfgi(asRef$1glrxiq(r), (e8: rt.u16): rt.u16 => { diff --git a/ts/fixtures/lang/expected/core/option.ts b/ts/fixtures/lang/expected/core/option.ts index c95023403..a10d9d456 100644 --- a/ts/fixtures/lang/expected/core/option.ts +++ b/ts/fixtures/lang/expected/core/option.ts @@ -311,7 +311,7 @@ export function map$0jcaaxx(self: [rt.u8 | undefined, rt.u8] | undefined, f: (a0 return f(self); } -export function map$0ju5zoy(self: rt.Place | undefined, f: (a0: rt.Place) => void): undefined | rt.None { +export function map$1diqi3e(self: rt.Place | undefined, f: (a0: rt.Place) => undefined): undefined | rt.None { if (self === undefined) { return rt.None; } @@ -424,6 +424,14 @@ export function map$1k7m6zz(self: [rt.u8, rt.u8] | undefined, f: (a0: [rt.u8, rt return f(self); } +export function map$0p22lts(self: rt.u8 | undefined, f: (a0: rt.u8) => undefined): undefined | rt.None { + if (self === undefined) { + return rt.None; + } + f(self); + return undefined; +} + export function map$0c2keyb(self: rt.ByteSlice | undefined, f: (a0: rt.ByteSlice) => rt.u8): rt.u8 | undefined { if (self === undefined) { return undefined; @@ -452,7 +460,7 @@ export function map$0gl6wke(self: [rt.usize, string] | undefined, f: (a0: [rt.us return f(self); } -export function inspect$0sxbahk(self: rt.u8 | undefined, f: (a0: rt.u8) => void): rt.u8 | undefined { +export function inspect$0di0vx1(self: rt.u8 | undefined, f: (a0: rt.u8) => undefined): rt.u8 | undefined { if (self !== undefined) { f(self); } @@ -928,6 +936,13 @@ export function okOr$1vxk0yk(self: rt.u8 | undefined, err: rt.u8): rt.Result { + if (self === undefined) { + return rt.ERR; + } + return rt.Ok(self); +} + export function okOr$0q0ogpn(self: [rt.ByteSlice, rt.ByteSlice] | undefined, err: rt.u8 | undefined): rt.Result<[rt.ByteSlice, rt.ByteSlice], rt.u8 | undefined> { if (self === undefined) { return rt.Err(err); diff --git a/ts/fixtures/lang/expected/core/result.ts b/ts/fixtures/lang/expected/core/result.ts index 6930b9c03..bd84b2db7 100644 --- a/ts/fixtures/lang/expected/core/result.ts +++ b/ts/fixtures/lang/expected/core/result.ts @@ -403,6 +403,14 @@ export function map$132mdj8(self: rt.Result, op: (a0: rt.u8) => r return self; } +export function map$03hz3l7(self: rt.Result, op: (a0: rt.u8) => undefined): rt.Result { + if (self.ok) { + op(self.value); + return rt.OK; + } + return self as rt.Result; +} + export function mapOr$1mu5bvh(self: rt.Result, default_: rt.u8, f: (a0: rt.u8) => rt.u8): rt.u8 { if (self.ok) { return f(self.value); @@ -452,14 +460,22 @@ export function mapErr$1lsqfgi(self: rt.Result, op: (a0: rt.u16) return rt.Err(op(self.error)); } -export function inspect$07pitc0(self: rt.Result, f: (a0: rt.u8) => void): rt.Result { +export function mapErr$1whfgss(self: rt.Result, op: (a0: undefined) => undefined): rt.Result { + if (self.ok) { + return self; + } + op(undefined); + return rt.ERR; +} + +export function inspect$16o3gle(self: rt.Result, f: (a0: rt.u8) => undefined): rt.Result { if (self.ok) { f(self.value); } return self; } -export function inspectErr$0vdsz1l(self: rt.Result, f: (a0: rt.u16) => void): rt.Result { +export function inspectErr$06tv5sa(self: rt.Result, f: (a0: rt.u16) => undefined): rt.Result { if (!self.ok) { f(self.error); } diff --git a/ts/fixtures/lang/expected/cows.ts b/ts/fixtures/lang/expected/cows.ts index b15e3561b..33f8f7ab8 100644 --- a/ts/fixtures/lang/expected/cows.ts +++ b/ts/fixtures/lang/expected/cows.ts @@ -121,7 +121,7 @@ export function cows(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecPush(out, _285[1]); } rt.byteVecPush(out, unwrapOr$0r2bmpr(rt.btreeGet(counts, first), 255)); - const names: rt.HashSet = rt.hashNew(rt.hashing(Named.hash$Hash_DefaultHasher, Named.eq$PartialEq)) as rt.HashSet; + const names: rt.HashSet = rt.hashNew(rt.hashing(Named.hash$Hash_DefaultHasher as (a0: Named.Named, a1: rt.Hasher) => undefined, Named.eq$PartialEq)) as rt.HashSet; const iter5: rt.Iter = rt.strSplit(s, "/"); while (true) { const _305: string | rt.Done = iter5.next(); diff --git a/ts/fixtures/lang/expected/durations.ts b/ts/fixtures/lang/expected/durations.ts index 06f2e53b3..e00631526 100644 --- a/ts/fixtures/lang/expected/durations.ts +++ b/ts/fixtures/lang/expected/durations.ts @@ -233,7 +233,7 @@ export function durations(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi rt.byteVecPush(out, Window.cmp$Ord(w2, { start: b, len: undefined }) < 0 ? 1 : 0); const _400: Window.Window = copy$Window(Window.default$Default()); const _398: rt.Iter = rt.iterSlice([copy$Window(w2), copy$Window(w2), _400]); - rt.byteVecPush(out, rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Window.hash$Hash_DefaultHasher, Window.eq$PartialEq)) as rt.HashSet, _398, undefined, undefined, 29360128)) & 0xff); + rt.byteVecPush(out, rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Window.hash$Hash_DefaultHasher as (a0: Window.Window, a1: rt.Hasher) => undefined, Window.eq$PartialEq)) as rt.HashSet, _398, undefined, undefined, 29360128)) & 0xff); const _413: Window.Window = Window.default$Default(); const args8: rt.Fmt[] = [(f: rt.Formatter) => Window.fmt$Debug(w2, f), (f: rt.Formatter) => Window.fmt$Debug(_413, f)]; put(out, rt.fmtFormat([args8[0], "|", rt.fmtSpec({ alternate: true }, args8[1])])); diff --git a/ts/fixtures/lang/expected/dyns.ts b/ts/fixtures/lang/expected/dyns.ts index 440e6274d..a8c554fe4 100644 --- a/ts/fixtures/lang/expected/dyns.ts +++ b/ts/fixtures/lang/expected/dyns.ts @@ -547,7 +547,7 @@ export function twice(f: (a0: rt.u8) => rt.u8, x: rt.u8): rt.u8 { return f(f(x)); } -export function bumpAll(f: (a0: rt.u8) => void, xs: rt.ByteSlice): void { +export function bumpAll(f: (a0: rt.u8) => undefined, xs: rt.ByteSlice): void { for (const _5 of rt.byteSliceView(xs)) { f(_5); } @@ -599,7 +599,7 @@ export function fns(data: rt.ByteSlice, out: rt.ByteVec): void { put(out, rt.fmtFormat([args4[0], " "])); let sum: rt.u32 = 0; const seen: rt.ByteVec = new rt.ByteVec(); - bumpAll((x2: rt.u8): void => { + bumpAll((x2: rt.u8): undefined => { sum = rt.u32WrappingAdd(sum, x2 as rt.u32); rt.byteVecPush(seen, x2); }, rt.byteSliceRange(data, 2)); diff --git a/ts/fixtures/lang/expected/harness.ts b/ts/fixtures/lang/expected/harness.ts index 7299a3f7a..2fcd0f82c 100644 --- a/ts/fixtures/lang/expected/harness.ts +++ b/ts/fixtures/lang/expected/harness.ts @@ -47,146 +47,146 @@ import { wrappers } from "./wrappers.ts"; * Each case's name and what it runs. The first byte picks one modulo their count, so a * case added at the end moves no other. */ -export function cases(): [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void][] { - return [["ints::u8_op", u8Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::u16_op", u16Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::u32_op", u32Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::u64_op", u64Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::u128_op", u128Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::usize_op", usizeOp] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::i8_op", i8Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::i16_op", i16Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::i32_op", i32Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::i64_op", i64Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::i128_op", i128Op] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::isize_op", isizeOp] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::neg", neg] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::cast", cast] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::convert", (_2100: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void => { +export function cases(): [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined][] { + return [["ints::u8_op", u8Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::u16_op", u16Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::u32_op", u32Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::u64_op", u64Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::u128_op", u128Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::usize_op", usizeOp as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::i8_op", i8Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::i16_op", i16Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::i32_op", i32Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::i64_op", i64Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::i128_op", i128Op as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::isize_op", isizeOp as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::neg", neg as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::cast", cast as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::convert", (_2100: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): undefined => { convert(data, out); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::copies", (_2101: rt.u8, data2: rt.ByteSlice, out2: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::copies", (_2101: rt.u8, data2: rt.ByteSlice, out2: rt.ByteVec): undefined => { shapes_copies(data2, out2); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::loops", (_2102: rt.u8, data3: rt.ByteSlice, out3: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::loops", (_2102: rt.u8, data3: rt.ByteSlice, out3: rt.ByteVec): undefined => { loops(data3, out3); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::patterns", (_2103: rt.u8, data4: rt.ByteSlice, out4: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::patterns", (_2103: rt.u8, data4: rt.ByteSlice, out4: rt.ByteVec): undefined => { patterns(data4, out4); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::closures", (_2104: rt.u8, data5: rt.ByteSlice, out5: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::closures", (_2104: rt.u8, data5: rt.ByteSlice, out5: rt.ByteVec): undefined => { closures(data5, out5); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::discriminants", (_2105: rt.u8, data6: rt.ByteSlice, out6: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::discriminants", (_2105: rt.u8, data6: rt.ByteSlice, out6: rt.ByteVec): undefined => { discriminants(data6, out6); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::library", (_2106: rt.u8, data7: rt.ByteSlice, out7: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::library", (_2106: rt.u8, data7: rt.ByteSlice, out7: rt.ByteVec): undefined => { library(data7, out7); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::ints", ints] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::strings", (_2107: rt.u8, data8: rt.ByteSlice, out8: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::ints", ints as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::strings", (_2107: rt.u8, data8: rt.ByteSlice, out8: rt.ByteVec): undefined => { strings(data8, out8); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::derived", (_2108: rt.u8, data9: rt.ByteSlice, out9: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::derived", (_2108: rt.u8, data9: rt.ByteSlice, out9: rt.ByteVec): undefined => { derived(data9, out9); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::written", (_2109: rt.u8, data10: rt.ByteSlice, out10: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::written", (_2109: rt.u8, data10: rt.ByteSlice, out10: rt.ByteVec): undefined => { written(data10, out10); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::panics", panics] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["generics::methods", (_2110: rt.u8, data11: rt.ByteSlice, out11: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::panics", panics as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["generics::methods", (_2110: rt.u8, data11: rt.ByteSlice, out11: rt.ByteVec): undefined => { methods(data11, out11); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::adaptors", adaptors] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::consumers", consumers] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::ranges", (_2111: rt.u8, data12: rt.ByteSlice, out12: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::adaptors", adaptors as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::consumers", consumers as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::ranges", (_2111: rt.u8, data12: rt.ByteSlice, out12: rt.ByteVec): undefined => { ranges(data12, out12); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::options", (_2112: rt.u8, data13: rt.ByteSlice, out13: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::options", (_2112: rt.u8, data13: rt.ByteSlice, out13: rt.ByteVec): undefined => { options(data13, out13); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::own", (_2113: rt.u8, data14: rt.ByteSlice, out14: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::own", (_2113: rt.u8, data14: rt.ByteSlice, out14: rt.ByteVec): undefined => { own(data14, out14); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::values", (_2114: rt.u8, data15: rt.ByteSlice, out15: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::values", (_2114: rt.u8, data15: rt.ByteSlice, out15: rt.ByteVec): undefined => { iters_values(data15, out15); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::order", (_2115: rt.u8, data16: rt.ByteSlice, out16: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::order", (_2115: rt.u8, data16: rt.ByteSlice, out16: rt.ByteVec): undefined => { order(data16, out16); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::hash_maps", hashMaps] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::sets", sets] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::btree_maps", btreeMaps] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::deques", (_2116: rt.u8, data17: rt.ByteSlice, out17: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::hash_maps", hashMaps as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::sets", sets as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::btree_maps", btreeMaps as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::deques", (_2116: rt.u8, data17: rt.ByteSlice, out17: rt.ByteVec): undefined => { deques(data17, out17); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::flows", (_2117: rt.u8, data18: rt.ByteSlice, out18: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::flows", (_2117: rt.u8, data18: rt.ByteSlice, out18: rt.ByteVec): undefined => { flows(data18, out18); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::keys", keys] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["chars::chars", chars] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["strs::strs", strs] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::vecs", (_2118: rt.u8, data19: rt.ByteSlice, out19: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["keys::keys", keys as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["chars::chars", chars as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["strs::strs", strs as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::vecs", (_2118: rt.u8, data19: rt.ByteSlice, out19: rt.ByteVec): undefined => { vecs(data19, out19); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["strs::slices", slices] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::stores", (_2119: rt.u8, data20: rt.ByteSlice, out20: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["strs::slices", slices as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::stores", (_2119: rt.u8, data20: rt.ByteSlice, out20: rt.ByteVec): undefined => { stores(data20, out20); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["chunks::chunks", chunks] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["cows::cows", cows] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["durations::durations", durations] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["combinators::combinators", combinators] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["splits::splits", splits] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["nested::nested", nested] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["refs::refs", (_2120: rt.u8, data21: rt.ByteSlice, out21: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["chunks::chunks", chunks as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["cows::cows", cows as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["durations::durations", durations as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["combinators::combinators", combinators as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["splits::splits", splits as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["nested::nested", nested as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["refs::refs", (_2120: rt.u8, data21: rt.ByteSlice, out21: rt.ByteVec): undefined => { refs(data21, out21); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::counts", (_2121: rt.u8, data22: rt.ByteSlice, out22: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::counts", (_2121: rt.u8, data22: rt.ByteSlice, out22: rt.ByteVec): undefined => { counts(data22, out22); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::rounding", (_2122: rt.u8, _3100: rt.ByteSlice, out23: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::rounding", (_2122: rt.u8, _3100: rt.ByteSlice, out23: rt.ByteVec): undefined => { rounding(out23); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::skips", skips] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["wrappers::wrappers", wrappers] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["edits::edits", edits] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["utf8::decodes", decodes] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["floats::floats", floats] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["atomics::atomics", atomics] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::overrides", overrides] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["dyns::dyns", (_2123: rt.u8, data23: rt.ByteSlice, out24: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::skips", skips as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["wrappers::wrappers", wrappers as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["edits::edits", edits as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["utf8::decodes", decodes as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["floats::floats", floats as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["atomics::atomics", atomics as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["keys::overrides", overrides as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["dyns::dyns", (_2123: rt.u8, data23: rt.ByteSlice, out24: rt.ByteVec): undefined => { dyns(data23, out24); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["cells::cells", cells] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["dyns::shared", (_2124: rt.u8, data24: rt.ByteSlice, out25: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["cells::cells", cells as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["dyns::shared", (_2124: rt.u8, data24: rt.ByteSlice, out25: rt.ByteVec): undefined => { shared(data24, out25); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::ranked", ranked] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["captures::captures", captures] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["locks::locks", (_2125: rt.u8, data25: rt.ByteSlice, out26: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::ranked", ranked as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["captures::captures", captures as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["locks::locks", (_2125: rt.u8, data25: rt.ByteSlice, out26: rt.ByteVec): undefined => { locks(data25, out26); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["locks::relock", (_2126: rt.u8, data26: rt.ByteSlice, out27: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["locks::relock", (_2126: rt.u8, data26: rt.ByteSlice, out27: rt.ByteVec): undefined => { relock(data26, out27); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["locals::locals", (_2127: rt.u8, data27: rt.ByteSlice, out28: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["locals::locals", (_2127: rt.u8, data27: rt.ByteSlice, out28: rt.ByteVec): undefined => { locals(data27, out28); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["statics::statics", (_2128: rt.u8, data28: rt.ByteSlice, out29: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["statics::statics", (_2128: rt.u8, data28: rt.ByteSlice, out29: rt.ByteVec): undefined => { statics(data28, out29); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["locks::rwlocks", (_2129: rt.u8, data29: rt.ByteSlice, out30: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["locks::rwlocks", (_2129: rt.u8, data29: rt.ByteSlice, out30: rt.ByteVec): undefined => { rwlocks(data29, out30); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["borrows::borrows", (_2130: rt.u8, data30: rt.ByteSlice, out31: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["borrows::borrows", (_2130: rt.u8, data30: rt.ByteSlice, out31: rt.ByteVec): undefined => { borrows(data30, out31); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["defaults::defaults", (_2131: rt.u8, data31: rt.ByteSlice, out32: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["defaults::defaults", (_2131: rt.u8, data31: rt.ByteSlice, out32: rt.ByteVec): undefined => { defaults(data31, out32); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::arcs", (_2132: rt.u8, data32: rt.ByteSlice, out33: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::arcs", (_2132: rt.u8, data32: rt.ByteSlice, out33: rt.ByteVec): undefined => { arcs(data32, out33); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::rcs", (_2133: rt.u8, data33: rt.ByteSlice, out34: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::rcs", (_2133: rt.u8, data33: rt.ByteSlice, out34: rt.ByteVec): undefined => { rcs(data33, out34); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::cyclic_arcs", (_2134: rt.u8, data34: rt.ByteSlice, out35: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::cyclic_arcs", (_2134: rt.u8, data34: rt.ByteSlice, out35: rt.ByteVec): undefined => { cyclicArcs(data34, out35); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::cyclic_rcs", (_2135: rt.u8, data35: rt.ByteSlice, out36: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::cyclic_rcs", (_2135: rt.u8, data35: rt.ByteSlice, out36: rt.ByteVec): undefined => { cyclicRcs(data35, out36); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::unique_arcs", (_2136: rt.u8, data36: rt.ByteSlice, out37: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::unique_arcs", (_2136: rt.u8, data36: rt.ByteSlice, out37: rt.ByteVec): undefined => { uniqueArcs(data36, out37); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::unique_rcs", (_2137: rt.u8, data37: rt.ByteSlice, out38: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::unique_rcs", (_2137: rt.u8, data37: rt.ByteSlice, out38: rt.ByteVec): undefined => { uniqueRcs(data37, out38); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["dyns::anys", (_2138: rt.u8, data38: rt.ByteSlice, out39: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["dyns::anys", (_2138: rt.u8, data38: rt.ByteSlice, out39: rt.ByteVec): undefined => { anys(data38, out39); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["dyns::fns", (_2139: rt.u8, data39: rt.ByteSlice, out40: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["dyns::fns", (_2139: rt.u8, data39: rt.ByteSlice, out40: rt.ByteVec): undefined => { fns(data39, out40); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::copies", (_2140: rt.u8, data40: rt.ByteSlice, out41: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::copies", (_2140: rt.u8, data40: rt.ByteSlice, out41: rt.ByteVec): undefined => { pointers_copies(data40, out41); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::lists", (_2141: rt.u8, data41: rt.ByteSlice, out42: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::lists", (_2141: rt.u8, data41: rt.ByteSlice, out42: rt.ByteVec): undefined => { lists(data41, out42); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::nested", (_2142: rt.u8, data42: rt.ByteSlice, out43: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::nested", (_2142: rt.u8, data42: rt.ByteSlice, out43: rt.ByteVec): undefined => { pointers_nested(data42, out43); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::places", (_2143: rt.u8, data43: rt.ByteSlice, out44: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::places", (_2143: rt.u8, data43: rt.ByteSlice, out44: rt.ByteVec): undefined => { places(data43, out44); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::sentinels", (_2144: rt.u8, data44: rt.ByteSlice, out45: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::sentinels", (_2144: rt.u8, data44: rt.ByteSlice, out45: rt.ByteVec): undefined => { sentinels(data44, out45); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::shared", (_2145: rt.u8, data45: rt.ByteSlice, out46: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::shared", (_2145: rt.u8, data45: rt.ByteSlice, out46: rt.ByteVec): undefined => { pointers_shared(data45, out46); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::unchecked", (_2146: rt.u8, data46: rt.ByteSlice, out47: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::unchecked", (_2146: rt.u8, data46: rt.ByteSlice, out47: rt.ByteVec): undefined => { unchecked(data46, out47); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["edits::bytes", bytes] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["arrays::from_fns", (_2147: rt.u8, data47: rt.ByteSlice, out48: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["edits::bytes", bytes as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["arrays::from_fns", (_2147: rt.u8, data47: rt.ByteSlice, out48: rt.ByteVec): undefined => { fromFns(data47, out48); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::optionals", optionals] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["objects::objects", (_2148: rt.u8, data48: rt.ByteSlice, out49: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::optionals", optionals as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["objects::objects", (_2148: rt.u8, data48: rt.ByteSlice, out49: rt.ByteVec): undefined => { objects(data48, out49); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["holds::holds", holds] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::wrapped", (_2149: rt.u8, data49: rt.ByteSlice, out50: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["holds::holds", holds as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::wrapped", (_2149: rt.u8, data49: rt.ByteSlice, out50: rt.ByteVec): undefined => { wrapped(data49, out50); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["refs::to_refs", (_2150: rt.u8, data50: rt.ByteSlice, out51: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["refs::to_refs", (_2150: rt.u8, data50: rt.ByteSlice, out51: rt.ByteVec): undefined => { toRefs(data50, out51); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["orders::orders", orders] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::cloned_arcs", (_2151: rt.u8, data51: rt.ByteSlice, out52: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["orders::orders", orders as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::cloned_arcs", (_2151: rt.u8, data51: rt.ByteSlice, out52: rt.ByteVec): undefined => { clonedArcs(data51, out52); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::cloned_rcs", (_2152: rt.u8, data52: rt.ByteSlice, out53: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::cloned_rcs", (_2152: rt.u8, data52: rt.ByteSlice, out53: rt.ByteVec): undefined => { clonedRcs(data52, out53); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["counts::copies", (_2153: rt.u8, data53: rt.ByteSlice, out54: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["counts::copies", (_2153: rt.u8, data53: rt.ByteSlice, out54: rt.ByteVec): undefined => { copies(data53, out54); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["statics::cells", (_2154: rt.u8, data54: rt.ByteSlice, out55: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["statics::cells", (_2154: rt.u8, data54: rt.ByteSlice, out55: rt.ByteVec): undefined => { statics_cells(data54, out55); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::returned", (_2155: rt.u8, data55: rt.ByteSlice, out56: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::returned", (_2155: rt.u8, data55: rt.ByteSlice, out56: rt.ByteVec): undefined => { returned(data55, out56); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hashes::values", values] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hashes::random", (_2156: rt.u8, data56: rt.ByteSlice, out57: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hashes::values", values as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hashes::random", (_2156: rt.u8, data56: rt.ByteSlice, out57: rt.ByteVec): undefined => { random(data56, out57); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["floats::formats", formats] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["floats::parses", parses] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["orders::bytes", (_2157: rt.u8, data57: rt.ByteSlice, out58: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["floats::formats", formats as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["floats::parses", parses as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["orders::bytes", (_2157: rt.u8, data57: rt.ByteSlice, out58: rt.ByteVec): undefined => { orders_bytes(data57, out58); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["slices::parts", parts] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["slices::drains", drains] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["slices::chunked", chunked] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["statics::onces", (_2158: rt.u8, data58: rt.ByteSlice, out59: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["slices::parts", parts as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["slices::drains", drains as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["slices::chunked", chunked as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["statics::onces", (_2158: rt.u8, data58: rt.ByteSlice, out59: rt.ByteVec): undefined => { onces(data58, out59); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["fmt::writes", (_2159: rt.u8, data59: rt.ByteSlice, out60: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["fmt::writes", (_2159: rt.u8, data59: rt.ByteSlice, out60: rt.ByteVec): undefined => { writes(data59, out60); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["bounds::bounds", bounds] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::cells", (_2160: rt.u8, data60: rt.ByteSlice, out61: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["bounds::bounds", bounds as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::cells", (_2160: rt.u8, data60: rt.ByteSlice, out61: rt.ByteVec): undefined => { pointers_cells(data60, out61); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::parses", ints_parses] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["strs::edits", strs_edits] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["slices::subslices", subslices] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hashes::bytes", (_2161: rt.u8, data61: rt.ByteSlice, out62: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::parses", ints_parses as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["strs::edits", strs_edits as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["slices::subslices", subslices as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hashes::bytes", (_2161: rt.u8, data61: rt.ByteSlice, out62: rt.ByteVec): undefined => { hashes_bytes(data61, out62); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::bytes", keys_bytes] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["strs::parses", strs_parses] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::rebound", (_2162: rt.u8, data62: rt.ByteSlice, out63: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["keys::bytes", keys_bytes as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["strs::parses", strs_parses as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::rebound", (_2162: rt.u8, data62: rt.ByteSlice, out63: rt.ByteVec): undefined => { rebound(data62, out63); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["slices::ranges", slices_ranges] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::reducers", (_2163: rt.u8, data63: rt.ByteSlice, out64: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["slices::ranges", slices_ranges as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::reducers", (_2163: rt.u8, data63: rt.ByteSlice, out64: rt.ByteVec): undefined => { reducers(data63, out64); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::writers", (_2164: rt.u8, data64: rt.ByteSlice, out65: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::writers", (_2164: rt.u8, data64: rt.ByteSlice, out65: rt.ByteVec): undefined => { writers(data64, out65); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["errors::eqs", eqs] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["slices::edits", slices_edits] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["strs::iters", iters] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["strs::drains", strs_drains] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["strs::hinted", hinted] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["pointers::made", (_2165: rt.u8, data65: rt.ByteSlice, out66: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["errors::eqs", eqs as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["slices::edits", slices_edits as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["strs::iters", iters as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["strs::drains", strs_drains as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["strs::hinted", hinted as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["pointers::made", (_2165: rt.u8, data65: rt.ByteSlice, out66: rt.ByteVec): undefined => { made(data65, out66); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["arrays::as_slices", (_2166: rt.u8, data66: rt.ByteSlice, out67: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["arrays::as_slices", (_2166: rt.u8, data66: rt.ByteSlice, out67: rt.ByteVec): undefined => { asSlices(data66, out67); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["ints::widenings", widenings] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["shapes::uninhabited", (_2167: rt.u8, data67: rt.ByteSlice, out68: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["ints::widenings", widenings as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["shapes::uninhabited", (_2167: rt.u8, data67: rt.ByteSlice, out68: rt.ByteVec): undefined => { uninhabited(data67, out68); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::lent_keys", lentKeys] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::lent_values", lentValues] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::singles", singles] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::formats", singles_formats] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::parses", singles_parses] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::peeked_others", (_2168: rt.u8, data68: rt.ByteSlice, out69: rt.ByteVec): void => { + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["keys::lent_keys", lentKeys as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["keys::lent_values", lentValues as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["singles::singles", singles as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["singles::formats", singles_formats as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["singles::parses", singles_parses as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::peeked_others", (_2168: rt.u8, data68: rt.ByteSlice, out69: rt.ByteVec): undefined => { peekedOthers(data68, out69); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hints::hints", hints] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hints::reserves", reserves] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void]]; + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hints::hints", hints as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hints::reserves", reserves as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined]]; } /** Run one case. */ @@ -195,14 +195,14 @@ export function run(input: rt.ByteSlice): rt.ByteVec { if (!(input.length >= 2)) { return out; } - const cases_: [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void][] = cases(); + const cases_: [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined][] = cases(); cases_[rt.idx(cases_, rt.usizeRem(input.data[input.start] as rt.usize, cases_.length))][1](input.data[input.start + 1], new rt.ByteSlice(input.data, input.start + 2, input.length - 2), out); return out; } /** The first byte that picks the case named `name`, which `caller.ts` targets by. */ export function op(name: string): rt.u8 { - const _2: rt.usize | undefined = rt.iterPosition(rt.iterSlice(cases()), (_22: [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void]): boolean => { + const _2: rt.usize | undefined = rt.iterPosition(rt.iterSlice(cases()), (_22: [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined]): boolean => { return _22[0] === name; }); if (_2 === undefined) { diff --git a/ts/fixtures/lang/expected/hashes.ts b/ts/fixtures/lang/expected/hashes.ts index 85ecf2f79..aea9eb975 100644 --- a/ts/fixtures/lang/expected/hashes.ts +++ b/ts/fixtures/lang/expected/hashes.ts @@ -37,7 +37,7 @@ export function digest$Arc_u8s(value: rt.Arc, out: rt.ByteVec): void /** `DefaultHasher::new`'s hash of `value`, little-endian. */ export function digest$Dirs(value: Dir.Dir[], out: rt.ByteVec): void { const h: rt.Hasher = rt.hasher(); - rt.hashSlice(Dir.hash$Hash_DefaultHasher)(value, h); + rt.hashSlice(Dir.hash$Hash_DefaultHasher as (a0: Dir.Dir, a1: rt.Hasher) => undefined)(value, h); rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u64ToBeBytes(rt.hashFinish(h)).reverse())); } @@ -121,7 +121,7 @@ export function digest$Shape(value: Shape.Shape, out: rt.ByteVec): void { /** `DefaultHasher::new`'s hash of `value`, little-endian. */ export function digest$Small_Small(value: [Small.Small, Small.Small], out: rt.ByteVec): void { const h: rt.Hasher = rt.hasher(); - rt.hashTuple([Small.hash$Hash_DefaultHasher, Small.hash$Hash_DefaultHasher])(value, h); + rt.hashTuple([Small.hash$Hash_DefaultHasher as (a0: Small.Small, a1: rt.Hasher) => undefined, Small.hash$Hash_DefaultHasher as (a0: Small.Small, a1: rt.Hasher) => undefined])(value, h); rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u64ToBeBytes(rt.hashFinish(h)).reverse())); } @@ -483,14 +483,14 @@ export function random(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecPush(out, rt.u64Eq(rt.hashOne(s, n, rt.hash64), rt.hashOne(s, n, rt.hash64)) ? 1 : 0); rt.byteVecPush(out, rt.u64Eq(rt.hashOne(other.state, text, rt.hashStr), rt.hashOne(other.state, text, rt.hashStr)) ? 1 : 0); rt.byteVecPush(out, rt.u64Eq(rt.hashOne(s, [b, text] as [rt.u8, string], rt.hashTuple([rt.hash8, rt.hashStr])), rt.hashOne(copy, [b, text] as [rt.u8, string], rt.hashTuple([rt.hash8, rt.hashStr]))) ? 1 : 0); - rt.byteVecPush(out, rt.u64Eq(rt.hashOne(s, { _0: b }, Nibble.hash$Hash_DefaultHasher), rt.hashOne(s, { _0: b ^ 240 }, Nibble.hash$Hash_DefaultHasher)) ? 1 : 0); + rt.byteVecPush(out, rt.u64Eq(rt.hashOne(s, { _0: b }, Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined), rt.hashOne(s, { _0: b ^ 240 }, Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined)) ? 1 : 0); const arc: rt.Arc = new rt.Arc(text); const _84: rt.Arc = rt.arcClone(arc); rt.byteVecPush(out, rt.u64Eq(rt.hashOne(s, _84, rt.hashArc(rt.hashStr), rt.drop), rt.hashOne(s, arc, rt.hashArc(rt.hashStr))) ? 1 : 0); rt.byteVecPush(out, arc.strong & 0xff); const drops: rt.Cell = new rt.Cell(0); const counted: Counted.Counted = new Counted.Counted(b, drops); - rt.byteVecPush(out, rt.u64Eq(rt.hashOne(s, counted, Counted.hash$Hash_DefaultHasher), rt.hashOne(s, new Counted.Counted(b, drops), Counted.hash$Hash_DefaultHasher, rt.drop)) ? 1 : 0); + rt.byteVecPush(out, rt.u64Eq(rt.hashOne(s, counted, Counted.hash$Hash_DefaultHasher as (a0: Counted.Counted, a1: rt.Hasher) => undefined), rt.hashOne(s, new Counted.Counted(b, drops), Counted.hash$Hash_DefaultHasher as (a0: Counted.Counted, a1: rt.Hasher) => undefined, rt.drop)) ? 1 : 0); rt.byteVecPush(out, drops.v); counted[Symbol.dispose](); rt.byteVecPush(out, drops.v); diff --git a/ts/fixtures/lang/expected/hints.ts b/ts/fixtures/lang/expected/hints.ts index 304c22101..a3c8710ce 100644 --- a/ts/fixtures/lang/expected/hints.ts +++ b/ts/fixtures/lang/expected/hints.ts @@ -1820,7 +1820,7 @@ export function hints(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { return rt.u64Add(i15, 1); }), steps, out); } else if (_204 === 1) { - walk$Inspect_Range_u64_hints_closure8(rt.iterInspect(new rt.Range(0, n, rt.u64Step), (_247: rt.u64): void => {}), steps, out); + walk$Inspect_Range_u64_hints_closure8(rt.iterInspect(new rt.Range(0, n, rt.u64Step), (_247: rt.u64): undefined => {}), steps, out); } else if (_204 === 2) { walk$Enumerate_Range_u32(rt.iterEnumerate(new rt.Range(0, u32Of(n))), steps, out); } else if (_204 === 3) { @@ -2515,10 +2515,10 @@ export function fill$Big_Filter_Map_RangeInclusive_u32_typed_closure1_typed_clos } else if (coll === 7) { len = rt.btreeLen(rt.btreeExtendKeys(rt.btreeNew(Big.cmp$Ord) as rt.BTreeSet, items, true, undefined, undefined, 1100)); } else if (coll === 8) { - len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); + len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); } else if (coll === 9) { const _41: [Big.Big, rt.u32][] = [[seed, 0] as [Big.Big, rt.u32]]; - const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); + const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); const _46: rt.Iter<[Big.Big, rt.u32]> = rt.iterMap(items, (t3: Big.Big): [Big.Big, rt.u32] => { return [t3, 1] as [Big.Big, rt.u32]; }); @@ -2585,10 +2585,10 @@ export function fill$Big_Map_Flatten_IntoIter_RangeInclusive_u32_typed_closure1( } else if (coll === 7) { len = rt.btreeLen(rt.btreeExtendKeys(rt.btreeNew(Big.cmp$Ord) as rt.BTreeSet, items, true, undefined, undefined, 1100)); } else if (coll === 8) { - len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); + len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); } else if (coll === 9) { const _41: [Big.Big, rt.u32][] = [[seed, 0] as [Big.Big, rt.u32]]; - const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); + const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); const _46: rt.Iter<[Big.Big, rt.u32]> = rt.iterMap(items, (t3: Big.Big): [Big.Big, rt.u32] => { return [t3, 1] as [Big.Big, rt.u32]; }); @@ -2655,10 +2655,10 @@ export function fill$Big_Map_Flatten_IntoIter_RangeInclusive_u32_typed_closure1$ } else if (coll === 7) { len = rt.btreeLen(rt.btreeExtendKeys(rt.btreeNew(Big.cmp$Ord) as rt.BTreeSet, items, true, undefined, undefined, 1100)); } else if (coll === 8) { - len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); + len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); } else if (coll === 9) { const _41: [Big.Big, rt.u32][] = [[seed, 0] as [Big.Big, rt.u32]]; - const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); + const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); const _46: rt.Iter<[Big.Big, rt.u32]> = rt.iterMap(items, (t3: Big.Big): [Big.Big, rt.u32] => { return [t3, 1] as [Big.Big, rt.u32]; }); @@ -2725,10 +2725,10 @@ export function fill$Big_Map_RangeInclusive_u32_typed_closure1(coll: rt.u8, item } else if (coll === 7) { len = rt.btreeLen(rt.btreeExtendKeys(rt.btreeNew(Big.cmp$Ord) as rt.BTreeSet, items, true, undefined, undefined, 1100, true)); } else if (coll === 8) { - len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); + len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); } else if (coll === 9) { const _41: [Big.Big, rt.u32][] = [[seed, 0] as [Big.Big, rt.u32]]; - const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); + const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); const _46: rt.Iter<[Big.Big, rt.u32]> = rt.iterMap(items, (t3: Big.Big): [Big.Big, rt.u32] => { return [t3, 1] as [Big.Big, rt.u32]; }); @@ -2795,10 +2795,10 @@ export function fill$Big_Skip_Map_RangeInclusive_u32_typed_closure1(coll: rt.u8, } else if (coll === 7) { len = rt.btreeLen(rt.btreeExtendKeys(rt.btreeNew(Big.cmp$Ord) as rt.BTreeSet, items, true, undefined, undefined, 1100)); } else if (coll === 8) { - len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); + len = rt.hashLen(rt.hashExtendKeys(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashSet, items, undefined, undefined, 917504)); } else if (coll === 9) { const _41: [Big.Big, rt.u32][] = [[seed, 0] as [Big.Big, rt.u32]]; - const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); + const m: rt.HashMap = rt.hashExtend(rt.hashNew(rt.hashing(Big.hash$Hash_DefaultHasher as (a0: Big.Big, a1: rt.Hasher) => undefined, Big.eq$PartialEq)) as rt.HashMap, rt.iterSlice(_41), undefined, undefined, undefined, 917504); const _46: rt.Iter<[Big.Big, rt.u32]> = rt.iterMap(items, (t3: Big.Big): [Big.Big, rt.u32] => { return [t3, 1] as [Big.Big, rt.u32]; }); diff --git a/ts/fixtures/lang/expected/ints.ts b/ts/fixtures/lang/expected/ints.ts index feeb291a6..f644e6523 100644 --- a/ts/fixtures/lang/expected/ints.ts +++ b/ts/fixtures/lang/expected/ints.ts @@ -11,11 +11,11 @@ import * as Scaled from "./ints.Scaled.ts"; /** Apply operation `op` to operands taken from `data`. */ export function u8Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.u8) => void = (out2: rt.ByteVec, v3: rt.u8): void => { + const _68: (a0: rt.ByteVec, a1: rt.u8) => undefined = (out2: rt.ByteVec, v3: rt.u8): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u128ToBeBytes(v3 as rt.u128))); rt.byteVecPush(out2, rt.u8FromBeBytes(rt.u8ToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.u8 | undefined) => void = (out3: rt.ByteVec, v4: rt.u8 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.u8 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.u8 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -160,11 +160,11 @@ export function u8Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function u16Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.u16) => void = (out2: rt.ByteVec, v3: rt.u16): void => { + const _68: (a0: rt.ByteVec, a1: rt.u16) => undefined = (out2: rt.ByteVec, v3: rt.u16): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u128ToBeBytes(v3 as rt.u128))); rt.byteVecPush(out2, rt.u16FromBeBytes(rt.u16ToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.u16 | undefined) => void = (out3: rt.ByteVec, v4: rt.u16 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.u16 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.u16 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -309,11 +309,11 @@ export function u16Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function u32Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.u32) => void = (out2: rt.ByteVec, v3: rt.u32): void => { + const _68: (a0: rt.ByteVec, a1: rt.u32) => undefined = (out2: rt.ByteVec, v3: rt.u32): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u128ToBeBytes(v3 as rt.u128))); rt.byteVecPush(out2, rt.u32FromBeBytes(rt.u32ToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.u32 | undefined) => void = (out3: rt.ByteVec, v4: rt.u32 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.u32 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.u32 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -458,11 +458,11 @@ export function u32Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function u64Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.u64) => void = (out2: rt.ByteVec, v3: rt.u64): void => { + const _68: (a0: rt.ByteVec, a1: rt.u64) => undefined = (out2: rt.ByteVec, v3: rt.u64): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u128ToBeBytes(rt.u128Cast(v3)))); rt.byteVecPush(out2, rt.u64Eq(rt.u64FromBeBytes(rt.u64ToBeBytes(v3)), v3) ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.u64 | undefined) => void = (out3: rt.ByteVec, v4: rt.u64 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.u64 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.u64 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -607,11 +607,11 @@ export function u64Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function u128Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.u128) => void = (out2: rt.ByteVec, v3: rt.u128): void => { + const _68: (a0: rt.ByteVec, a1: rt.u128) => undefined = (out2: rt.ByteVec, v3: rt.u128): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u128ToBeBytes(v3))); rt.byteVecPush(out2, rt.u128Eq(rt.u128FromBeBytes(rt.u128ToBeBytes(v3)), v3) ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.u128 | undefined) => void = (out3: rt.ByteVec, v4: rt.u128 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.u128 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.u128 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -756,11 +756,11 @@ export function u128Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function usizeOp(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.usize) => void = (out2: rt.ByteVec, v3: rt.usize): void => { + const _68: (a0: rt.ByteVec, a1: rt.usize) => undefined = (out2: rt.ByteVec, v3: rt.usize): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.u128ToBeBytes(v3 as rt.u128))); rt.byteVecPush(out2, rt.usizeFromBeBytes(rt.usizeToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.usize | undefined) => void = (out3: rt.ByteVec, v4: rt.usize | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.usize | undefined) => undefined = (out3: rt.ByteVec, v4: rt.usize | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -905,11 +905,11 @@ export function usizeOp(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function i8Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.i8) => void = (out2: rt.ByteVec, v3: rt.i8): void => { + const _68: (a0: rt.ByteVec, a1: rt.i8) => undefined = (out2: rt.ByteVec, v3: rt.i8): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.i128ToBeBytes(v3 as rt.i128))); rt.byteVecPush(out2, rt.i8FromBeBytes(rt.i8ToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.i8 | undefined) => void = (out3: rt.ByteVec, v4: rt.i8 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.i8 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.i8 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -1054,11 +1054,11 @@ export function i8Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function i16Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.i16) => void = (out2: rt.ByteVec, v3: rt.i16): void => { + const _68: (a0: rt.ByteVec, a1: rt.i16) => undefined = (out2: rt.ByteVec, v3: rt.i16): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.i128ToBeBytes(v3 as rt.i128))); rt.byteVecPush(out2, rt.i16FromBeBytes(rt.i16ToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.i16 | undefined) => void = (out3: rt.ByteVec, v4: rt.i16 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.i16 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.i16 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -1203,11 +1203,11 @@ export function i16Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function i32Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.i32) => void = (out2: rt.ByteVec, v3: rt.i32): void => { + const _68: (a0: rt.ByteVec, a1: rt.i32) => undefined = (out2: rt.ByteVec, v3: rt.i32): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.i128ToBeBytes(v3 as rt.i128))); rt.byteVecPush(out2, rt.i32FromBeBytes(rt.i32ToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.i32 | undefined) => void = (out3: rt.ByteVec, v4: rt.i32 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.i32 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.i32 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -1352,11 +1352,11 @@ export function i32Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function i64Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.i64) => void = (out2: rt.ByteVec, v3: rt.i64): void => { + const _68: (a0: rt.ByteVec, a1: rt.i64) => undefined = (out2: rt.ByteVec, v3: rt.i64): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.i128ToBeBytes(rt.i128Cast(v3)))); rt.byteVecPush(out2, rt.i64Eq(rt.i64FromBeBytes(rt.i64ToBeBytes(v3)), v3) ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.i64 | undefined) => void = (out3: rt.ByteVec, v4: rt.i64 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.i64 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.i64 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -1501,11 +1501,11 @@ export function i64Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function i128Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.i128) => void = (out2: rt.ByteVec, v3: rt.i128): void => { + const _68: (a0: rt.ByteVec, a1: rt.i128) => undefined = (out2: rt.ByteVec, v3: rt.i128): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.i128ToBeBytes(v3))); rt.byteVecPush(out2, rt.i128Eq(rt.i128FromBeBytes(rt.i128ToBeBytes(v3)), v3) ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.i128 | undefined) => void = (out3: rt.ByteVec, v4: rt.i128 | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.i128 | undefined) => undefined = (out3: rt.ByteVec, v4: rt.i128 | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { @@ -1650,11 +1650,11 @@ export function i128Op(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { /** Apply operation `op` to operands taken from `data`. */ export function isizeOp(op: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _68: (a0: rt.ByteVec, a1: rt.isize) => void = (out2: rt.ByteVec, v3: rt.isize): void => { + const _68: (a0: rt.ByteVec, a1: rt.isize) => undefined = (out2: rt.ByteVec, v3: rt.isize): undefined => { rt.byteVecExtendFromSlice(out2, rt.byteSliceFrom(rt.i128ToBeBytes(v3 as rt.i128))); rt.byteVecPush(out2, rt.isizeFromBeBytes(rt.isizeToBeBytes(v3)) === v3 ? 1 : 0); }; - const _69: (a0: rt.ByteVec, a1: rt.isize | undefined) => void = (out3: rt.ByteVec, v4: rt.isize | undefined): void => { + const _69: (a0: rt.ByteVec, a1: rt.isize | undefined) => undefined = (out3: rt.ByteVec, v4: rt.isize | undefined): undefined => { if (v4 === undefined) { rt.byteVecPush(out3, 0); } else { diff --git a/ts/fixtures/lang/expected/iters.ts b/ts/fixtures/lang/expected/iters.ts index 65c759154..2b58cb629 100644 --- a/ts/fixtures/lang/expected/iters.ts +++ b/ts/fixtures/lang/expected/iters.ts @@ -179,7 +179,7 @@ export function consumers(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi const log: rt.ByteVec = new rt.ByteVec(); const _5: rt.u8 = rt.u8Rem(kind, 6); if (_5 === 0) { - rt.byteVecPush(out, rt.iterAny(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_228: rt.u8): void => { + rt.byteVecPush(out, rt.iterAny(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_228: rt.u8): undefined => { rt.byteVecPush(log, _228); }), (_229: rt.u8): boolean => { return _229 > 240; @@ -192,7 +192,7 @@ export function consumers(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi return rt.u8Rem(_231, 2) === 0; })) & 0xff); } else if (_5 === 1) { - rt.byteVecPush(out, unwrapOr$0r2bmpr(rt.iterFind(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_220: rt.u8): void => { + rt.byteVecPush(out, unwrapOr$0r2bmpr(rt.iterFind(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_220: rt.u8): undefined => { rt.byteVecPush(log, _220); }), (_221: rt.u8): boolean => { return rt.u8Rem(_221, 7) === 3; @@ -227,7 +227,7 @@ export function consumers(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi } rt.byteVecPush(out, _69[0] ^ _69[1]); } - const iter2: rt.Iter<[rt.u8, rt.u8]> = rt.iterZip(rt.iterMap(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_226: rt.u8): void => { + const iter2: rt.Iter<[rt.u8, rt.u8]> = rt.iterZip(rt.iterMap(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_226: rt.u8): undefined => { rt.byteVecPush(log, _226); }), (b19: rt.u8): rt.u8 => { return b19; @@ -277,7 +277,7 @@ export function consumers(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(rt.u32ToBeBytes(rt.iterFold(rt.iterSlice(rt.byteSliceView(data)), 0, (acc: rt.u32, _34: rt.u8): rt.u32 => { return rt.u32WrappingAdd((acc << 3) >>> 0, ((_34 as rt.u32) ^ acc) >>> 0); })))); - rt.iterForEach(rt.iterSlice(rt.byteSliceView(data)), (_216: rt.u8): void => { + rt.iterForEach(rt.iterSlice(rt.byteSliceView(data)), (_216: rt.u8): undefined => { rt.byteVecPush(log, rotateFree$RotateFree_u8(_216)); }); } else if (_5 === 4) { @@ -298,7 +298,7 @@ export function consumers(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi } else { rt.byteVecPush(out, parsed.error); } - rt.byteVecPush(out, mapOr$1kiffmd(rt.iterCollectOption(rt.iterMap(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_24: rt.u8): void => { + rt.byteVecPush(out, mapOr$1kiffmd(rt.iterCollectOption(rt.iterMap(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_24: rt.u8): undefined => { rt.byteVecPush(log, _24); }), (_29: rt.u8): rt.u16 | undefined => { const b5: rt.u8 = _29; @@ -655,7 +655,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest.len() & 0xff); const log: rt.ByteVec = new rt.ByteVec(); - const it2: rt.Iter = rt.iterFuse(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_267: rt.u8): void => { + const it2: rt.Iter = rt.iterFuse(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_267: rt.u8): undefined => { rt.byteVecPush(log, _267); }), limit)); if (!back) { @@ -682,7 +682,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest2.len() & 0xff); const log2: rt.ByteVec = new rt.ByteVec(); - const it4: rt.Iter = rt.iterSkip(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_262: rt.u8): void => { + const it4: rt.Iter = rt.iterSkip(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_262: rt.u8): undefined => { rt.byteVecPush(log2, _262); }), rt.usizeAdd(limit, 1)), 1); if (!back) { @@ -707,7 +707,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest3.len() & 0xff); const log3: rt.ByteVec = new rt.ByteVec(); - const it6: rt.Iter = rt.iterChain(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_258: rt.u8): void => { + const it6: rt.Iter = rt.iterChain(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_258: rt.u8): undefined => { rt.byteVecPush(log3, _258); }), limit), rt.iterSlice(rt.byteSliceView(rt.byteSliceFrom(Uint8Array.of(17))))); if (!back) { @@ -733,7 +733,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest4.len() & 0xff); const log4: rt.ByteVec = new rt.ByteVec(); - const src8: rt.Iter = rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_253: rt.u8): void => { + const src8: rt.Iter = rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_253: rt.u8): undefined => { rt.byteVecPush(log4, _253); }); const it8: rt.Iter = rt.iterChain(rt.iterSlice(rt.byteSliceView(rt.byteSliceFrom(Uint8Array.of(17)))), rt.iterTake(src8, limit)); @@ -761,7 +761,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest5.len() & 0xff); const log5: rt.ByteVec = new rt.ByteVec(); - const it10: rt.Iter = rt.iterStepBy(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_246: rt.u8): void => { + const it10: rt.Iter = rt.iterStepBy(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_246: rt.u8): undefined => { rt.byteVecPush(log5, _246); }), rt.usizeAdd(limit, 1)), 2); if (!back) { @@ -786,7 +786,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest6.len() & 0xff); const log6: rt.ByteVec = new rt.ByteVec(); - const it12: rt.Peekable = rt.iterPeekable(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_241: rt.u8): void => { + const it12: rt.Peekable = rt.iterPeekable(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_241: rt.u8): undefined => { rt.byteVecPush(log6, _241); }), limit)); if (!back) { @@ -815,7 +815,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest7.len() & 0xff); const log7: rt.ByteVec = new rt.ByteVec(); - const it16: rt.Peekable = rt.iterPeekable(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_236: rt.u8): void => { + const it16: rt.Peekable = rt.iterPeekable(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_236: rt.u8): undefined => { rt.byteVecPush(log7, _236); }), rt.usizeAdd(limit, 1))); rt.peekablePeek(it16); @@ -842,7 +842,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest8.len() & 0xff); const log8: rt.ByteVec = new rt.ByteVec(); - const it18: rt.Iter = rt.iterFlatten(rt.iterOnce(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_231: rt.u8): void => { + const it18: rt.Iter = rt.iterFlatten(rt.iterOnce(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_231: rt.u8): undefined => { rt.byteVecPush(log8, _231); }), limit))); if (!back) { @@ -867,7 +867,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest9.len() & 0xff); const log9: rt.ByteVec = new rt.ByteVec(); - const it20: rt.Iter = rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_229: rt.u8): void => { + const it20: rt.Iter = rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_229: rt.u8): undefined => { rt.byteVecPush(log9, _229); }), limit); if (!back) { @@ -892,7 +892,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest10.len() & 0xff); const log10: rt.ByteVec = new rt.ByteVec(); - const it22: rt.Iter = rt.iterCloned(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_224: rt.u8): void => { + const it22: rt.Iter = rt.iterCloned(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_224: rt.u8): undefined => { rt.byteVecPush(log10, _224); }), limit)); if (!back) { @@ -917,7 +917,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest11.len() & 0xff); const log11: rt.ByteVec = new rt.ByteVec(); - const it24: rt.Iter<[rt.usize, rt.u8]> = rt.iterEnumerate(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_222: rt.u8): void => { + const it24: rt.Iter<[rt.usize, rt.u8]> = rt.iterEnumerate(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_222: rt.u8): undefined => { rt.byteVecPush(log11, _222); }), limit)); if (!back) { @@ -942,7 +942,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest12.len() & 0xff); const log12: rt.ByteVec = new rt.ByteVec(); - const it26: rt.Iter = rt.iterRev(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_219: rt.u8): void => { + const it26: rt.Iter = rt.iterRev(rt.iterTake(rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_219: rt.u8): undefined => { rt.byteVecPush(log12, _219); }), limit)); if (!back) { @@ -968,7 +968,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, rest13.len() & 0xff); const log13: rt.ByteVec = new rt.ByteVec(); - const src26: rt.Iter = rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_213: rt.u8): void => { + const src26: rt.Iter = rt.iterInspect(rt.iterSlice(rt.byteSliceView(data)), (_213: rt.u8): undefined => { rt.byteVecPush(log13, _213); }); const it28: rt.Iter = rt.iterChain(rt.iterSlice(rt.byteSliceView(rt.byteSliceFrom(Uint8Array.of(17)))), rt.iterFuse(rt.iterTake(src26, limit))); @@ -1018,7 +1018,7 @@ export function skips(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { * crate's own orders, `min` and `max` of such items, and `rposition` and `rfind`. */ export function ranked(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _4: (a0: rt.ByteVec, a1: [rt.usize, rt.u8] | undefined) => void = (out2: rt.ByteVec, found2: [rt.usize, rt.u8] | undefined): void => { + const _4: (a0: rt.ByteVec, a1: [rt.usize, rt.u8] | undefined) => undefined = (out2: rt.ByteVec, found2: [rt.usize, rt.u8] | undefined): undefined => { rt.byteVecPush(out2, mapOr$06gg5x7(found2, 255, (_2: [rt.usize, rt.u8]): rt.u8 => { return _2[0] & 0xff; })); @@ -1507,12 +1507,12 @@ export function values(data: rt.ByteSlice, out: rt.ByteVec): void { * stays apart from an item's own. */ export function returned(data: rt.ByteSlice, out: rt.ByteVec): void { - const _3: (a0: rt.u8 | undefined, a1: rt.ByteVec) => void = (b: rt.u8 | undefined, out2: rt.ByteVec): void => { + const _3: (a0: rt.u8 | undefined, a1: rt.ByteVec) => undefined = (b: rt.u8 | undefined, out2: rt.ByteVec): undefined => { rt.byteVecPush(out2, mapOr$1surhce(b, 170, (b2: rt.u8): rt.u8 => { return b2; })); }; - const _4: (a0: rt.u8 | undefined | rt.None, a1: rt.ByteVec) => void = (b3: rt.u8 | undefined | rt.None, out3: rt.ByteVec): void => { + const _4: (a0: rt.u8 | undefined | rt.None, a1: rt.ByteVec) => undefined = (b3: rt.u8 | undefined | rt.None, out3: rt.ByteVec): undefined => { if (b3 === rt.None) { rt.byteVecPush(out3, 187); } else if (b3 === undefined) { diff --git a/ts/fixtures/lang/expected/keys.Horizon.ts b/ts/fixtures/lang/expected/keys.Horizon.ts index 0932b50db..97bb8a369 100644 --- a/ts/fixtures/lang/expected/keys.Horizon.ts +++ b/ts/fixtures/lang/expected/keys.Horizon.ts @@ -11,7 +11,7 @@ export function eq$PartialEq(self: Horizon, other: Horizon): boolean { } export function hash$Hash_DefaultHasher(self: Horizon, state: rt.Hasher): void { - rt.hashOption(Hop.hash$Hash_DefaultHasher)(self.exclude, state); + rt.hashOption(Hop.hash$Hash_DefaultHasher as (a0: Hop.Hop, a1: rt.Hasher) => undefined)(self.exclude, state); rt.hash8(self.local, state); } diff --git a/ts/fixtures/lang/expected/keys.Seen.ts b/ts/fixtures/lang/expected/keys.Seen.ts index 73eef2528..cc30aacc6 100644 --- a/ts/fixtures/lang/expected/keys.Seen.ts +++ b/ts/fixtures/lang/expected/keys.Seen.ts @@ -54,7 +54,7 @@ export function cmp$Ord(self: Seen, other: Seen): rt.Ordering { export function hash$Hash_DefaultHasher(self: Seen, state: rt.Hasher): void { rt.hash32({ Hop: 0, Twice: 1, Text: 2, Name: 3, Mut: 4 }[self.tag], state); if (self.tag === "Hop") { - rt.hashOption(Hop.hash$Hash_DefaultHasher)(self._0, state); + rt.hashOption(Hop.hash$Hash_DefaultHasher as (a0: Hop.Hop, a1: rt.Hasher) => undefined)(self._0, state); } else if (self.tag === "Twice") { Horizon.hash$Hash_DefaultHasher(self._0, state); } else if (self.tag === "Text") { diff --git a/ts/fixtures/lang/expected/keys.ts b/ts/fixtures/lang/expected/keys.ts index 6ab87fcb6..4ed990272 100644 --- a/ts/fixtures/lang/expected/keys.ts +++ b/ts/fixtures/lang/expected/keys.ts @@ -103,7 +103,7 @@ export function hashOf$Name(value: Name.Name): rt.u64 { export function hashOf$Option_Hop(value: Hop.Hop | undefined): rt.u64 { const h: rt.Hasher = rt.hasher(); - rt.hashOption(Hop.hash$Hash_DefaultHasher)(value, h); + rt.hashOption(Hop.hash$Hash_DefaultHasher as (a0: Hop.Hop, a1: rt.Hasher) => undefined)(value, h); return rt.hashFinish(h); } @@ -536,11 +536,11 @@ export function options(data: rt.ByteSlice, out: rt.ByteVec): void { return way(b2); }); }; - const hashed: rt.HashMap<[rt.u8, Horizon.Horizon], rt.u8> = rt.hashNew(rt.hashing(rt.hashTuple([rt.hash8, Horizon.hash$Hash_DefaultHasher]), rt.eqTuple([rt.same, Horizon.eq$PartialEq]))) as rt.HashMap<[rt.u8, Horizon.Horizon], rt.u8>; + const hashed: rt.HashMap<[rt.u8, Horizon.Horizon], rt.u8> = rt.hashNew(rt.hashing(rt.hashTuple([rt.hash8, Horizon.hash$Hash_DefaultHasher as (a0: Horizon.Horizon, a1: rt.Hasher) => undefined]), rt.eqTuple([rt.same, Horizon.eq$PartialEq]))) as rt.HashMap<[rt.u8, Horizon.Horizon], rt.u8>; const sorted: rt.BTreeMap<[rt.u8, Horizon.Horizon], rt.u8> = rt.btreeNew(rt.cmpTuple([rt.cmp, Horizon.cmp$Ord])) as rt.BTreeMap<[rt.u8, Horizon.Horizon], rt.u8>; - const ways: rt.HashMap<[Way.Way | undefined, boolean], rt.u8> = rt.hashNew(rt.hashing(rt.hashTuple([rt.hashOption(Way.hash$Hash_DefaultHasher), rt.hash8]), rt.eqTuple([rt.eqOption(Way.eq$PartialEq), rt.same]))) as rt.HashMap<[Way.Way | undefined, boolean], rt.u8>; - const bare: rt.HashMap = rt.hashNew(rt.hashing(rt.hashOption(Way.hash$Hash_DefaultHasher), rt.eqOption(Way.eq$PartialEq), true)) as rt.HashMap; - const deep: rt.HashSet = rt.hashNew(rt.hashing(rt.hashOption(rt.hashOption(Way.hash$Hash_DefaultHasher), rt.None), rt.eqOption(rt.eqOption(Way.eq$PartialEq), rt.None), true)) as rt.HashSet; + const ways: rt.HashMap<[Way.Way | undefined, boolean], rt.u8> = rt.hashNew(rt.hashing(rt.hashTuple([rt.hashOption(Way.hash$Hash_DefaultHasher as (a0: Way.Way, a1: rt.Hasher) => undefined), rt.hash8]), rt.eqTuple([rt.eqOption(Way.eq$PartialEq), rt.same]))) as rt.HashMap<[Way.Way | undefined, boolean], rt.u8>; + const bare: rt.HashMap = rt.hashNew(rt.hashing(rt.hashOption(Way.hash$Hash_DefaultHasher as (a0: Way.Way, a1: rt.Hasher) => undefined), rt.eqOption(Way.eq$PartialEq), true)) as rt.HashMap; + const deep: rt.HashSet = rt.hashNew(rt.hashing(rt.hashOption(rt.hashOption(Way.hash$Hash_DefaultHasher as (a0: Way.Way, a1: rt.Hasher) => undefined), rt.None), rt.eqOption(rt.eqOption(Way.eq$PartialEq), rt.None), true)) as rt.HashSet; let iterStart: rt.usize = 1; const iterEnd: rt.usize = data.length; while ((_12 = iterStart++) < iterEnd) { @@ -701,7 +701,7 @@ export function places(data: rt.ByteSlice, out: rt.ByteVec): void { let _257!: rt.u8; const counts: rt.BTreeMap = rt.btreeNew(rt.cmp) as rt.BTreeMap; const wide: rt.HashMap = rt.hashNew() as rt.HashMap; - const hops: rt.HashMap = rt.hashNew(rt.hashing(Hop.hash$Hash_DefaultHasher, Hop.eq$PartialEq)) as rt.HashMap; + const hops: rt.HashMap = rt.hashNew(rt.hashing(Hop.hash$Hash_DefaultHasher as (a0: Hop.Hop, a1: rt.Hasher) => undefined, Hop.eq$PartialEq)) as rt.HashMap; const pairs: rt.BTreeMap = rt.btreeNew(Hop.cmp$Ord) as rt.BTreeMap; const iter: rt.Iter<[rt.usize, rt.u8]> = rt.iterEnumerate(rt.iterSlice(rt.byteSliceView(data))); while (true) { @@ -813,7 +813,7 @@ export function places(data: rt.ByteSlice, out: rt.ByteVec): void { return 7; }); _195.v = rt.u8Add(_195.v, 1); - const hashy: rt.HashMap = rt.hashNew(rt.hashing(Touchy.hash$Hash_DefaultHasher, Touchy.eq$PartialEq)) as rt.HashMap; + const hashy: rt.HashMap = rt.hashNew(rt.hashing(Touchy.hash$Hash_DefaultHasher as (a0: Touchy.Touchy, a1: rt.Hasher) => undefined, Touchy.eq$PartialEq)) as rt.HashMap; const _203: rt.Place = rt.entryOrInsertWithMut(rt.entry(hashy, { _0: data.length & 0xff }), (): rt.u8 => { return 0; }); @@ -822,7 +822,7 @@ export function places(data: rt.ByteSlice, out: rt.ByteVec): void { const c2: rt.Place = rt.entryOrInsertWithMut(rt.entry(counts, 0), (): rt.usize => { return 0; }); - ((): void => { + ((): undefined => { c2.v = rt.usizeAdd(c2.v, 1); })(); const spare: rt.usize[] = [data.length, 8]; @@ -1465,7 +1465,7 @@ export function lentValues(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): vo const _90: rt.ByteSlice = rt.byteSliceFrom(rt.entryOrInsert(rt.entry(map, at), Uint8Array.of(at, at))); _90.data[_90.start + 1] = _90.data[_90.start + 1] ^ 1; const _97: rt.Entry = rt.entry(map, at); - const f = (v4: rt.ByteSlice): void => { + const f = (v4: rt.ByteSlice): undefined => { const _3: rt.u8 = rt.u8WrappingAdd(v4.data[v4.start], 1); v4.data[v4.start] = _3; }; diff --git a/ts/fixtures/lang/expected/locals.ts b/ts/fixtures/lang/expected/locals.ts index a6f9accf0..80063a4ca 100644 --- a/ts/fixtures/lang/expected/locals.ts +++ b/ts/fixtures/lang/expected/locals.ts @@ -8,7 +8,7 @@ import { mapOr$18ipla0 } from "./core/result.ts"; import * as Noisy from "./locals.Noisy.ts"; import type * as Polling from "./locals.Polling.ts"; import type * as Twin from "./locals.Twin.ts"; -import { set$0fx7125, get$1jdtkm4, get$1ei2eoj, take$09yi5f2, replace$0kxb7te, withBorrow$1qygtee, withBorrow$1k8k9m1, withBorrow$0r4ucls, withBorrow$1t1sbub, withBorrow$15ql9sa, take$1x34chv, take$122f15k, replace$0bb3zeq, replace$1xk72wn } from "./std/thread/local.ts"; +import { set$0st49po, get$1jdtkm4, get$1ei2eoj, take$09yi5f2, replace$0kxb7te, withBorrow$1qygtee, withBorrow$1k8k9m1, withBorrow$0r4ucls, withBorrow$1t1sbub, withBorrow$15ql9sa, take$1x34chv, take$122f15k, replace$0bb3zeq, replace$1xk72wn } from "./std/thread/local.ts"; export const COUNT: rt.LocalKey> = /* @__PURE__ */ new rt.LocalKey(COUNT$init, false); @@ -90,14 +90,14 @@ export function locals(data: rt.ByteSlice, out: rt.ByteVec): void { for (const op of rt.byteSliceView(data)) { const _46: rt.u8 = rt.u8Rem(op, 9); if (_46 === 0) { - ((c4: rt.Cell): void => { + ((c4: rt.Cell): undefined => { rt.cellSet(c4, rt.u32WrappingAdd(c4.v, op as rt.u32)); })(COUNT.get()); rt.byteVecPush(out, ((a02: rt.Cell): rt.u32 => { return a02.v; })(COUNT.get()) & 0xff); } else if (_46 === 1) { - ((log7: rt.RefCell): void => { + ((log7: rt.RefCell): undefined => { const _513: rt.RefCell = rt.refCellBorrowMut(log7); rt.byteVecPush(_513.value, op); rt.refMutRelease(_513); @@ -141,7 +141,7 @@ export function locals(data: rt.ByteSlice, out: rt.ByteVec): void { })); rt.byteVecPush(out, len & 0xff); } else if (_46 === 5) { - ((held3: rt.RefCell): void => { + ((held3: rt.RefCell): undefined => { const _316: Noisy.Noisy | undefined = new Noisy.Noisy(op, rt.arcClone(log)); const _94: rt.RefCell = rt.refCellBorrowMut(held3); rt.drop(_94.value); @@ -149,17 +149,17 @@ export function locals(data: rt.ByteSlice, out: rt.ByteVec): void { rt.refMutRelease(_94); })(HELD.get()); } else if (_46 === 6) { - set$0fx7125(COUNT, rt.u32WrappingMul(get$1ei2eoj(COUNT), 3)); + set$0st49po(COUNT, rt.u32WrappingMul(get$1ei2eoj(COUNT), 3)); rt.byteVecPush(out, replace$0kxb7te(COUNT, op as rt.u32) & 0xff); rt.byteVecPush(out, take$09yi5f2(COUNT) & 0xff); - set$0fx7125(COUNT, rt.u32Add(op as rt.u32, 1)); + set$0st49po(COUNT, rt.u32Add(op as rt.u32, 1)); const _103: [Twin.Twin, Twin.Twin] = get$1jdtkm4(PAIRS); rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_103[0]._0 & 0xff, _103[0]._1 & 0xff, _103[1]._0 & 0xff, _103[1]._1 & 0xff)), undefined, true); rt.byteVecPush(out, mapOr$1w5qtj7(thenSome$1d6toqn(rt.u8Rem(op, 2) === 0, undefined), 253, (_22: undefined): rt.u8 => { return 1; })); } else if (_46 === 7) { - rt.localKeyWithBorrowMut(LOG, (log3: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log3: rt.ByteVec): undefined => { rt.byteVecPush(log3, op); }); rt.byteVecPush(out, withBorrow$0r4ucls(LOG, (log4: rt.ByteVec): rt.u8 => { @@ -172,7 +172,7 @@ export function locals(data: rt.ByteSlice, out: rt.ByteVec): void { const _141: rt.LocalKey> = HELD; const _144: rt.Arc> = rt.arcClone(log); rt.localKeyRefCellSet(_141, new Noisy.Noisy(op, _144), rt.drop); - rt.localKeyWithBorrowMutPlace(HELD, (held2: rt.Place): void => { + rt.localKeyWithBorrowMutPlace(HELD, (held2: rt.Place): undefined => { rt.drop(held2.v); held2.v = undefined; }); @@ -186,7 +186,7 @@ export function locals(data: rt.ByteSlice, out: rt.ByteVec): void { n3[Symbol.dispose](); return _012; })); - rt.localKeyWithBorrowMutPlace(TALLY, (tally2: rt.Place): void => { + rt.localKeyWithBorrowMutPlace(TALLY, (tally2: rt.Place): undefined => { tally2.v = rt.u32WrappingAdd(rt.u32WrappingMul(tally2.v, 3), op as rt.u32); }); rt.byteVecPush(out, withBorrow$1t1sbub(TALLY, (tally3: rt.u32): rt.u8 => { @@ -205,20 +205,20 @@ export function locals(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecClear(_188.value); rt.mutexUnlock(_188); } - ((c5: rt.Cell): void => { + ((c5: rt.Cell): undefined => { rt.cellSet(c5, 7); })(COUNT.get()); - ((tally5: rt.RefCell): void => { + ((tally5: rt.RefCell): undefined => { const _515: rt.RefCell = rt.refCellBorrowMut(tally5); _515.value = 0; rt.refMutRelease(_515); })(TALLY.get()); - ((log8: rt.RefCell): void => { + ((log8: rt.RefCell): undefined => { const _516: rt.RefCell = rt.refCellBorrowMut(log8); rt.byteVecTruncate(_516.value, 3); rt.refMutRelease(_516); })(LOG.get()); - ((p5: Polling.Polling): void => { + ((p5: Polling.Polling): undefined => { rt.cellSet(p5.current, undefined as [rt.u64, rt.u64] | undefined); const _911: rt.RefCell = rt.refCellBorrowMut(p5.held); rt.byteVecClear(_911.value); diff --git a/ts/fixtures/lang/expected/nested.Unit.ts b/ts/fixtures/lang/expected/nested.Unit.ts new file mode 100644 index 000000000..68cecf989 --- /dev/null +++ b/ts/fixtures/lang/expected/nested.Unit.ts @@ -0,0 +1,11 @@ +// Generated by rust2-ts. Do not edit. + +import * as rt from "./rt.ts"; + +export interface Unit { +} + +export function made$Made(_self: Unit, _2: rt.u8): void { +} + +//# sourceMappingURL=nested.Unit.ts.map diff --git a/ts/fixtures/lang/expected/nested.ts b/ts/fixtures/lang/expected/nested.ts index 395eaba40..812455bfa 100644 --- a/ts/fixtures/lang/expected/nested.ts +++ b/ts/fixtures/lang/expected/nested.ts @@ -2,17 +2,19 @@ import * as rt from "./rt.ts"; import { thenSome$0d5am30, thenSome$1j8foe9, then$16ew6vr } from "./core/bool.ts"; -import { isNoneOr$1s1o3ss, unwrapOr$0r2bmpr, unwrapOr$1la41a6, map$0pkankm, map$0jcaaxx, map$0ju5zoy, map$0rbsrz6, map$0cs071d, map$0at3a41, mapOr$06rr3sb, mapOr$1surhce, mapOr$1t0muvr, mapOr$18ph0j9, andThen$0qni7te, andThen$0ocv8av, andThen$1bd14ex, filter$19gtvc4, or$0j02yk0, xor$0pemq84, xor$0kctyix, flatten$1nwzx42 } from "./core/option.ts"; +import { isNoneOr$1s1o3ss, unwrapOr$0r2bmpr, unwrapOr$1la41a6, map$0pkankm, map$0jcaaxx, map$1diqi3e, map$0rbsrz6, map$0cs071d, map$0p22lts, map$0at3a41, mapOr$06rr3sb, mapOr$1surhce, mapOr$1t0muvr, mapOr$18ph0j9, okOr$1vxk0yk, okOr$0g9lvh7, andThen$0qni7te, andThen$0ocv8av, andThen$1bd14ex, filter$19gtvc4, filter$0v80fk8, or$0j02yk0, xor$0pemq84, xor$0kctyix, flatten$1nwzx42 } from "./core/option.ts"; +import { map$03hz3l7, mapErr$1whfgss } from "./core/result.ts"; import * as Halves from "./nested.Halves.ts"; import type * as Slot from "./nested.Slot.ts"; import * as Tagged from "./nested.Tagged.ts"; +import * as Unit from "./nested.Unit.ts"; /** - * Run case `kind % 7` over `data`, whose bytes pick each `None`, `Some(None)`, or + * Run case `kind % 8` over `data`, whose bytes pick each `None`, `Some(None)`, or * `Some(Some(_))`. */ export function nested(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { - const _4: rt.u8 = rt.u8Rem(kind, 7); + const _4: rt.u8 = rt.u8Rem(kind, 8); if (_4 === 0) { made(data, out); } else if (_4 === 1) { @@ -25,8 +27,10 @@ export function nested(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { panics(data, out); } else if (_4 === 5) { closures(data, out); - } else { + } else if (_4 === 6) { elements(data, out); + } else { + units(data, out); } } @@ -227,10 +231,10 @@ export function iters(data: rt.ByteSlice, out: rt.ByteVec): void { for (const _72 of rt.byteSliceView(data)) { const o: rt.u8 | undefined | rt.None = pick(_72); rt.byteVecPush(out, rt.iterCount(rt.iterOption(o, undefined, rt.None)) & 0xff); - rt.iterForEach(rt.iterOption(o, undefined, rt.None), (x2: rt.u8 | undefined): void => { + rt.iterForEach(rt.iterOption(o, undefined, rt.None), (x2: rt.u8 | undefined): undefined => { rt.byteVecPush(out, unwrapOr$0r2bmpr(x2, 225)); }); - rt.iterForEach(rt.iterOption(unit(_72), undefined, rt.None), (_: undefined): void => { + rt.iterForEach(rt.iterOption(unit(_72), undefined, rt.None), (_: undefined): undefined => { rt.byteVecPush(out, 209); }); } @@ -480,17 +484,17 @@ export function elements(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecPush(out, code(andThen$0ocv8av(rt.sliceGetRange(rt.sliceRange(v, 0), at), (s: Array): rt.u8 | undefined | rt.None => { return rt.sliceFirst(s, rt.None); }))); - map$0ju5zoy(rt.sliceFirstMut(v), (o8: rt.Place): void => { + map$1diqi3e(rt.sliceFirstMut(v), (o8: rt.Place): undefined => { o8.v = mapOr$06rr3sb(o8.v, 66, (_26: rt.u8): rt.u8 | undefined => { return undefined; }); }); - map$0ju5zoy(rt.sliceLastMut(v), (o9: rt.Place): void => { + map$1diqi3e(rt.sliceLastMut(v), (o9: rt.Place): undefined => { o9.v = mapOr$06rr3sb(o9.v, 66, (_27: rt.u8): rt.u8 | undefined => { return undefined; }); }); - map$0ju5zoy(rt.sliceGetMut(v, at), (o10: rt.Place): void => { + map$1diqi3e(rt.sliceGetMut(v, at), (o10: rt.Place): undefined => { o10.v = mapOr$06rr3sb(o10.v, 66, (_210: rt.u8): rt.u8 | undefined => { return undefined; }); @@ -505,11 +509,11 @@ export function elements(data: rt.ByteSlice, out: rt.ByteVec): void { } } rt.byteVecPush(out, code(rt.vecPop(v, rt.None))); - const units: undefined[] = rt.vecFromElem(undefined, data.length, undefined); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.sliceFirst(units, rt.None) !== rt.None ? 1 : 0, rt.sliceLast(units, rt.None) !== rt.None ? 1 : 0, rt.sliceGet(units, at, rt.None) !== rt.None ? 1 : 0)), undefined, true); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.sliceFirstMut(units) !== undefined ? 1 : 0, rt.sliceLastMut(units) !== undefined ? 1 : 0, rt.sliceGetMut(units, at) !== undefined ? 1 : 0)), undefined, true); + const units_: undefined[] = rt.vecFromElem(undefined, data.length, undefined); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.sliceFirst(units_, rt.None) !== rt.None ? 1 : 0, rt.sliceLast(units_, rt.None) !== rt.None ? 1 : 0, rt.sliceGet(units_, at, rt.None) !== rt.None ? 1 : 0)), undefined, true); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.sliceFirstMut(units_) !== undefined ? 1 : 0, rt.sliceLastMut(units_) !== undefined ? 1 : 0, rt.sliceGetMut(units_, at) !== undefined ? 1 : 0)), undefined, true); let popped: rt.u8 = 0; - while (rt.vecPop(units, rt.None) !== rt.None) { + while (rt.vecPop(units_, rt.None) !== rt.None) { popped = rt.u8Add(popped, 1); } rt.byteVecPush(out, popped); @@ -529,17 +533,17 @@ export function elements(data: rt.ByteSlice, out: rt.ByteVec): void { } } rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(code(rt.dequeEnd(q, false, rt.None)), code(rt.dequeEnd(q, true, rt.None)), code(rt.dequeGet(q, at, rt.None)))), undefined, true); - map$0ju5zoy(rt.dequeEndMut(q), (o11: rt.Place): void => { + map$1diqi3e(rt.dequeEndMut(q), (o11: rt.Place): undefined => { o11.v = mapOr$06rr3sb(o11.v, 66, (_211: rt.u8): rt.u8 | undefined => { return undefined; }); }); - map$0ju5zoy(rt.dequeEndMut(q, true), (o12: rt.Place): void => { + map$1diqi3e(rt.dequeEndMut(q, true), (o12: rt.Place): undefined => { o12.v = mapOr$06rr3sb(o12.v, 66, (_216: rt.u8): rt.u8 | undefined => { return undefined; }); }); - map$0ju5zoy(rt.dequeGetMut(q, at), (o13: rt.Place): void => { + map$1diqi3e(rt.dequeGetMut(q, at), (o13: rt.Place): undefined => { o13.v = mapOr$06rr3sb(o13.v, 66, (_220: rt.u8): rt.u8 | undefined => { return undefined; }); @@ -651,4 +655,83 @@ export function panics(data: rt.ByteSlice, out: rt.ByteVec): void { } } +export function ignore(_1: rt.u8): void { +} + +export function half(b: rt.u8): rt.u8 { + return rt.u8Div(b, 2); +} + +/** Each of `data` through `f`, read from its parameter: a function item too. */ +export function each$u8_half(data: rt.ByteSlice, _: (a0: rt.u8) => rt.u8): rt.ByteVec { + return rt.iterToByteVec(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), half), undefined, true); +} + +/** Each of `data` through `f`, read from its parameter: a function item too. */ +export function each$unit_ignore(data: rt.ByteSlice, _: (a0: rt.u8) => undefined): undefined[] { + return rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), ignore as (a0: rt.u8) => undefined), undefined, 0, true); +} + +/** Each of `data` through `f`, read from its parameter: a function item too. */ +export function each$unit_units_closure3(data: rt.ByteSlice, f: (a0: rt.u8) => undefined): undefined[] { + return rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), f), undefined, 0, true); +} + +/** Each of `data` through a pointer. */ +export function pointed(data: rt.ByteSlice, f: (a0: rt.u8) => undefined): undefined[] { + return rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), f), undefined, 0, true); +} + +export function madeAll$Unit(m: Unit.Unit, data: rt.ByteSlice): undefined[] { + return rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), (_2: rt.u8): undefined => { + Unit.made$Made(m, _2); + }), undefined, 0, true); +} + +/** + * The `()` results of closures, functions, pointers, a `dyn Fn`, and a method returning an + * associated type, as the items of a `Vec`, a `VecDeque`, an `Option`, and a `Result`. + */ +export function units(data: rt.ByteSlice, out: rt.ByteVec): void { + let f!: (a0: rt.u8) => undefined; + const units_: undefined[] = rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), (_2: rt.u8): undefined => {}), undefined, 0, true); + const _7: rt.Iter = rt.iterMap(rt.iterRev(rt.iterSlice(rt.byteSliceView(data))), (_22: rt.u8): undefined => {}); + const q: rt.VecDeque = rt.dequeExtend(rt.dequeNew() as rt.VecDeque, _7, undefined, 0, true); + const named: undefined[] = rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), ignore as (a0: rt.u8) => undefined), undefined, 0, true); + const _15: rt.u8 | undefined = rt.byteSliceFirst(data); + b0: { + if (_15 !== undefined) { + if (rt.u8Rem(_15, 2) === 0) { + f = ignore as (a0: rt.u8) => undefined; + break b0; + } + } + f = (_24: rt.u8): undefined => {}; + } + const byPointer: undefined[] = pointed(data, f); + const generic: undefined[] = each$unit_units_closure3(data, (_25: rt.u8): undefined => {}); + const byName: undefined[] = each$unit_ignore(data, ignore as (a0: rt.u8) => undefined); + rt.iterExtendBytes(out, rt.iterSlice(rt.byteVecView(each$u8_half(data, half))), undefined, true); + const methods: undefined[] = madeAll$Unit({}, data); + const dynamic: undefined[] = rt.iterToArray(rt.iterMap(rt.iterSlice(rt.byteSliceView(data)), rt.lent(ignore as (a0: rt.u8) => undefined)), undefined, 0, true); + const iter: rt.Iter = rt.iterSlice([units_, named, byPointer, generic, byName, methods, dynamic]); + while (true) { + const _46: undefined[] | rt.Done = iter.next(); + if (_46 === rt.DONE) { + break; + } + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_46.length & 0xff, rt.sliceFirst(_46, rt.None) !== rt.None ? 1 : 0, rt.iterCount(rt.iterSlice(_46)) & 0xff)), undefined, true); + } + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(q.n & 0xff, rt.dequeEnd(q, true, rt.None) !== rt.None ? 1 : 0)), undefined, true); + const o: undefined | rt.None = map$0p22lts(rt.byteSliceFirst(data), (_26: rt.u8): undefined => {}); + const none: undefined | rt.None = map$0p22lts(filter$0v80fk8(rt.byteSliceGet(data, 1), (b: rt.u8): boolean => { + return rt.u8Rem(b, 2) === 0; + }), (_28: rt.u8): undefined => {}); + const r: rt.Result = map$03hz3l7(okOr$1vxk0yk(rt.byteSliceFirst(data), 238), (_210: rt.u8): undefined => {}); + const e: rt.Result = mapErr$1whfgss(okOr$0g9lvh7(rt.byteSliceFirst(data), undefined), (_: undefined): undefined => {}); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(o !== rt.None ? 1 : 0, none !== rt.None ? 1 : 0, r.ok ? 1 : 0, !e.ok ? 1 : 0)), undefined, true); + const args2: rt.Fmt[] = [(f: rt.Formatter) => rt.fmtList(units_, f, rt.fmtUnit), (f: rt.Formatter) => rt.fmtOption(o, f, rt.fmtUnit, rt.None), (f: rt.Formatter) => rt.fmtOption(none, f, rt.fmtUnit, rt.None), (f: rt.Formatter) => rt.fmtResult(r, f, rt.fmtUnit, rt.u8Debug), (f: rt.Formatter) => rt.fmtResult(e, f, rt.u8Debug, rt.fmtUnit)]; + rt.iterExtendBytes(out, rt.iterSlice(rt.byteSliceView(rt.stringAsBytes(rt.fmtFormat([args2[0], " ", args2[1], " ", args2[2], " ", args2[3], " ", args2[4]])))), undefined, true); +} + //# sourceMappingURL=nested.ts.map diff --git a/ts/fixtures/lang/expected/objects.ts b/ts/fixtures/lang/expected/objects.ts index 9df39affa..7f3a577f8 100644 --- a/ts/fixtures/lang/expected/objects.ts +++ b/ts/fixtures/lang/expected/objects.ts @@ -281,7 +281,7 @@ export function objects(data: rt.ByteSlice, out: rt.ByteVec): void { _81.v = _86; } let kept: rt.Arc = rt.arcClone(one); - ((to: rt.Arc): void => { + ((to: rt.Arc): undefined => { const _32: rt.Arc = rt.arcClone(to); kept[Symbol.dispose](); kept = _32; @@ -475,7 +475,7 @@ export function objects(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(Uint8Array.of(a.start, a.held.length & 0xff, b7.start, b7.held.length & 0xff))); rt.byteVecExtendFromSlice(out, rt.byteSliceFrom(Uint8Array.of(array[0] & 0xff, array[1] & 0xff))); const wakes: rt.Arc = new rt.Arc({ _0: new rt.Atomic(0) }); - const counting: rt.Waker = new rt.ArcWaker(rt.arcClone(wakes), Wakes.wake$Wake, (arc: rt.Arc) => arc[Symbol.dispose]()); + const counting: rt.Waker = new rt.ArcWaker(rt.arcClone(wakes), Wakes.wake$Wake as (a0: rt.Arc) => undefined, (arc: rt.Arc) => arc[Symbol.dispose]()); const noop: rt.Waker = rt.NOOP_WAKER.clone(); let w2: rt.Waker = noop.clone(); for (const _619 of rt.byteSliceView(data)) { diff --git a/ts/fixtures/lang/expected/orders.ts b/ts/fixtures/lang/expected/orders.ts index 47132ab83..4a5b4984b 100644 --- a/ts/fixtures/lang/expected/orders.ts +++ b/ts/fixtures/lang/expected/orders.ts @@ -14,14 +14,14 @@ export function LOG$init(): rt.RefCell { export function log(entry: Uint8Array): void { const _5: rt.ByteSlice = rt.byteSliceFrom(entry); - rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): undefined => { rt.iterExtendBytes(log_, rt.iterSlice(rt.byteSliceToArray(_5)), undefined, true); }); } /** Puts what was logged since the last flush. */ export function flush(out: rt.ByteVec): void { - rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log_: rt.ByteVec): undefined => { rt.byteVecExtendFromSlice(out, rt.byteVecSlice(log_)); rt.byteVecClear(log_); }); diff --git a/ts/fixtures/lang/expected/pointers.Wrapped.ts b/ts/fixtures/lang/expected/pointers.Wrapped.ts index 27d77aa59..3e6c2156c 100644 --- a/ts/fixtures/lang/expected/pointers.Wrapped.ts +++ b/ts/fixtures/lang/expected/pointers.Wrapped.ts @@ -28,19 +28,19 @@ export function with$Held_u8_cells_closure4(self: Wrapped, f: (a0: He return f(self._0.v); } -export function withMut$Held_unit_cells_closure0(self: Wrapped, f: (a0: Held.Held) => void): void { +export function withMut$Held_unit_cells_closure0(self: Wrapped, f: (a0: Held.Held) => undefined): void { f(self._0.v); } -export function withMut$Held_unit_cells_closure1(self: Wrapped, f: (a0: Held.Held) => void): void { +export function withMut$Held_unit_cells_closure1(self: Wrapped, f: (a0: Held.Held) => undefined): void { f(self._0.v); } -export function withMut$Held_unit_cells_closure3(self: Wrapped, f: (a0: Held.Held) => void): void { +export function withMut$Held_unit_cells_closure3(self: Wrapped, f: (a0: Held.Held) => undefined): void { f(self._0.v); } -export function withMut$Held_unit_cells_closure5(self: Wrapped, f: (a0: Held.Held) => void): void { +export function withMut$Held_unit_cells_closure5(self: Wrapped, f: (a0: Held.Held) => undefined): void { f(self._0.v); } diff --git a/ts/fixtures/lang/expected/pointers.ts b/ts/fixtures/lang/expected/pointers.ts index fb48b702c..ee3b9ddc4 100644 --- a/ts/fixtures/lang/expected/pointers.ts +++ b/ts/fixtures/lang/expected/pointers.ts @@ -408,7 +408,7 @@ export function cells(data: rt.ByteSlice, out: rt.ByteVec): void { const fresh: Held.Held = new Held.Held(n, _99); if (rt.u8Rem(n, 2) === 0) { const captured2 = fresh; - Wrapped.withMut$Held_unit_cells_closure0(held, rt.closure((p6: Held.Held): void => { + Wrapped.withMut$Held_unit_cells_closure0(held, rt.closure((p6: Held.Held): undefined => { const _311: Held.Held = captured2; p6[Symbol.dispose](); rt.ptrWrite(p6, _311); @@ -417,7 +417,7 @@ export function cells(data: rt.ByteSlice, out: rt.ByteVec): void { })); } else { const captured = fresh; - Wrapped.withMut$Held_unit_cells_closure1(held, rt.closure((p5: Held.Held): void => { + Wrapped.withMut$Held_unit_cells_closure1(held, rt.closure((p5: Held.Held): undefined => { rt.ptrWrite(p5, captured); }, (): void => { captured[Symbol.dispose](); @@ -427,7 +427,7 @@ export function cells(data: rt.ByteSlice, out: rt.ByteVec): void { return p7.n; }), count.strong & 0xff)), undefined, true); } else if (_23 === 5) { - Wrapped.withMut$Held_unit_cells_closure3(held, (p3: Held.Held): void => { + Wrapped.withMut$Held_unit_cells_closure3(held, (p3: Held.Held): undefined => { p3.n = rt.u8WrappingAdd(p3.n, n); }); const _119: Held.Held = held._0.v; @@ -444,7 +444,7 @@ export function cells(data: rt.ByteSlice, out: rt.ByteVec): void { } else { const _142: rt.Arc = rt.arcClone(count); const made_: Wrapped.Wrapped = Wrapped.new$Held(new Held.Held(n, _142)); - Wrapped.withMut$Held_unit_cells_closure5(made_, (p2: Held.Held): void => { + Wrapped.withMut$Held_unit_cells_closure5(made_, (p2: Held.Held): undefined => { p2.n = p2.n ^ 85; }); rt.byteVecPush(out, count.strong & 0xff); @@ -607,9 +607,9 @@ export function put$ByCall(slot: ByCall.ByCall, value: ByCall.ByCall): void { Object.assign(slot, copy$ByCall(value)); } -export function resetter$ByClosure(slot: ByClosure.ByClosure): () => void { +export function resetter$ByClosure(slot: ByClosure.ByClosure): () => undefined { const captured = slot; - return (): void => { + return (): undefined => { rt.ptrWrite(captured, copy$ByClosure(ByClosure.default$Default())); }; } diff --git a/ts/fixtures/lang/expected/refs.ts b/ts/fixtures/lang/expected/refs.ts index da1ef0b9f..7e599627d 100644 --- a/ts/fixtures/lang/expected/refs.ts +++ b/ts/fixtures/lang/expected/refs.ts @@ -22,7 +22,7 @@ export function bump(x: rt.Place, by: rt.u8): void { export function bumpThrice(x: rt.Place, by: rt.u8): void { bump(x, by); bump(x, 1); - ((n: rt.u8): void => { + ((n: rt.u8): undefined => { bump(x, n); })(by); } @@ -64,7 +64,7 @@ export function rename(name: rt.Place, b: rt.u8): string | u /** A `&mut Option` passed on from inside a closure std calls. */ export function largestOf(seen: rt.Place, items: rt.ByteSlice): rt.u8 { let taken_: rt.u8 = 0; - rt.iterForEach(rt.iterSlice(rt.byteSliceView(items)), (_2: rt.u8): void => { + rt.iterForEach(rt.iterSlice(rt.byteSliceView(items)), (_2: rt.u8): undefined => { if (takeLargest(seen, _2) !== undefined) { taken_ = rt.u8WrappingAdd(taken_, 1); } @@ -174,7 +174,7 @@ export function refs(data: rt.ByteSlice, out: rt.ByteVec): void { return unwrapOr$0r2bmpr(o2, 238); }); }; - const _275: (a0: rt.Place, a1: rt.u8) => void = (x3: rt.Place, b8: rt.u8): void => { + const _275: (a0: rt.Place, a1: rt.u8) => undefined = (x3: rt.Place, b8: rt.u8): undefined => { bump(x3, b8); }; const by: rt.u8 = unwrapOr$0r2bmpr(rt.byteSliceFirst(data), 3); @@ -508,7 +508,7 @@ export function defaulted(data: rt.ByteSlice, out: rt.ByteVec): void { (_16.v as Listing.Listing).source = _17; } else if (_11 === 3) { const _22: rt.Place = rt.place(() => listing, (value2) => listing = value2); - const relist: (a0: rt.u8) => void = (b2: rt.u8): void => { + const relist: (a0: rt.u8) => undefined = (b2: rt.u8): undefined => { if (_22.v === undefined) { _22.v = Listing.default$Default(); } @@ -566,7 +566,7 @@ export function taken(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecPush(held, rt.u8Div(x, 2)); } } - ((): void => { + ((): undefined => { const _34: rt.u32[] = []; const old2 = wide; wide = _34; @@ -593,13 +593,13 @@ export function taken(data: rt.ByteSlice, out: rt.ByteVec): void { const _45: rt.ByteVec = swap(_39); rt.iterExtendBytes(swapped, rt.iterSlice(rt.byteVecView(_45)), undefined, true); } - const list_: (a0: rt.u8) => void = (b6: rt.u8): void => { + const list_: (a0: rt.u8) => undefined = (b6: rt.u8): undefined => { const taken2 = pair[1].listed; pair[1].listed = new rt.ByteVec(); pair[1].stale = taken2; rt.byteVecPush(pair[1].listed, b6); }; - rt.iterForEach(rt.iterSlice(rt.byteSliceView(data)), (_26: rt.u8): void => { + rt.iterForEach(rt.iterSlice(rt.byteSliceView(data)), (_26: rt.u8): undefined => { list_(_26); }); for (const _57 of rt.byteSliceView(data)) { @@ -753,11 +753,11 @@ export function elements(data: rt.ByteSlice, out: rt.ByteVec): void { const tree: rt.BTreeMap = rt.btreeNew(rt.cmp) as rt.BTreeMap; const queue: rt.VecDeque = rt.dequeNew() as rt.VecDeque; for (const b2 of rt.byteSliceView(data)) { - rt.entryOrInsert(rt.entryAndModify(rt.entry(hash, rt.u8Rem(b2, 5)), (x9: [rt.u8, rt.u8]): void => { + rt.entryOrInsert(rt.entryAndModify(rt.entry(hash, rt.u8Rem(b2, 5)), (x9: [rt.u8, rt.u8]): undefined => { x9[1] = rt.u8WrappingAdd(x9[1], b2); }), [b2, 0] as [rt.u8, rt.u8]); const _213: rt.u32 = b2 as rt.u32; - const _214: rt.Place = rt.entryOrInsertWithMut(rt.entryAndModifyMut(rt.entry(tree, rt.u8Rem(b2, 4)), (x10: rt.Place): void => { + const _214: rt.Place = rt.entryOrInsertWithMut(rt.entryAndModifyMut(rt.entry(tree, rt.u8Rem(b2, 4)), (x10: rt.Place): undefined => { x10.v = rt.u32Add(x10.v, 1); }), (): rt.u32 => { return 0; diff --git a/ts/fixtures/lang/expected/shapes.ts b/ts/fixtures/lang/expected/shapes.ts index 1bb32becb..48ad9fb1c 100644 --- a/ts/fixtures/lang/expected/shapes.ts +++ b/ts/fixtures/lang/expected/shapes.ts @@ -1447,7 +1447,7 @@ export function payloads(data: rt.ByteSlice, out: rt.ByteVec): void { } } let caught: rt.Result = parity(rt.u8WrappingAdd(n, 3)); - const bump_: () => void = (): void => { + const bump_: () => undefined = (): undefined => { if (!caught.ok) { caught = rt.Err(rt.u8WrappingAdd(caught.error, 5)); } @@ -2058,7 +2058,7 @@ export function reseated(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecPush(out, _19); let r3: Shape.Shape = a; if (r3.tag === "Dot") { - ((): void => { + ((): undefined => { r3 = b; })(); if ((r3 as Shape.Shape).tag === "Line") { @@ -2176,7 +2176,7 @@ export function uninhabited(data: rt.ByteSlice, out: rt.ByteVec): void { /** Closures capturing by reference and by move, and functions as values. */ export function closures(data: rt.ByteSlice, out: rt.ByteVec): void { let sum: rt.u32 = 0; - const add: (a0: rt.u8) => void = (v: rt.u8): void => { + const add: (a0: rt.u8) => undefined = (v: rt.u8): undefined => { sum = rt.u32Add(sum, v as rt.u32); }; for (const _8 of rt.byteSliceView(data)) { @@ -2212,7 +2212,7 @@ export function closures(data: rt.ByteSlice, out: rt.ByteVec): void { /** Replaces `a` whole from a closure. */ export function overwrite(a: rt.ByteSlice): void { - ((): void => { + ((): undefined => { a.data.set(Uint8Array.of(9), a.start); })(); } diff --git a/ts/fixtures/lang/expected/slices.Counted.ts b/ts/fixtures/lang/expected/slices.Counted.ts index 4dfc24ca2..0bfa358c8 100644 --- a/ts/fixtures/lang/expected/slices.Counted.ts +++ b/ts/fixtures/lang/expected/slices.Counted.ts @@ -12,7 +12,7 @@ export interface Counted { } export function clone$Clone(self: Counted): Counted { - rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): undefined => { rt.byteVecPush(log, self.n ^ 64); }); return self; diff --git a/ts/fixtures/lang/expected/slices.Item.ts b/ts/fixtures/lang/expected/slices.Item.ts index c74d49fc1..e786158d0 100644 --- a/ts/fixtures/lang/expected/slices.Item.ts +++ b/ts/fixtures/lang/expected/slices.Item.ts @@ -17,7 +17,7 @@ export class Item { } export function drop$Drop(self: Item): void { - rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): undefined => { rt.byteVecPush(log, self.tag); }); } diff --git a/ts/fixtures/lang/expected/slices.Noisy.ts b/ts/fixtures/lang/expected/slices.Noisy.ts index 4f69cffb8..0a9f41399 100644 --- a/ts/fixtures/lang/expected/slices.Noisy.ts +++ b/ts/fixtures/lang/expected/slices.Noisy.ts @@ -20,14 +20,14 @@ export class Noisy { } export function clone$Clone(self: Noisy): Noisy { - rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): undefined => { rt.byteVecPush(log, self.tag | 128); }); return new Noisy(rt.u8WrappingAdd(self.tag, 1)); } export function drop$Drop(self: Noisy): void { - rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): undefined => { rt.byteVecPush(log, self.tag); }); } diff --git a/ts/fixtures/lang/expected/slices.ts b/ts/fixtures/lang/expected/slices.ts index f7a9c1669..6b53ade07 100644 --- a/ts/fixtures/lang/expected/slices.ts +++ b/ts/fixtures/lang/expected/slices.ts @@ -16,7 +16,7 @@ export function LOG$init(): rt.RefCell { /** Puts which items dropped since the last flush. */ export function flush(out: rt.ByteVec): void { - rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): undefined => { rt.byteVecExtendFromSlice(out, rt.byteVecSlice(log)); rt.byteVecClear(log); }); @@ -1829,7 +1829,7 @@ export function edits(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { flush(out); let tag: rt.u8 = 96; rt.sliceFillWith(rt.sliceRangeMut(items, a), (): Noisy.Noisy => { - rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): void => { + rt.localKeyWithBorrowMut(LOG, (log: rt.ByteVec): undefined => { rt.byteVecPush(log, 254); }); tag = rt.u8Add(tag, 1); diff --git a/ts/fixtures/lang/expected/statics.Lock.ts b/ts/fixtures/lang/expected/statics.Lock.ts index ebfa40fec..a8cd6fc3e 100644 --- a/ts/fixtures/lang/expected/statics.Lock.ts +++ b/ts/fixtures/lang/expected/statics.Lock.ts @@ -31,7 +31,7 @@ export function getOrInit$Collector_onces_closure5(self: Lock { + rt.onceCall(self.once, (): undefined => { rt.ptrWrite(slot, captured()); }); } @@ -45,7 +45,7 @@ export function getOrInit$Rc_unit_onces_closure6(self: Lock>, const slot: rt.Place> = self.value; _14 = false; const captured = f; - rt.onceCall(self.once, rt.closure((): void => { + rt.onceCall(self.once, rt.closure((): undefined => { slot.v = captured(); }, (): void => { rt.drop(captured); @@ -65,7 +65,7 @@ export function getOrInit$Rc_unit_onces_closure7(self: Lock>, const slot: rt.Place> = self.value; _14 = false; const captured = f; - rt.onceCall(self.once, rt.closure((): void => { + rt.onceCall(self.once, rt.closure((): undefined => { slot.v = captured(); }, (): void => { rt.drop(captured); @@ -85,7 +85,7 @@ export function getOrInit$u8_Rc_unit_onces_closure8(self: Lock<[rt.u8, rt.Arc] = self.value.v; _14 = false; const captured = f; - rt.onceCall(self.once, rt.closure((): void => { + rt.onceCall(self.once, rt.closure((): undefined => { rt.ptrWrite(slot, captured()); }, (): void => { rt.drop(captured); @@ -106,7 +106,7 @@ export function getOrInit$u8_Rc_unit_onces_closure9(self: Lock<[rt.u8, rt.Arc] = self.value.v; _14 = false; const captured = f; - rt.onceCall(self.once, rt.closure((): void => { + rt.onceCall(self.once, rt.closure((): undefined => { rt.ptrWrite(slot, captured()); }, (): void => { rt.drop(captured); diff --git a/ts/fixtures/lang/expected/statics.ts b/ts/fixtures/lang/expected/statics.ts index acad6f742..8e250e083 100644 --- a/ts/fixtures/lang/expected/statics.ts +++ b/ts/fixtures/lang/expected/statics.ts @@ -251,13 +251,13 @@ export function onces(data: rt.ByteSlice, out: rt.ByteVec): void { const _13: rt.u8 = rt.u8Rem(op, 6); if (_13 === 0) { rt.byteVecPush(out, once.v === true ? 1 : 0); - rt.onceCall(once, (): void => { + rt.onceCall(once, (): undefined => { rt.byteVecPush(out, n); }); rt.byteVecPush(out, once.v === true ? 1 : 0); } else if (_13 === 1) { const captured5 = rt.arcClone(owned); - rt.onceCall(once, rt.closure((state: rt.OnceState): void => { + rt.onceCall(once, rt.closure((state: rt.OnceState): undefined => { rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.onceIsPoisoned(state) ? 1 : 0, once.v === true ? 1 : 0, n)), undefined, true); captured5[Symbol.dispose](); }, (): void => { @@ -266,10 +266,10 @@ export function onces(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecPush(out, owned.strong & 0xff); } else if (_13 === 2) { const fresh: rt.Once = new rt.OnceLock(undefined); - rt.onceCall(fresh, (): void => { + rt.onceCall(fresh, (): undefined => { rt.byteVecPush(out, fresh.v === true ? 1 : 0); if (rt.u8Rem(n, 2) === 1) { - rt.onceCall(fresh, (): void => { + rt.onceCall(fresh, (): undefined => { rt.byteVecPush(out, 238); }); } @@ -277,12 +277,12 @@ export function onces(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecPush(out, fresh.v === true ? 1 : 0); } else if (_13 === 3) { if (!(rt.u8Rem(n, 2) === 1)) { - rt.onceCall(STARTED, (): void => {}); + rt.onceCall(STARTED, (): undefined => {}); rt.byteVecPush(out, STARTED.v === true ? 1 : 0); } else { const fresh2: rt.Once = new rt.OnceLock(undefined); - rt.onceCall(fresh2, (_26: rt.OnceState): void => { - rt.onceCall(fresh2, (_27: rt.OnceState): void => { + rt.onceCall(fresh2, (_26: rt.OnceState): undefined => { + rt.onceCall(fresh2, (_27: rt.OnceState): undefined => { rt.byteVecPush(out, 238); }); }); diff --git a/ts/fixtures/lang/expected/std/thread/local.ts b/ts/fixtures/lang/expected/std/thread/local.ts index 18ad9fe43..9069650af 100644 --- a/ts/fixtures/lang/expected/std/thread/local.ts +++ b/ts/fixtures/lang/expected/std/thread/local.ts @@ -5,8 +5,8 @@ import { copy$Twin_Twin } from "../../lib.ts"; import type * as Noisy from "../../locals.Noisy.ts"; import type * as Twin from "../../locals.Twin.ts"; -export function set$0fx7125(self: rt.LocalKey>, value: rt.u32): void { - rt.localKeyInitializeWith(self, new rt.Cell(value), (value2: rt.Cell | undefined, cell: rt.Cell): void => { +export function set$0st49po(self: rt.LocalKey>, value: rt.u32): void { + rt.localKeyInitializeWith(self, new rt.Cell(value), (value2: rt.Cell | undefined, cell: rt.Cell): undefined => { if (value2 !== undefined) { rt.cellSet(cell, value2.v); } diff --git a/ts/fixtures/lang/expected/wrappers.ts b/ts/fixtures/lang/expected/wrappers.ts index 6e663e10f..21263426e 100644 --- a/ts/fixtures/lang/expected/wrappers.ts +++ b/ts/fixtures/lang/expected/wrappers.ts @@ -309,7 +309,7 @@ export function wrappers(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void })); bounds$RangeInclusive_u64(out, placed); const each: rt.RangeInclusive = new rt.RangeInclusive(lo, hi, rt.u64Step); - rt.iterForEach(rt.iterBorrow(each), (x6: rt.u64): void => { + rt.iterForEach(rt.iterBorrow(each), (x6: rt.u64): undefined => { rt.byteVecPush(out, rt.u64Low(x6) & 0xff); }); bounds$RangeInclusive_u64(out, each); diff --git a/ts/fixtures/lang/src/nested.rs b/ts/fixtures/lang/src/nested.rs index cab96da43..8807075b2 100644 --- a/ts/fixtures/lang/src/nested.rs +++ b/ts/fixtures/lang/src/nested.rs @@ -5,17 +5,18 @@ use std::cmp::Ordering; use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; use std::hash::{DefaultHasher, Hash, Hasher}; -/// Run case `kind % 7` over `data`, whose bytes pick each `None`, `Some(None)`, or +/// Run case `kind % 8` over `data`, whose bytes pick each `None`, `Some(None)`, or /// `Some(Some(_))`. pub fn nested(kind: u8, data: &[u8], out: &mut Vec) { - match kind % 7 { + match kind % 8 { 0 => made(data, out), 1 => keys(data, out), 2 => iters(data, out), 3 => consumers(data, out), 4 => panics(data, out), 5 => closures(data, out), - _ => elements(data, out), + 6 => elements(data, out), + _ => units(data, out), } } @@ -463,3 +464,69 @@ fn panics(data: &[u8], out: &mut Vec) { unit(b ^ 1).unwrap(); } } + +fn ignore(_: u8) {} + +fn half(b: u8) -> u8 { + b / 2 +} + +/// Each of `data` through `f`, read from its parameter: a function item too. +fn each(data: &[u8], f: impl Fn(u8) -> T) -> Vec { + data.iter().copied().map(f).collect() +} + +/// Each of `data` through a pointer. +fn pointed(data: &[u8], f: fn(u8)) -> Vec<()> { + data.iter().copied().map(f).collect() +} + +trait Made { + type Out; + fn made(&self, b: u8) -> Self::Out; +} + +struct Unit; + +impl Made for Unit { + type Out = (); + fn made(&self, _: u8) {} +} + +fn made_all(m: &M, data: &[u8]) -> Vec { + data.iter().map(|&b| m.made(b)).collect() +} + +/// The `()` results of closures, functions, pointers, a `dyn Fn`, and a method returning an +/// associated type, as the items of a `Vec`, a `VecDeque`, an `Option`, and a `Result`. +fn units(data: &[u8], out: &mut Vec) { + let units: Vec<()> = data.iter().map(|_| ()).collect(); + let q: VecDeque<()> = data.iter().rev().map(|_| ()).collect(); + let named: Vec<()> = data.iter().copied().map(ignore).collect(); + let f: fn(u8) = match data.first() { + Some(b) if b % 2 == 0 => ignore, + _ => |_| (), + }; + let by_pointer = pointed(data, f); + let generic = each(data, |_| ()); + let by_name = each(data, ignore); + out.extend(each(data, half)); + let methods = made_all(&Unit, data); + let g: &dyn Fn(u8) = &ignore; + let dynamic: Vec<()> = data.iter().copied().map(g).collect(); + for v in [&units, &named, &by_pointer, &generic, &by_name, &methods, &dynamic] { + out.extend([v.len() as u8, v.first().is_some() as u8, v.iter().count() as u8]); + } + out.extend([q.len() as u8, q.back().is_some() as u8]); + let o: Option<()> = data.first().map(|_| ()); + let none: Option<()> = data.get(1).filter(|b| **b % 2 == 0).map(|_| ()); + let r: Result<(), u8> = data.first().copied().ok_or(0xee).map(|_| ()); + let e: Result = data.first().copied().ok_or(()).map_err(|_| ()); + out.extend([ + o.is_some() as u8, + none.is_some() as u8, + r.is_ok() as u8, + e.is_err() as u8, + ]); + out.extend(format!("{units:?} {o:?} {none:?} {r:?} {e:?}").as_bytes()); +} diff --git a/ts/fixtures/stock/expected/buf.Pieces.ts b/ts/fixtures/stock/expected/buf.Pieces.ts index 0a289a9cf..c1fb88fb9 100644 --- a/ts/fixtures/stock/expected/buf.Pieces.ts +++ b/ts/fixtures/stock/expected/buf.Pieces.ts @@ -3,7 +3,7 @@ import * as rt from "./rt.ts"; import { panicAdvance } from "./bytes.ts"; import type * as TryGetError from "./bytes.TryGetError.ts"; -import { unwrapOrElse$1wjueex } from "./core/result.ts"; +import { unwrapOrElse$0s2lrc9 } from "./core/result.ts"; /** A buffer of the crate's own, in pieces: `Buf`'s provided methods read across them. */ export interface Pieces { @@ -222,7 +222,7 @@ export function hasRemaining$Buf(self: Pieces): boolean { * This function panics if `self.remaining() < dst.len()`. */ export function copyToSlice$Buf(self: Pieces, dst: rt.ByteSlice): void { - unwrapOrElse$1wjueex(tryCopyToSlice$Buf(self, dst), (error: TryGetError.TryGetError): void => { + unwrapOrElse$0s2lrc9(tryCopyToSlice$Buf(self, dst), (error: TryGetError.TryGetError): undefined => { panicAdvance(error); }); } diff --git a/ts/fixtures/stock/expected/buf.Provided.ts b/ts/fixtures/stock/expected/buf.Provided.ts index e7e17cef6..c193607af 100644 --- a/ts/fixtures/stock/expected/buf.Provided.ts +++ b/ts/fixtures/stock/expected/buf.Provided.ts @@ -4,7 +4,7 @@ import * as rt from "./rt.ts"; import * as Pieces from "./buf.Pieces.ts"; import { panicAdvance } from "./bytes.ts"; import type * as TryGetError from "./bytes.TryGetError.ts"; -import { unwrapOrElse$1wjueex } from "./core/result.ts"; +import { unwrapOrElse$0s2lrc9 } from "./core/result.ts"; /** * A buffer in pieces with only `Buf`'s required methods, so `copy_to_bytes` is the @@ -162,7 +162,7 @@ export function hasRemaining$Buf(self: Provided): boolean { * This function panics if `self.remaining() < dst.len()`. */ export function copyToSlice$Buf(self: Provided, dst: rt.ByteSlice): void { - unwrapOrElse$1wjueex(tryCopyToSlice$Buf(self, dst), (error: TryGetError.TryGetError): void => { + unwrapOrElse$0s2lrc9(tryCopyToSlice$Buf(self, dst), (error: TryGetError.TryGetError): undefined => { panicAdvance(error); }); } diff --git a/ts/fixtures/stock/expected/buf.ts b/ts/fixtures/stock/expected/buf.ts index a285f5530..26de9ee2e 100644 --- a/ts/fixtures/stock/expected/buf.ts +++ b/ts/fixtures/stock/expected/buf.ts @@ -461,7 +461,7 @@ export function reads(data: rt.ByteSlice, out: rt.ByteVec): void { rt.byteVecExtendFromSlice(out, rt.byteVecSlice(rest)); const vec: rt.ByteVec = new rt.ByteVec(); const _59: Pieces.Pieces = Pieces.new(input, cut); - rt.byteVecPutBuf(vec, _59, Pieces.hasRemaining$Buf, Pieces.remaining$Buf, Pieces.chunk$Buf, Pieces.advance$Buf); + rt.byteVecPutBuf(vec, _59, Pieces.hasRemaining$Buf, Pieces.remaining$Buf, Pieces.chunk$Buf, Pieces.advance$Buf as (a0: Pieces.Pieces, a1: rt.usize) => undefined); rt.byteVecExtendFromSlice(out, rt.byteVecSlice(vec)); const slice: rt.ByteSlice = input; rt.byteVecPush(out, slice.length === input.length ? 1 : 0); @@ -593,7 +593,7 @@ export function readAll$Provided(buf: Provided.Provided, ops: rt.ByteSlice, read } } const n: rt.usize = Provided.remaining$Buf$2(buf); - return rt.byteSliceToByteVec(rt.bufCopyToBytes(buf, n, Provided.remaining$Buf, Provided.chunk$Buf, Provided.advance$Buf)); + return rt.byteSliceToByteVec(rt.bufCopyToBytes(buf, n, Provided.remaining$Buf, Provided.chunk$Buf, Provided.advance$Buf as (a0: Provided.Provided, a1: rt.usize) => undefined)); } /** `read`s by each of `ops`, then the rest, as `copy_to_bytes` takes it. */ diff --git a/ts/fixtures/stock/expected/core/result.ts b/ts/fixtures/stock/expected/core/result.ts index 0f3755d06..ae6e223f3 100644 --- a/ts/fixtures/stock/expected/core/result.ts +++ b/ts/fixtures/stock/expected/core/result.ts @@ -3,7 +3,7 @@ import * as rt from "../rt.ts"; import type * as TryGetError from "../bytes.TryGetError.ts"; -export function unwrapOrElse$1wjueex(self: rt.Result, op: (a0: TryGetError.TryGetError) => void): void { +export function unwrapOrElse$0s2lrc9(self: rt.Result, op: (a0: TryGetError.TryGetError) => undefined): void { if (!self.ok) { op(self.error); } diff --git a/ts/fixtures/stock/expected/harness.ts b/ts/fixtures/stock/expected/harness.ts index b7b124562..89c293610 100644 --- a/ts/fixtures/stock/expected/harness.ts +++ b/ts/fixtures/stock/expected/harness.ts @@ -8,8 +8,8 @@ import * as Owner from "./harness.Owner.ts"; * Each case's name and what it runs. The first byte picks one modulo their count, so a * case added at the end moves no other. */ -export function cases(): [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void][] { - return [["slices", slices] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["made", made] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["events", events] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["random", random] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["buf::bytes_mut", bytesMut] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["buf::reads", reads] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["buf::writes", writes] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["buf::edits", edits] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void], ["buf::reserves", reserves] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void]]; +export function cases(): [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined][] { + return [["slices", slices as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["made", made as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["events", events as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["random", random as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["buf::bytes_mut", bytesMut as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["buf::reads", reads as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["buf::writes", writes as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["buf::edits", edits as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined], ["buf::reserves", reserves as (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined] as [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined]]; } /** Run one case. */ @@ -17,7 +17,7 @@ export function run(input: rt.ByteSlice): rt.ByteVec { const out: rt.ByteVec = new rt.ByteVec(); if (input.length !== 0) { const op_: rt.u8 = input.data[input.start]; - const cases_: [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void][] = cases(); + const cases_: [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined][] = cases(); cases_[rt.idx(cases_, rt.usizeRem(op_ as rt.usize, cases_.length))][1](new rt.ByteSlice(input.data, input.start + 1, input.length - 1), out); return out; } @@ -26,7 +26,7 @@ export function run(input: rt.ByteSlice): rt.ByteVec { /** The first byte that picks the case named `name`, which `caller.ts` targets by. */ export function op(name: string): rt.u8 { - const _2: rt.usize | undefined = rt.iterPosition(rt.iterSlice(cases()), (_22: [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => void]): boolean => { + const _2: rt.usize | undefined = rt.iterPosition(rt.iterSlice(cases()), (_22: [string, (a0: rt.ByteSlice, a1: rt.ByteVec) => undefined]): boolean => { return _22[0] === name; }); if (_2 === undefined) { diff --git a/ts/fixtures/task/expected/core/result.ts b/ts/fixtures/task/expected/core/result.ts index 535d1b1a9..a675ad0ca 100644 --- a/ts/fixtures/task/expected/core/result.ts +++ b/ts/fixtures/task/expected/core/result.ts @@ -118,7 +118,7 @@ export function mapErr$1c43xsx(self: rt.Result, op: (a0: rt.u32) return _0; } -export function inspectErr$014ax37(self: rt.Result, f: (a0: rt.u32) => void): rt.Result { +export function inspectErr$0hrcm18(self: rt.Result, f: (a0: rt.u32) => undefined): rt.Result { let _8: boolean = false; _8 = true; if (!self.ok) { diff --git a/ts/fixtures/task/expected/drops.ts b/ts/fixtures/task/expected/drops.ts index 1cd7dd550..13156df9b 100644 --- a/ts/fixtures/task/expected/drops.ts +++ b/ts/fixtures/task/expected/drops.ts @@ -417,7 +417,7 @@ export function hashed(log: Log.Log, id: rt.u32): void { const guard: (a0: rt.u32) => Guard.Guard = (n2: rt.u32): Guard.Guard => { return Guard.new(rt.u32Add(id, n2), Log.clone$Clone(sink)); }; - const tally: (a0: string) => void = (what: string): void => { + const tally: (a0: string) => undefined = (what: string): undefined => { const text: rt.ByteVec = Log.text(sink); const sum: rt.u32 = rt.iterSum(rt.iterMap(rt.iterSlice(rt.byteSliceView(rt.byteVecSlice(text))), (_2: rt.u8): rt.u32 => { return _2 as rt.u32; @@ -426,7 +426,7 @@ export function hashed(log: Log.Log, id: rt.u32): void { const args10: rt.Fmt[] = [(f: rt.Formatter) => rt.fmtPad(f, what), (f: rt.Formatter) => rt.usizeDisplay(_152, f), (f: rt.Formatter) => rt.u32Display(sum, f)]; Log.note(log, rt.fmtFormat([args10[0], ": ", args10[1], " ", args10[2]])); }; - const map: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashMap; + const map: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashMap; const _15: Key.Key = key(1); const _18: Guard.Guard = guard(1); rt.drop(rt.hashInsert(map, _15, _18, rt.drop)); @@ -480,7 +480,7 @@ export function hashed(log: Log.Log, id: rt.u32): void { return rt.u32Rem(k.id, 2) === 0; }, rt.drop, rt.drop); tally("retain"); - const set: rt.HashSet = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashSet; + const set: rt.HashSet = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashSet; const _151: Key.Key = key(10); rt.hashAdd(set, _151, rt.drop); const _156: Key.Key = key(11); @@ -504,7 +504,7 @@ export function hashed(log: Log.Log, id: rt.u32): void { const counted: (a0: rt.u32) => Key.Key = (n3: rt.u32): Key.Key => { return new Key.Key(rt.u32Add(id, n3), Log.clone$Clone(sink), true); }; - const counts: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashMap; + const counts: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashMap; const _207: Key.Key = counted(20); const _210: Guard.Guard = guard(20); rt.drop(rt.hashInsert(counts, _207, _210, rt.drop)); @@ -515,7 +515,7 @@ export function hashed(log: Log.Log, id: rt.u32): void { return guard(22); }); const _237: Key.Key = counted(20); - rt.entryOrInsert(rt.entryAndModify(rt.entry(counts, _237, rt.drop), (_27: Guard.Guard): void => {}), guard(23), rt.drop); + rt.entryOrInsert(rt.entryAndModify(rt.entry(counts, _237, rt.drop), (_27: Guard.Guard): undefined => {}), guard(23), rt.drop); const _245: Key.Key = counted(22); const _243: rt.Entry = rt.entry(counts, _245, rt.drop); if (rt.entryOccupied(_243)) { @@ -922,7 +922,7 @@ export function elements(log: Log.Log, id: rt.u32): void { }); const args26: rt.Fmt[] = [(f: rt.Formatter) => rt.fmtOption(_335, f, (value: rt.u32 | undefined, f: rt.Formatter) => rt.fmtOption(value, f, rt.u32Debug), rt.None), (f: rt.Formatter) => rt.fmtOption(_339, f, (value: rt.u32 | undefined, f: rt.Formatter) => rt.fmtOption(value, f, rt.u32Debug), rt.None)]; Log.note(log, rt.fmtFormat(["popped ", args26[0], " ", args26[1]])); - const hashed_: rt.HashSet = rt.hashNew(rt.hashing(rt.hashOption(Key.hash$Hash_DefaultHasher), rt.eqOption(Key.eq$PartialEq))) as rt.HashSet; + const hashed_: rt.HashSet = rt.hashNew(rt.hashing(rt.hashOption(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined), rt.eqOption(Key.eq$PartialEq))) as rt.HashSet; const _350: Key.Key | undefined = key(11); rt.hashAdd(hashed_, _350, rt.drop); const part15 = map$0hegtde(rt.hashKey(hashed_, undefined, false, rt.None), (o24: Key.Key | undefined): rt.u32 | undefined => { @@ -973,7 +973,7 @@ export function elements(log: Log.Log, id: rt.u32): void { * `or_insert` drops of a value JS copies, which it returns a place for. */ export function arcs(log: Log.Log, id: rt.u32): void { - const count: (a0: string, a1: rt.Arc) => void = (what: string, key: rt.Arc): void => { + const count: (a0: string, a1: rt.Arc) => undefined = (what: string, key: rt.Arc): undefined => { const _92: rt.usize = key.strong; const args8: rt.Fmt[] = [(f: rt.Formatter) => rt.fmtPad(f, what), (f: rt.Formatter) => rt.usizeDisplay(_92, f)]; Log.note(log, rt.fmtFormat([args8[0], " ", args8[1]])); diff --git a/ts/fixtures/task/expected/drops/closures.ts b/ts/fixtures/task/expected/drops/closures.ts index 4638a990b..0cd4d6061 100644 --- a/ts/fixtures/task/expected/drops/closures.ts +++ b/ts/fixtures/task/expected/drops/closures.ts @@ -3,7 +3,7 @@ import * as rt from "../rt.ts"; import { thenSome$1af3oea, then$1xpp3sz, then$1j9nint, then$0kxuq3f } from "../core/bool.ts"; import { map$1raha9y, map$0b0x7xy, map$1thjygq, mapOr$0nrpycp } from "../core/option.ts"; -import { map$1rk4yqp, mapErr$1c43xsx, inspectErr$014ax37, andThen$1so3lx6 } from "../core/result.ts"; +import { map$1rk4yqp, mapErr$1c43xsx, inspectErr$0hrcm18, andThen$1so3lx6 } from "../core/result.ts"; import * as Holder from "../drops/closures.Holder.ts"; import * as Log from "../log.Log.ts"; import * as Guard from "../model.Guard.ts"; @@ -234,7 +234,7 @@ export function discarded(log: Log.Log, id: rt.u32): void { const i: Guard.Guard = _89[0]; const j: Guard.Guard = _89[1]; const captured9 = i; - const _97: rt.Result = inspectErr$014ax37(ok, rt.closure((_2: rt.u32): void => { + const _97: rt.Result = inspectErr$0hrcm18(ok, rt.closure((_2: rt.u32): undefined => { const part = Guard.id(captured9); const args18: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(part, f)]; Log.note(log, rt.fmtFormat(["inspect ", args18[0]])); @@ -243,7 +243,7 @@ export function discarded(log: Log.Log, id: rt.u32): void { captured9[Symbol.dispose](); })); const captured10 = j; - const inspected: [rt.Result, rt.Result] = [_97, inspectErr$014ax37(err, rt.closure((_24: rt.u32): void => { + const inspected: [rt.Result, rt.Result] = [_97, inspectErr$0hrcm18(err, rt.closure((_24: rt.u32): undefined => { const part2 = Guard.id(captured10); const args20: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(part2, f)]; Log.note(log, rt.fmtFormat(["inspect ", args20[0]])); @@ -440,7 +440,7 @@ export function iterated(log: Log.Log, id: rt.u32): void { captured4[Symbol.dispose](); }), rt.drop); const captured5 = e; - const chained: rt.Iter = rt.iterInspect(_106, rt.closure((g7: Guard.Guard): void => { + const chained: rt.Iter = rt.iterInspect(_106, rt.closure((g7: Guard.Guard): undefined => { const _92: rt.u32 = Guard.id(g7); const _11: rt.u32 = Guard.id(captured5); const args28: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(_92, f), (f: rt.Formatter) => rt.u32Display(_11, f)]; @@ -606,7 +606,7 @@ export function iterated(log: Log.Log, id: rt.u32): void { const o: Guard.Guard = guard(28); const _369: rt.Iter = rt.iterSlice([1, 2]); const captured17 = o; - const _372: (a0: rt.u32) => void = rt.closure((_214: rt.u32): void => { + const _372: (a0: rt.u32) => undefined = rt.closure((_214: rt.u32): undefined => { const part7 = rt.u32Add(_214, Guard.id(captured17)); const args30: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(part7, f)]; Log.note(log, rt.fmtFormat(["each ", args30[0]])); diff --git a/ts/fixtures/task/expected/drops/folds.ts b/ts/fixtures/task/expected/drops/folds.ts index 92d80077d..3726edab8 100644 --- a/ts/fixtures/task/expected/drops/folds.ts +++ b/ts/fixtures/task/expected/drops/folds.ts @@ -99,7 +99,7 @@ export function folded(log: Log.Log, id: rt.u32, arg: rt.u8): void { return thenSome$0zvoczk(rt.u32Rem(Guard.id(g79), 3) !== rt.u32Rem(Guard.id(captured63), 3), g79); }, (): void => { captured63[Symbol.dispose](); - })), (g80: Guard.Guard): void => { + })), (g80: Guard.Guard): undefined => { const part13 = Guard.id(g80); const args108: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(part13, f)]; Log.note(log, rt.fmtFormat(["each ", args108[0]])); @@ -112,7 +112,7 @@ export function folded(log: Log.Log, id: rt.u32, arg: rt.u8): void { const _91: rt.Iter = rt.iterSlice(guards(1, 5), rt.drop); _1086 = false; const captured62 = c; - const _102: rt.u32 | undefined = map$1raha9y(rt.ownedLast(rt.iterInspect(_91, rt.closure((g77: Guard.Guard): void => { + const _102: rt.u32 | undefined = map$1raha9y(rt.ownedLast(rt.iterInspect(_91, rt.closure((g77: Guard.Guard): undefined => { const _981: rt.u32 = Guard.id(g77); const _1174: rt.u32 = Guard.id(captured62); const args106: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(_981, f), (f: rt.Formatter) => rt.u32Display(_1174, f)]; @@ -316,7 +316,7 @@ export function folded(log: Log.Log, id: rt.u32, arg: rt.u8): void { captured48[Symbol.dispose](); })); const captured49 = f; - const m: rt.usize = rt.ownedCount(rt.iterInspect(_299, rt.closure((g63: Guard.Guard): void => { + const m: rt.usize = rt.ownedCount(rt.iterInspect(_299, rt.closure((g63: Guard.Guard): undefined => { const _832: rt.u32 = Guard.id(g63); const _1020: rt.u32 = Guard.id(captured49); const args96: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(_832, f), (f: rt.Formatter) => rt.u32Display(_1020, f)]; @@ -845,7 +845,7 @@ export function folded(log: Log.Log, id: rt.u32, arg: rt.u8): void { const _924: rt.Iter = rt.iterSlice(guards(1, 5), rt.drop); _1086 = false; const captured4 = c; - const n21: rt.usize = rt.ownedCount(rt.iterRev(rt.iterInspect(_924, rt.closure((g7: Guard.Guard): void => { + const n21: rt.usize = rt.ownedCount(rt.iterRev(rt.iterInspect(_924, rt.closure((g7: Guard.Guard): undefined => { const _912: rt.u32 = Guard.id(g7); const _1111: rt.u32 = Guard.id(captured4); const args78: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(_912, f), (f: rt.Formatter) => rt.u32Display(_1111, f)]; @@ -1011,7 +1011,7 @@ export function rfolded(log: Log.Log, id: rt.u32, arg: rt.u8): void { } else if (_21 === 2) { const _85: rt.Iter = rt.iterSlice(guards(1, 4), rt.drop); const captured15 = c; - const _84: rt.Iter = rt.iterInspect(_85, rt.closure((g19: Guard.Guard): void => { + const _84: rt.Iter = rt.iterInspect(_85, rt.closure((g19: Guard.Guard): undefined => { const _914: rt.u32 = Guard.id(g19); const _1112: rt.u32 = Guard.id(captured15); const args32: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(_914, f), (f: rt.Formatter) => rt.u32Display(_1112, f)]; @@ -1032,7 +1032,7 @@ export function rfolded(log: Log.Log, id: rt.u32, arg: rt.u8): void { const _98: rt.Iter = rt.iterSlice(guards(4, 8), rt.drop); _343 = false; const captured17 = e; - const _96: rt.Iter = rt.iterRev(rt.iterInspect(_98, rt.closure((g21: Guard.Guard): void => { + const _96: rt.Iter = rt.iterRev(rt.iterInspect(_98, rt.closure((g21: Guard.Guard): undefined => { const _915: rt.u32 = Guard.id(g21); const _1113: rt.u32 = Guard.id(captured17); const args34: rt.Fmt[] = [(f: rt.Formatter) => rt.u32Display(_915, f), (f: rt.Formatter) => rt.u32Display(_1113, f)]; diff --git a/ts/fixtures/task/expected/drops/iters.ts b/ts/fixtures/task/expected/drops/iters.ts index 18053f9d5..4d1f52fc3 100644 --- a/ts/fixtures/task/expected/drops/iters.ts +++ b/ts/fixtures/task/expected/drops/iters.ts @@ -419,7 +419,7 @@ export function collected(log: Log.Log, id: rt.u32): void { const _258: Key.Key = key(23); v11.push(_258); const _248: rt.Iter = rt.iterSlice(v11, rt.drop); - const set: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashSet, _248, rt.drop, "fold", 117440512); + const set: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashSet, _248, rt.drop, "fold", 117440512); const _267: rt.usize = queue.n; const _270: rt.usize = rt.hashLen(hashed); const _273: rt.usize = rt.hashLen(set); @@ -522,7 +522,7 @@ export function drained(log: Log.Log, id: rt.u32): void { const _109: string = rt.fmtFormat(["queue ", args8[0], " ", args8[1]]); rt.drop(_119); Log.note(log, _109); - const map: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashMap; + const map: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashMap; const _129: Key.Key = key(20); const _132: Guard.Guard = guard(20); rt.drop(rt.hashInsert(map, _129, _132, rt.drop)); @@ -533,7 +533,7 @@ export function drained(log: Log.Log, id: rt.u32): void { const _139: string = rt.fmtFormat(["entry ", args10[0]]); drop$Option_Key_Guard(_145); Log.note(log, _139); - const map2: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashMap; + const map2: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashMap; const _154: Key.Key = key(21); const _157: Guard.Guard = guard(21); rt.drop(rt.hashInsert(map2, _154, _157, rt.drop)); @@ -541,7 +541,7 @@ export function drained(log: Log.Log, id: rt.u32): void { const part4 = rt.hashLen(map2); const args12: rt.Fmt[] = [(f: rt.Formatter) => rt.usizeDisplay(part4, f)]; Log.note(log, rt.fmtFormat(["drained ", args12[0]])); - const set2: rt.HashSet = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashSet; + const set2: rt.HashSet = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashSet; const _178: Key.Key = key(22); rt.hashAdd(set2, _178, rt.drop); const taken: rt.Iter = rt.hashDrainKeys(set2, rt.drop); @@ -615,7 +615,7 @@ export function extended(log: Log.Log, id: rt.u32): void { const part = list.length; const args2: rt.Fmt[] = [(f: rt.Formatter) => rt.usizeDisplay(part, f)]; Log.note(log, rt.fmtFormat(["list ", args2[0]])); - const map: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashMap; + const map: rt.HashMap = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashMap; const _71: Key.Key = key(8); const _74: Guard.Guard = guard(8); rt.drop(rt.hashInsert(map, _71, _74, rt.drop)); @@ -625,7 +625,7 @@ export function extended(log: Log.Log, id: rt.u32): void { const _92: [Key.Key, Guard.Guard] = [key(8), guard(10)]; v4.push(_92); rt.hashExtend(map, rt.iterSlice(v4, drop$Key_Guard), rt.drop, rt.drop, "fold", 58720256); - const set: rt.HashSet = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher, Key.eq$PartialEq)) as rt.HashSet; + const set: rt.HashSet = rt.hashNew(rt.hashing(Key.hash$Hash_DefaultHasher as (a0: Key.Key, a1: rt.Hasher) => undefined, Key.eq$PartialEq)) as rt.HashSet; const _102: Key.Key = key(11); rt.hashAdd(set, _102, rt.drop); const v5: Key.Key[] = []; diff --git a/ts/fixtures/task/expected/futures.ts b/ts/fixtures/task/expected/futures.ts index 96bb83fd3..583e3fb65 100644 --- a/ts/fixtures/task/expected/futures.ts +++ b/ts/fixtures/task/expected/futures.ts @@ -165,9 +165,9 @@ export class helpersFuture { export function relayed(task: rt.Waker, log: Log.Log, id: rt.u32): rt.Waker { const relay: Relay.Relay = new Relay.Relay(task.clone(), Guard.new(id, log)); if (rt.u32Rem(id, 2) === 0) { - return new rt.ArcWaker(new rt.Arc(relay), Relay.wake$Wake, (arc2: rt.Arc) => arc2[Symbol.dispose](), Relay.wakeByRef$Wake); + return new rt.ArcWaker(new rt.Arc(relay), Relay.wake$Wake as (a0: rt.Arc) => undefined, (arc2: rt.Arc) => arc2[Symbol.dispose](), Relay.wakeByRef$Wake as (a0: rt.Arc) => undefined); } - return new rt.ArcWaker(new rt.Arc(new Plain.Plain(relay)), Plain.wake$Wake, (arc: rt.Arc) => arc[Symbol.dispose]()); + return new rt.ArcWaker(new rt.Arc(new Plain.Plain(relay)), Plain.wake$Wake as (a0: rt.Arc) => undefined, (arc: rt.Arc) => arc[Symbol.dispose]()); } /** diff --git a/ts/src/lower/body.rs b/ts/src/lower/body.rs index 1cb62b46b..72f9d98c5 100644 --- a/ts/src/lower/body.rs +++ b/ts/src/lower/body.rs @@ -222,7 +222,8 @@ impl<'b, 'a, 'tcx> Body<'b, 'a, 'tcx> { } } - /// A function item as a value. + /// A function item as a value, typed as one: a declared function's `()` result is `void`, + /// which a value's type says is `undefined`. pub fn fn_value(&mut self, def_id: rustc_hir::def_id::DefId, gargs: GenericArgsRef<'tcx>, span: Span) -> Expr { let tcx = self.t.tcx; let sig = self.t.sig(def_id, gargs); @@ -246,16 +247,26 @@ impl<'b, 'a, 'tcx> Body<'b, 'a, 'tcx> { if !matches!(tcx.def_kind(def_id), rustc_hir::def::DefKind::Ctor(..)) && let Ok(Some(instance)) = Instance::try_resolve(tcx, self.t.typing_env_pub(), def_id, gargs) { - if let Some(sym) = self.t.bound_fn(instance, span) { - return Expr::Sym(sym); - } - if self.t.lowers(instance) { - return Expr::Sym(self.t.callee(instance, span)); + let sym = match self.t.bound_fn(instance, span) { + Some(sym) => Some(sym), + None => self.t.lowers(instance).then(|| self.t.callee(instance, span)), + }; + if let Some(sym) = sym { + return match sig.output().is_unit() { + true => Expr::As(Box::new(Expr::Sym(sym)), self.t.fn_ty(sig.inputs(), sig.output(), span)), + false => Expr::Sym(sym), + }; } } let mut body = Vec::new(); let call = self.call_def(def_id, gargs, values, span, &mut body); - body.push(StmtKind::Return(Some(call.typed())).at(None)); + body.push( + match sig.output().is_unit() { + true => StmtKind::Expr(call), + false => StmtKind::Return(Some(call.typed())), + } + .at(None), + ); let params = names .into_iter() .zip(sig.inputs()) @@ -264,7 +275,7 @@ impl<'b, 'a, 'tcx> Body<'b, 'a, 'tcx> { Param { name, ty: Some(ty) } }) .collect(); - let ret = self.t.ret_ty(sig.output(), span); + let ret = self.t.ty(sig.output(), span); Expr::Arrow(params, ret, body) } } diff --git a/ts/src/lower/dynamic.rs b/ts/src/lower/dynamic.rs index d04f7ed78..74acf3704 100644 --- a/ts/src/lower/dynamic.rs +++ b/ts/src/lower/dynamic.rs @@ -163,7 +163,9 @@ impl<'tcx> Translator<'_, 'tcx> { for method in &object.methods { let args = method_args(tcx, method.def_id, ty); let sig = self.sig(method.def_id, args); - let func = self.fn_ty(&sig.inputs()[1..], sig.output(), span); + // The methods it holds are declared, so their `()` is `void`. + let params = sig.inputs()[1..].iter().map(|t| self.ty(*t, span)).collect(); + let func = Type::Func(params, Box::new(self.ret_ty(sig.output(), span))); members.push((method.name.clone(), func)); } self.program.items.push(Item::Union { diff --git a/ts/src/lower/mir/place.rs b/ts/src/lower/mir/place.rs index 922a7e89a..aae942546 100644 --- a/ts/src/lower/mir/place.rs +++ b/ts/src/lower/mir/place.rs @@ -39,6 +39,10 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { // A value of type `!`, as a generic instantiated at `!` reads: native code never // gets here, and `tsc` sees that through `rt.unreachable`. Slot::Unit if self.mir.local_decls[local].ty.is_never() => Expr::rt("unreachable", vec![Expr::undefined()]), + // A function item holds no value, so each read names the function. + Slot::Unit if let ty::FnDef(def_id, args) = *self.mir.local_decls[local].ty.kind() => { + self.b.fn_value(def_id, args.skip_binder(), span) + } Slot::Unit => Expr::undefined(), // Passed on or kept, a `&mut` to a borrowed place JS copies is its `rt.Place`. Slot::Alias(Some(target)) if self.points_at_place(local) => { diff --git a/ts/src/lower/mir/rvalue.rs b/ts/src/lower/mir/rvalue.rs index 58ff40e04..8dae649c3 100644 --- a/ts/src/lower/mir/rvalue.rs +++ b/ts/src/lower/mir/rvalue.rs @@ -731,10 +731,11 @@ impl<'m, 'b, 'a, 'tcx> Fx<'m, 'b, 'a, 'tcx> { captures.push(Capture { value, pointee: false }); } let sig = tcx.instantiate_bound_regions_with_erased(args.as_closure().sig()); + // A value, whose `()` result is `undefined` as its type says. let ret = self .b .t - .ret_ty(sig.output(), mir.local_decls[mir::RETURN_PLACE].source_info.span); + .ty(sig.output(), mir.local_decls[mir::RETURN_PLACE].source_info.span); let ty = Ty::new_closure(tcx, def_id, args); let glue = match self.b.t.drops(ty) { true => Some(self.b.t.closure_glue(ty, &captures, span)), diff --git a/ts/src/lower/mod.rs b/ts/src/lower/mod.rs index d77223e28..d615f93fb 100644 --- a/ts/src/lower/mod.rs +++ b/ts/src/lower/mod.rs @@ -1391,16 +1391,14 @@ impl<'a, 'tcx> Translator<'a, 'tcx> { } } + /// A function value's type, whose `()` result is `undefined`: TypeScript infers a + /// `Vec<()>`'s items from it, and `void` is no `undefined`. fn fn_ty(&mut self, inputs: &[Ty<'tcx>], output: Ty<'tcx>, span: Span) -> Type { let params = inputs.iter().map(|t| self.ty(*t, span)).collect(); - let ret = match output.is_unit() { - true => Type::Builtin("void"), - false => self.ty(output, span), - }; - Type::Func(params, Box::new(ret)) + Type::Func(params, Box::new(self.ty(output, span))) } - /// The return type of a function returning `ty`. + /// The return type of a declared function returning `ty`, whose `()` is `void`. pub fn ret_ty(&mut self, ty: Ty<'tcx>, span: Span) -> Type { match ty.is_unit() { true => Type::Builtin("void"),