Skip to content

feat(ts): translate Debug of Bound, Ordering, Reverse, and ControlFlow - #331

Merged
kixelated merged 3 commits into
mainfrom
quest/m3/ts-bound-debug
Oct 31, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m3/ts-bound-debug

Conversation

@kixelated

@kixelated kixelated commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

{:?} of a Bound<T> or Bound<&T>, such as a range's start_bound(), was refused (unsupported call to <std::ops::Bound<&u8> as std::fmt::Debug>::fmt), so #325 encoded bounds as bytes. Ordering, Reverse, and ControlFlow were refused the same way, and so was Debug of !/Infallible, which a ControlFlow that ? breaks with, or a Result<_, Infallible>, reaches.

Approach

  • fmt::std_impl maps each to its derived Debug: rt.fmtBound, rt.fmtOrdering, Reverse through rt.fmtDebugTupleFields, and rt.fmtControlFlow / rt.fmtControlFlowOption for each way a ControlFlow is held (Result, the Err ? breaks with, or the Option it was applied to, with rt.None where needed). A field takes the formatter's options; a variant without one writes its name unpadded.
  • ! (and Infallible, which is it here) writes through rt.unreachable, since none exists.
  • iters::range_methods prints its bounds by {:?}; bound_of is gone.
  • New case fmt::enums covers {:?}, {:#?}, {:x?}, {:#X?}, width, fill, sign and zero-pad over Bound<u8>, Bound<&str>, Bound<char>, Bound<Option<u8>>, Bound<&[u8]>, Bound<&Clip> via as_ref, range bounds, Ordering, nested Reverse, and ControlFlow in every representation. It runs in the lang differential against native wasm32.

Audit: the range types, RangeFull, and Wrapping (from #326, merged in here) already translated.

Impact

  • Translator output: {:?} of these types now translates instead of being refused. No public Rust API change.

Alternatives

  • One generic fmtControlFlow(continues, f, go, stop) with thunks: TypeScript can't narrow the Result read inside them, so the runtime narrows instead.

Follow-ups

  • None.

Review

Codex gpt-6.1-sol, medium effort, via quest review --base origin/main. Round 1 on 0a653eb3 found nothing. Round 2 ran on the reviewed head 3d2f9457de95c520f055a14c6b57bff510015de6, after merging origin/main with a hand-resolved conflict in the harness case list, and found nothing.

Local checks: just ci passes on 3d2f9457.

(written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 2 commits October 30, 2026 21:57
Quest-Claim: aaecd0d836ba8120
Each writes its derived Debug: a variant with a field passes the
formatter's options to it, and one without writes its name unpadded. A
ControlFlow is written however it is held, the Err or None `?` breaks with
included, and `!` and Infallible, which never exist, are never written.
iters::range_methods now prints its bounds by Debug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Debug of Bound feat(ts): translate Debug of Bound, Ordering, Reverse, and ControlFlow Oct 31, 2026
# Conflicts:
#	ts/fixtures/lang/expected/harness.ts
#	ts/fixtures/lang/src/harness.rs
@kixelated
kixelated marked this pull request as ready for review October 31, 2026 05:44
@kixelated
kixelated merged commit 7da9df3 into main Oct 31, 2026
1 of 2 checks passed
@kixelated
kixelated deleted the quest/m3/ts-bound-debug branch October 31, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant