Fix discarded return value and undefined variable bugs - #53
Conversation
ReplaceSpecialCharacters() called ReplaceRepeatedDots(x) but discarded its result, so repeated dots were never actually collapsed. parFlags() referenced an undefined `namez`, erroring on every call. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c2a5398ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| collapsechar = ".") { | ||
| .Deprecated("parFlags2") | ||
| val <- c(...) | ||
| namez <- as.character(as.list(match.call())[-(1:2)]) |
There was a problem hiding this comment.
Extract parFlags names only from the dots
Problem: match.call() contains every supplied argument, but removing its first two elements only works when prefix is explicitly first and no control argument follows. Trigger: parFlags(pearson = TRUE) drops pearson, while calls that set documented arguments such as collapsechar also include that argument in namez, causing wrong names or a length mismatch at names(val) <- namez. Fix: Capture expressions from ... directly instead of slicing the complete call.
AGENTS.md reference: AGENTS.md:L25-L29
Useful? React with 👍 / 👎.
|
1 "Problem: match.call() contains every supplied argument, but removing its first two elements only works when prefix is explicitly first and no control argument follows. Trigger: parFlags(pearson = TRUE) drops pearson, while calls that set documented arguments such as collapsechar also include that argument in namez, causing wrong names or a length mismatch at names(val) <- namez. Fix: Capture expressions from ... directly instead of slicing the complete call." 2 |
|
Claude finished @vertesy's task in 3m 52s —— View job Summary
1. Codex feedback on
|
match.call() included every supplied argument (prefix, pasteflg, collapsechar), so slicing off the first two elements broke as soon as a control argument was passed or reordered. Extract names directly from the `...` pairlist instead, using each argument's explicit name when given or its deparsed expression otherwise. Co-authored-by: Abel Vertesy <5101911+vertesy@users.noreply.github.com>
|
I resolved one of the conflicts. The other conflict is remaining, and I need your evaluation on that. It looks like the current change is a very verbose way to guard against some errors that I have never experienced. Does it even worth it? I'm not sure if I fully understand what the current change is suggesting and why the incoming change is not sufficient. I understand that we fixed this match call, which Codex declared as being problematic. But just looking at the resolution, I don't want that, because I just don't want to turn 1 line into more or less works into 6 lines. Verbose code is our enemy. Remember that. |
|
Claude finished @vertesy's task in 2m 8s —— View job Tasks
Evaluation: which side to keepKeep your branch's version (top side), not Walk through
So the extra lines aren't defensive padding against a hypothetical — they're the only way to distinguish "dot-arg supplied as That said, your instinct is right that this is a low-stakes edge case in practice: Recommendation: keep your branch's version in the conflict (resolve in favor of Not implementing this in your local merge myself since it's an in-progress conflict resolution in your checkout, not something visible in this repo's state — let me know if you'd like me to instead push a resolution directly to this PR branch. |
Summary
Fixes 2 bugs flagged during the recent code-annotation pass, both in
R/Stringendo.R.Why
ReplaceSpecialCharacters()calledReplaceRepeatedDots(x)but discarded the result — repeated dots were silently never collapsed. Now assigns it back tox.parFlags()referencednamez, which was never defined — every call errored. Restored thenamez <- as.character(as.list(match.call())[-(1:2)])line that its successorparFlags2()already has.Verified both fixes interactively via
devtools::load_all(); notestthatsuite exists in this repo to run.