Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dafe20f
chore(quest): claim quest/m3/ts-assoc-type-fields.md
kixelated Nov 7, 2026
e68fe2b
feat(ts): fields typed by an associated type of a generic type's para…
kixelated Nov 7, 2026
55256a3
fix(ts): drop a generic type's projected fields, and skip what types …
kixelated Nov 7, 2026
22e7e42
fix(ts): an instance's projections decide whether its glue is inert
kixelated Nov 7, 2026
8db921a
Merge remote-tracking branch 'origin/main' into pr644
kixelated Nov 7, 2026
5a5ba71
refactor(ts): typing a definition is the one record of its projection…
kixelated Nov 7, 2026
a9b1ef9
fix(ts): refuse only an instance its own projection arguments name again
kixelated Nov 7, 2026
5f76719
Merge remote-tracking branch 'origin/main' into pr644
kixelated Nov 7, 2026
d144d1d
fix(ts): end every walk a projection holding deeper instances drives
kixelated Nov 7, 2026
683789d
fix(ts): end typing, glue and holding walks past the recursion limit
kixelated Nov 7, 2026
b163758
Merge remote-tracking branch 'origin/main' into pr644
kixelated Nov 7, 2026
a09b839
feat(ts): name instances a projection argument holds with an alias
kixelated Nov 7, 2026
55bf740
Merge remote-tracking branch 'origin/main' into t3/49b7f832
kixelated Nov 7, 2026
b938062
fix(ts): name aliases by default arguments too, and finish finite con…
kixelated Nov 7, 2026
701b907
fix(ts): let finite projection growth settle, and alias const-only in…
kixelated Nov 7, 2026
499a919
fix(ts): bound projection growth by how deep projections nest
kixelated Nov 7, 2026
f1851e9
chore(ts): sort the reject fixture's roots
kixelated Nov 7, 2026
f97d9ec
fix(ts): bound filling an open definition's instances by rounds, at t…
kixelated Nov 7, 2026
ca609cd
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Nov 7, 2026
6a63ba9
test(ts): refusals of endless fills at their definitions
kixelated Nov 7, 2026
904df15
style(ts): format
kixelated Nov 7, 2026
b0425d5
fix(ts): complete a definition with the one further out its fill name…
kixelated Nov 7, 2026
3cf8d51
chore(ts): sort the reject fixture's roots
kixelated Nov 7, 2026
9ec4633
fix(ts): check what a held instance decides in its own frame, and Con…
kixelated Nov 7, 2026
1e2558a
fix(ts): word the ControlFlow refusal in census terms
kixelated Nov 7, 2026
97c2967
Merge remote-tracking branch 'origin/main' into HEAD
kixelated Nov 7, 2026
7c9b53e
fix(ts): type trait objects outside the definition typing them, and f…
kixelated Nov 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ memory model for values whose address is reinterpreted, without a consumer.
- [Throw only where Rust panics](/quest/m3/ts-runtime-throws.md) - no runtime `rust2-ts:` error where native Rust goes on: an exact slower path, or a refusal at translation
- [rust2-ts with no ts.toml](/quest/m3/ts-configless.md) - a crate's whole `pub` API translates with no config and no bound items
- [Browser APIs through wasm-bindgen](/quest/m3/ts-wasm-bindgen/README.md) - web-sys and js-sys imports become direct JS calls, so idiomatic crates such as web-rs's web-codecs translate as stock crates
- [Fields typed by an associated type](/quest/m3/ts-assoc-type-fields.md) - a generic struct's field of `<T as Trait>::Item` translates at each instance
20 changes: 0 additions & 20 deletions quest/m3/ts-assoc-type-fields.md

This file was deleted.

20 changes: 16 additions & 4 deletions ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,16 @@ function is suffixed instead by a hash of its text, with what it calls by name,
translation reaches. Types are translated once, generically over their type parameters
but not their const ones, which type nothing in TS: arrayvec's `ArrayString<4>` and
`ArrayString<16>` are one `ArrayString`, and each instance's functions read its own
`CAP`. So a function of a generic type is one instance's, declaring the instance it
`CAP`. A projection its fields name, such as smallvec's `<A as Array>::Item`, directly,
through a generic type of the crate's they hold, or as a std iterator's item, is a type
parameter of its own after them, named for its associated type and numbered past any it
would shadow, which each instance gives what the projection is there:
`Drain<[u8; 4]>` is a `Drain<Uint8Array, rs.u8>`. An instance a projection argument
holds is named by an exported alias of its own, `type Held$Src = Held<Src, Held$Src>`, so
one that holds itself again ends, and the output grows with the instances rather than
the paths through them; an enum's alias spells out its union at the instance, as
TypeScript refuses an alias naming itself through a generic one. Types typed with each
other, as a tree and its branches are, each take the projections either names. So a function of a generic type is one instance's, declaring the instance it
takes as `self`:
`fmt$fmt_Debug_fmt_Pair(self: Wrap<Pair.Pair>, f: rs.Formatter)`. A reference or pointer
in a generic type to what only an instance decides the form of, such as `*mut T` or
Expand Down Expand Up @@ -1191,9 +1200,12 @@ that drops given to a std function that keeps it other than in an iterator or a
`poll_fn`, or whose mapping doesn't drop it where std's does, a `Cow` of other than `str` or a slice, a std
function without a mapping of its own that makes or reads an `Option` whose `None` is
`rs.None`, an `Option` of an `Option` of `()` or another
`Option`, an instance of a generic type whose field is an `Option` of a type parameter
that can be `undefined` though TypeScript's type of it can't, as a `MaybeUninit<u32>`
can, or an `Option` or a `Poll` of another form of it whose instance can be `undefined` or pending, a `String`'s `capacity`, looking up a key by
`Option`, an instance of a generic type whose field is an `Option` of a type parameter,
or of a projection from one, that can be `undefined` though TypeScript's type of it can't, as a `MaybeUninit<u32>`
can, or an `Option` or a `Poll` of another form of it whose instance can be `undefined` or pending, a `ControlFlow` breaking with one that an instance
makes an `Option<!>` or `Result<!, _>`, or a future of one whose instance can be pending, each also through a generic type it holds, an instance of a generic type
over type parameters whose projection is a type holding that instance again, in a generic type's definition (`Held<Wrap<T>>` where `Wrap<T>::Item` is a `Held<Wrap<T>>`), a generic type that
holds itself at other arguments than its own parameters whose instances name new instances or projections for more rounds than the crate's recursion limit, a `String`'s `capacity`, looking up a key by
another type it borrows as through the crate's own `Borrow`, a `&mut` to a value JS
copies that std makes, other than a map's, or hands a closure, as `iter_mut` and
`and_modify` do, one into a `Result`'s payload passed on or kept, the adaptors
Expand Down
62 changes: 62 additions & 0 deletions ts/fixtures/lang/shapes/expected/core/bool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

import * as rs from "../rs.ts";
import type * as Pair from "../fmt.Pair.ts";
import type * as Copse from "../generics.Copse.ts";
import type * as Grove from "../generics.Grove.ts";
import type * as Holder from "../generics.Holder.ts";
import type * as Layer from "../generics.Layer.ts";
import type * as Peel from "../generics.Peel.ts";
import type * as Remade from "../generics.Remade.ts";
import type * as Seed from "../generics.Seed.ts";
import type * as Shoot from "../generics.Shoot.ts";
import type * as Sibling from "../generics.Sibling.ts";
import type * as Sprout from "../generics.Sprout.ts";
import type * as Ticked from "../generics.Ticked.ts";
import type * as Top from "../generics.Top.ts";
import type * as Twig from "../generics.Twig.ts";
import type * as Void from "../shapes.Void.ts";

export function thenSome$1ctlqen(self: boolean, t: rs.u8 | undefined): rs.u8 | undefined | rs.None {
Expand Down Expand Up @@ -32,6 +45,41 @@ export function thenSome$05ku0zn(self: boolean, t: rs.i32): rs.i32 | undefined {
return t;
}

export function thenSome$0bd8znh(self: boolean, t: Layer.Layer<Peel.Peel<Top.Top>, boolean, rs.u8>): Layer.Layer<Peel.Peel<Top.Top>, boolean, rs.u8> | undefined {
if (!self) {
return undefined;
}
return t;
}

export function thenSome$0czqe00(self: boolean, t: Shoot.Shoot<Seed.Seed, Copse.Copse$generics_Tail>): Shoot.Shoot<Seed.Seed, Copse.Copse$generics_Tail> | undefined {
if (!self) {
return undefined;
}
return t;
}

export function thenSome$0rdxccx(self: boolean, t: Sibling.Sibling<Remade.Remade<rs.u8>, rs.u8, rs.u8>): Sibling.Sibling<Remade.Remade<rs.u8>, rs.u8, rs.u8> | undefined {
if (!self) {
return undefined;
}
return t;
}

export function thenSome$0tbnivw(self: boolean, t: Ticked.Ticked): Ticked.Ticked | undefined {
if (!self) {
return undefined;
}
return t;
}

export function thenSome$0epplxd(self: boolean, t: Twig.Twig<Sprout.Sprout, Grove.Grove$generics_Tail>): Twig.Twig<Sprout.Sprout, Grove.Grove$generics_Tail> | undefined {
if (!self) {
return undefined;
}
return t;
}

export function thenSome$19pue01(self: boolean, t: rs.Poll<rs.u8>): rs.Poll<rs.u8> | undefined {
if (!self) {
return undefined;
Expand Down Expand Up @@ -67,6 +115,20 @@ export function then$0y7on52(self: boolean, _: () => rs.ByteVec): rs.ByteVec | u
return new rs.ByteVec();
}

export function then$1tgze8k(self: boolean, f: () => Holder.Holder): Holder.Holder | undefined {
if (!self) {
return undefined;
}
return f();
}

export function then$1qflv5x(self: boolean, f: () => Ticked.Ticked): Ticked.Ticked | undefined {
if (!self) {
return undefined;
}
return f();
}

export function then$1ldvmdq(self: boolean, f: () => rs.u8): rs.u8 | undefined {
if (!self) {
return undefined;
Expand Down
188 changes: 188 additions & 0 deletions ts/fixtures/lang/shapes/expected/core/option.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
// Generated by rust2-ts. Do not edit.

import * as rs from "../rs.ts";
import type * as Back from "../generics.Back.ts";
import type * as Carried from "../generics.Carried.ts";
import type * as Copse from "../generics.Copse.ts";
import type * as Counted from "../generics.Counted.ts";
import type * as Defaulted from "../generics.Defaulted.ts";
import type * as Depth from "../generics.Depth.ts";
import type * as Forked from "../generics.Forked.ts";
import type * as Grove from "../generics.Grove.ts";
import type * as Head from "../generics.Head.ts";
import type * as Holder from "../generics.Holder.ts";
import type * as Layer from "../generics.Layer.ts";
import type * as Looped from "../generics.Looped.ts";
import type * as Node from "../generics.Node.ts";
import type * as Peel from "../generics.Peel.ts";
import type * as Remade from "../generics.Remade.ts";
import type * as Seed from "../generics.Seed.ts";
import type * as Shoot from "../generics.Shoot.ts";
import type * as Sibling from "../generics.Sibling.ts";
import type * as Sprout from "../generics.Sprout.ts";
import type * as Ticked from "../generics.Ticked.ts";
import type * as Top from "../generics.Top.ts";
import type * as Twig from "../generics.Twig.ts";
import { from$convert_From_shapes_Dir_u8 } from "../shapes.ts";
import type * as Dir from "../shapes.Dir.ts";
import type * as Meters from "../shapes.Meters.ts";
Expand Down Expand Up @@ -43,13 +64,161 @@ export function unwrapOrDefault$03apme8(self: rs.u8 | undefined): rs.u8 {
return self;
}

export function map$00jdj9f(self: Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped> | undefined, _: (a0: Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped>) => Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped>): Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped> | undefined {
if (self === undefined) {
return undefined;
}
return self;
}

export function map$0xoixq7(self: Counted.Counted<Counted.Counted$0> | undefined, _: (a0: Counted.Counted<Counted.Counted$0>) => Counted.Counted<Counted.Counted$0>): Counted.Counted<Counted.Counted$0> | undefined {
if (self === undefined) {
return undefined;
}
return self;
}

export function map$0983ug4(self: Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back> | undefined, _: (a0: Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back>) => Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back>): Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back> | undefined {
if (self === undefined) {
return undefined;
}
return self;
}

export function map$14wqhyc(self: Holder.Holder | undefined, f: (a0: Holder.Holder) => [rs.u8, rs.u8 | undefined]): [rs.u8, rs.u8 | undefined] | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$04m4r6n(self: Counted.Counted<Counted.Counted$0> | undefined, f: (a0: Counted.Counted<Counted.Counted$0>) => rs.u8): rs.u8 | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1ug09xc(self: Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_1, Forked.Forked$generics_Depth_1> | undefined, f: (a0: Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_1, Forked.Forked$generics_Depth_1>) => rs.u8): rs.u8 | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1747o3c(self: Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_2, Forked.Forked$generics_Depth_2> | undefined, f: (a0: Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_2, Forked.Forked$generics_Depth_2>) => rs.u8): rs.u8 | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1mvacy3(self: Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_0, Ticked.Ticked> | undefined, f: (a0: Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_0, Ticked.Ticked>) => [rs.u8, rs.u8 | undefined, rs.u8 | undefined]): [rs.u8, rs.u8 | undefined, rs.u8 | undefined] | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1es1113(self: Node.Node<Head.Head, Node.Node$generics_Tail> | undefined, f: (a0: Node.Node<Head.Head, Node.Node$generics_Tail>) => rs.u8): rs.u8 | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1ub01y7(self: Ticked.Ticked | undefined, f: (a0: Ticked.Ticked) => rs.u8): rs.u8 | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1a3j889(self: Layer.Layer<Peel.Peel<Top.Top>, boolean, rs.u8> | undefined, f: (a0: Layer.Layer<Peel.Peel<Top.Top>, boolean, rs.u8>) => [boolean, boolean]): [boolean, boolean] | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1avgfgw(self: Shoot.Shoot<Seed.Seed, Copse.Copse$generics_Tail> | undefined, f: (a0: Shoot.Shoot<Seed.Seed, Copse.Copse$generics_Tail>) => boolean): boolean | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$0e9v36n(self: Sibling.Sibling<Remade.Remade<rs.u8>, rs.u8, rs.u8> | undefined, f: (a0: Sibling.Sibling<Remade.Remade<rs.u8>, rs.u8, rs.u8>) => [rs.u8, boolean]): [rs.u8, boolean] | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1i2swnz(self: Twig.Twig<Sprout.Sprout, Grove.Grove$generics_Tail> | undefined, f: (a0: Twig.Twig<Sprout.Sprout, Grove.Grove$generics_Tail>) => boolean): boolean | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$0ggarad(self: rs.u8 | undefined, f: (a0: rs.u8) => rs.Vec<Ticked.Ticked>): rs.Vec<Ticked.Ticked> | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$132wgz4(self: rs.u8 | undefined, f: (a0: rs.u8) => boolean): boolean | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1olalbb(self: rs.u8 | undefined, f: (a0: rs.u8) => Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_1, Forked.Forked$generics_Depth_1>): Forked.Forked<Depth.Depth, Forked.Forked$generics_Depth_1, Forked.Forked$generics_Depth_1> | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1htvaju(self: rs.u8 | undefined, f: (a0: rs.u8) => Node.Node<Head.Head, Node.Node$generics_Tail>): Node.Node<Head.Head, Node.Node$generics_Tail> | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$0xpm57l(self: rs.u8 | undefined, f: (a0: rs.u8) => Ticked.Ticked): Ticked.Ticked | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$1yjmt5m(self: rs.u8 | undefined, f: (a0: rs.u8) => rs.u8): rs.u8 | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$0ydco3f(self: rs.u8 | undefined, f: (a0: rs.u8) => rs.u16): rs.u16 | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function map$057a36e(self: rs.u8 | undefined, f: (a0: rs.u8) => undefined): undefined | rs.None {
if (self === undefined) {
return rs.None;
}
f(self);
return undefined;
}

export function map$0600mq0(self: Dir.Dir | undefined, f: (a0: Dir.Dir) => Shape.Shape): Shape.Shape | undefined {
if (self === undefined) {
return undefined;
Expand Down Expand Up @@ -120,6 +289,25 @@ export function okOr$1j8owgb(self: rs.u8 | undefined, err: rs.u8): rs.Result<rs.
return rs.Ok(self);
}

export function asDeref$10lhnlx(self: Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped> | undefined): Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped> | undefined {
return map$00jdj9f(self, (a0: Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped>): Carried.Carried<Looped.Looped, Carried.Carried$generics_Looped> => {
return a0;
});
}

export function asDeref$1z13rqi(self: Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back> | undefined): Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back> | undefined {
return map$0983ug4(self, (a0: Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back>): Defaulted.Defaulted<Back.Back, Defaulted.Defaulted$generics_Back> => {
return a0;
});
}

export function andThen$0jij6xn(self: Counted.Counted<Counted.Counted$0> | undefined, f: (a0: Counted.Counted<Counted.Counted$0>) => Counted.Counted<Counted.Counted$0> | undefined): Counted.Counted<Counted.Counted$0> | undefined {
if (self === undefined) {
return undefined;
}
return f(self);
}

export function andThen$0jc4o0i(self: rs.u8 | undefined, f: (a0: rs.u8) => rs.u8 | undefined | rs.None): rs.u8 | undefined | rs.None {
if (self === undefined) {
return rs.None;
Expand Down
Loading