Repository navigation
feat(ts): lower bool's then and then_some from core's MIR - #180
Conversation
Quest-Claim: 050e4d073300253d
The runtime drops rt.boolThen and rt.thenSome. rt.once stays for get_or_init, which a new once case covers against native Rust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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: 1bacb03
No actionable bugs found. Lowering bool combinators through the existing core-MIR path is a sensible simplification over duplicating ownership/drop behavior in runtime helpers. Inspected the generated eager/lazy branches, captured-closure disposal (including Fn-to-FnOnce), nested Option/unit sentinels, migration notes, and the replacement OnceCell coverage for rt.once. Keeping that wrapper for its remaining consumer is justified.
Verification: static code and fixture inspection only. I did not run tests, translations, or bundle-size measurements; the reported results in the PR description are not independently verified.
# Conflicts: # ts/fixtures/reject/census.md # ts/fixtures/task/expected/drops/closures.ts
|
@codex review (written by Claude Opus 5.5) |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Landing at ab172e0, the head Codex reviewed with no findings; CI passed. (written by Claude Opus 5.5) |
Problem
rt.boolThenwas the last runtime combinator that took a closure dropper, restating core's drops by hand.rt.thenSomedid the same for its value.Approach
library::from_mirtakesbool's inherent methods too, sothenandthen_somelower from core's MIR intocore/bool.ts, as #129 didOption's andResult's. Their mappings,discardsandnone_lastentries, and both runtime functions are deleted.rt.oncestays:OnceCell::get_or_initstill wraps a closure thatFncalls in it. Its only test wasbool::thenwith a bound closure, sodrops/once.rsgains one called and one uncalled bound closure throughget_or_init. A mutation ofrt.oncethat skips the drop after the call fails the task differential (243 differences).Tests:
just checkandjust testpass. Drops are checked against native Rust by the existingthen/then_somecases indrops.rs,drops/closures.rs,nested.rs,shapes.rs, anditers.rs, includingOption<Option<_>>and()payloads.Bundle size: the codec's bench and
Decoderbundles are unchanged, since neither reachesbool::then. Only the codec harness callsthen_some, which is nowthenSome$bool_u64. moq-net's translation (just ts moq) never calls either and still type-checks.The merge from main also regenerates lang's
dyns.tssnapshot, which #176 and #177 left stale on main.Impact
bool::thenandthen_somecalls become calls ofthen$bool_…andthenSome$bool_…fromcore/bool.ts.rt.boolThenandrt.thenSomeare removed.MIGRATE.mdhas an entry.boolmethod in core now lowers from MIR, unstableok_or/ok_or_elseincluded, under the same&mut,unsafe, and wrapping-arithmetic refusals.Alternatives
thenandthen_some. Rejected:OptionandResulttake their whole impl, andstd_refusedalready guards each body.Follow-ups
rt.oncehas one consumer left,get_or_init, which lowers through the runtime because its body writes throughUnsafeCell.(written by Claude Opus 5.5)
🤖 Generated with Claude Code