Repository navigation
feat(ts): format Arc as what it holds, and std's ranges with Debug - #247
Conversation
Quest-Claim: d7da809b091a91de
`Arc<T>` and `Rc<T>` write their value with `Display` and `Debug` under the same formatter, and each std range writes its bounds with the range's options, plus ` (exhausted)` once iteration exhausts an inclusive one. A `..` constant translates to `undefined`, as a `RangeFull` value is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 57 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 44a7bef667bbe46f8d4a130f327d8e0ed9e1edfb.
No actionable bugs found in the changed formatting paths. Arc/Rc forwarding reuses the inner value and formatter without changing ownership, and the range helpers preserve bound formatting options, delimiter order, and early error returns. The inclusive suffix uses the existing exhaustion state, while RangeFull constants now match its existing runtime representation. The per-shape helpers are a reasonable, small alternative to a more general formatting abstraction.
Nonblocking coverage suggestion: add a custom bound whose Debug returns an error, and print an inclusive range exhausted through fold as well as next/next_back/nth. These exercise early termination and the runtime's separate folded exhaustion path.
Verification limits: static diff, lowering/runtime context and generated fixture review, plus an independent read-only pass. I did not execute the differential suite, mutation test, or reported local checks, and do not claim they passed.
(Written by OpenAI)
# Conflicts: # quest/m3/ts-fmt-wrappers.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* quest: plan follow-ups of #237 and #241 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * quest: fold #247's follow-ups into ts-dyn and ts-drop-order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Luke Curley <432854+kixelated@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # quest/m3/ts-fmt-wrappers.md # ts/fixtures/lang/expected/harness.ts
…uest/m3/ts-fmt-wrappers
Problem
rust2-ts refused
DebugandDisplayofArc<T>for everyT, andDebugof std's ranges, so a crate that prints either could not translate (quest/m3/ts-fmt-wrappers.md, suggested by #177 and #179).Approach
Arc<T>andRc<T>(bothrt.Arc) write.valuethroughT'sDisplayorDebugwith the same formatter, as std's impls forward, so every option reachesT. Other traits stay refused, as std has no such impls.Debug(rt.fmtRange,fmtRangeInclusive,fmtRangeFrom,fmtRangeTo,fmtRangeToInclusive,fmtRangeFull) that writes each bound with the range's formatter and the unpadded..or..=between, as core does.RangeInclusiveadds(exhausted)from itsexhaustedflag...constant now translates toundefined, as aRangeFullvalue already is. Before this,format!("{:?}", ..)was refused.RangeInclusivealready keeps the pinned nightly's state:startsteps pastendand only overflow setsexhausted. core changed this after 1.98, so printing the fields matches native output.Tests: a new
fmt::wrappedcase in the lang differential (native wasm32 vs translated, 50k cases) covers:+,0,x?/X?,#?, and a width taken from an argumentDebugthat pads, so width and precision reach the bounds, and that shows#Hexand of a derivedDebugunder{:#?}next, at the type's top, bynext_back, and bynthArc<Hex>,Arc<Arc<i32>>with sign, zero, hex, and alternate flags,Rc<String>with precision,Arc<Vec<Pair>>pretty,Arc<str>, a range ofArcs, and a derivedDebugstruct holding anArcand rangesA mutation that rewrote
(exhausted)made the differential fail on 411 cases.Impact
DebugandDisplayofArc/Rc, andDebugof every std range, now translate instead of being refused. A..constant translates.fmtRange,fmtRangeInclusive,fmtRangeFrom,fmtRangeTo,fmtRangeToInclusive, andfmtRangeFull. Nothing breaks.Alternatives
Choices made without asking
Rcformats the same asArc, since the translator maps both tort.Arc.RangeFullconstant fix in this PR, because formatting..needs it.Follow-ups
Arc<dyn Debug>is still refused at construction (a std trait object behindArc), with a span. That is trait-object work, not formatting.RangeInclusive::newwith operands that drop (Arc::new(a)..=Arc::new(b)) is refused with a span. The fixture uses aRangeofArcs instead.Review
Head
8c033c389625ce9a85c20780e087f984409e724a: review skipped as a trivial merge. It mergesorigin/main(b29d80fd) into the reviewed head44a7bef667bbe46f8d4a130f327d8e0ed9e1edfb, then merges the branch's own earlier base merge (b2fbaefa, #249), which leaves the tree unchanged. The conflict ints/fixtures/lang/expected/harness.tswas resolved by regenerating snapshots withUPDATE_EXPECT=1, not by hand. The quest file stays deleted, since main only rewrote its links. The changes tots/src,ts/runtime, and the fixture sources are identical to the reviewed head's, apart from hunk offsets.just cipassed locally on this tree.Earlier round: Codex
quest review(gpt-6.1-sol, medium effort), round 1 on44a7bef6againstf78c588f: no findings.Merge of main at
32f651c46d1d9381160526d5b456a5a2dcfcaf54: git merged it without conflicts; it only refreshes the base so GitHub can merge, with no change to this PR's diff since8c033c38, so it is a recorded skip, too trivial to review.🤖 Generated with Claude Code
(written by Claude Opus 5.5)