Make param.list.flag() robust like its flag.* siblings - #46
Open
vertesy wants to merge 2 commits into
Open
Conversation
param.list.flag() extracted its result with a hardcoded
paste(...)[[3]], which only works when called as
param.list.flag(par = p$name) (substitute(par) then deparses to a
3-element c("$", "p", "name") vector). Any other call shape, e.g. a
plain variable, produces a length-1 vector and [[3]] throws "subscript
out of bounds".
Its siblings flag.name_value() and flag.nameiftrue() solve the same
problem more robustly: if (length(output) > 1) output <-
output[length(output)]. Applied the same pattern here. No behavior
change for the existing p$name-shaped call sites; plain-variable calls
that previously errored now work.
Version bumped 1.2.1 -> 1.2.2 in Development/config.R and DESCRIPTION.
Validation: R CMD check and the existing testthat suite (7/7 passing)
were run on this branch; manually verified both the p$name call shape
and a plain-variable call now work correctly. Remaining R CMD check
findings (parFlags example error, parsepvalue undocumented prefix,
%!in% Rd name warning, sandbox locale warning) are pre-existing and out
of scope, addressed in other PRs in this batch or environment-inherent.
…ag-robustness # Conflicts: # DESCRIPTION # Development/config.R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
param.list.flag()extracted its result with a hardcodedpaste(...)[[3]], which only works when called asparam.list.flag(par = p$name)(substitute(par)then deparses to a 3-elementc("$", "p", "name")vector). Any other call shape — e.g. a plain variable — produces a length-1 vector and[[3]]throws "subscript out of bounds".Its siblings
flag.name_value()andflag.nameiftrue()solve the same problem more robustly:if (length(output) > 1) output <- output[length(output)]. Applied the same pattern here.No behavior change for the existing
p$name-shaped call sites; plain-variable calls that previously errored now work.Version bumped 1.2.1 → 1.2.2 in
Development/config.RandDESCRIPTION.Validation
R CMD check and the existing
testthatsuite (7/7 passing) were run on this branch; manually verified both thep$namecall shape and a plain-variable call now work correctly. Remaining R CMD check findings (parFlagsexample error,parsepvalueundocumentedprefix,%!in%Rd-name warning, sandbox locale warning) are pre-existing and out of scope, addressed in other PRs in this batch or environment-inherent.Generated by Claude Code