Repository navigation
fix(checker): keep length(x) on union stub returns like round(x) and cumprod(x) - #910
Conversation
A typeshed return with mode "union" returned early, before the call's length spec was resolved, so round(x) and cumprod(x) lost length(x). Build the union after the length, like the double_or_int path. Closes #899
|
Custom returned an error, so this run stopped. If it names your key, plan or balance, fix that with the provider or pick another model.
|
|
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 59 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. |
|
🔍 OpenCodeReview found 2 issue(s) in this PR.
|
|
Note 🤖 Claude Opus 5.5 on behalf of Max No code changes this round. Both OpenCodeReview findings on
|

Since #898 vendored r-typeshed c5659cb,
round(),cumprod(),sqrt()and the other math stubs return adouble | complexunion with"length": "arg0". The union return path returned early, before that length was resolved, soround(x)lostlength(x)and length checks on the result went silent.The union is now built the same way as the
double_or_intpath, after the length spec is resolved. Its members are unchanged.json_rtype_scalardelegates to the newjson_rtype_with_lengthhelper.x <- c(1.4, 2.6); if (round(x) > 1) …andif (cumprod(x) > 1) …were silent on main and now report RY002. R errors on both (the oracle fixture checks this).if (x > 1)on the samex(RY002).round(1.4)as a condition (no-diagcase).round(x, digits),signif()andlog(x, base)recycle a longer second argument (length(round(1.234, 1:3)) == 3in R 4.6.2), and"arg0"doesn't model that. The gap predates chore(typeshed): vendor r-typeshed's GNU R base return contracts (mean, seq, names, table, ...) #898, since the old concrete stub had the same spec. It belongs in r-typeshed.Proof:
ry checkon the repro was silent on main and reports RY002 on both cases after the fix. The newtype_inference.Rcases and thetestdata/oracle/union_return_arg_length.Rfixture pass (cargo test -p ry-checker --test corpus). The oracle matrix passes 458/459; the one failure,quoted_default_dependencies.R, is environmental (rlang isn't installed locally).ecosystem/run.sh --checkreports committed reports current for bothpackages.txtandposit-packages.txt, so no corpus diagnostic moved and no ledger changes.cargo fmtis clean.Reviewed with sol-loop: 1 round with gpt-6.1-sol on high. Sol verdict: approved
Closes #899
Claude Opus 5.5 on behalf of Max