Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An Existing Use of @inheritParams Broke #1515

Closed
brodieG opened this issue Oct 6, 2023 · 1 comment
Closed

An Existing Use of @inheritParams Broke #1515

brodieG opened this issue Oct 6, 2023 · 1 comment

Comments

@brodieG
Copy link
Contributor

brodieG commented Oct 6, 2023

Similar problem to #1347 caused by the fix for #950, but in this case it seems to me the old behavior was correct. We have ?substr:

...
substr(x, start, stop)
substring(text, first, last = 1000000L)
...
Arguments
x, text        a character vector.
start, first   integer. The first element to be extracted or replaced.
...

In fansi I have @inheritParams base::substr, which with previous roxygen2 produced the desired correct outcome.

Would you consider a PR to do a second matching pass to recover the correct old behavior in cases like these? Of course it is the user's responsibility to make sure that inheriting a subset of joint parameters like this makes sense as it does here (less so with e.g. taking just x out of x,y from merge).

A code example showing the failure to inherit:

library(roxygen2)
out <- roc_proc_text(rd_roclet(), "
#' My substr
#'
#' @inheritParams base::substr
#' @param myparam parmesan
mysubstr <- function(x, start, stop, myparam) {}")[[1]]
out$get_value("param")
##   myparam 
## "parmesan" 

vs

#' My substr
#'
#' @inheritParams base::substr
#' @param myparam parmesan
mysubstr <- function(x, start, first, myparam) {}")[[1]]
out$get_value("param")
## > out$get_value("param")
##                                                start,first 
## "integer.  The first element to be extracted or replaced." 
##                                                    myparam 
##                                                 "parmesan" 
@hadley
Copy link
Member

hadley commented Nov 1, 2023

I think unfortunately that this comes up infrequently enough that I really don't want to make the existing algorithm more complicated.

@hadley hadley closed this as completed Nov 1, 2023
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 25, 2024
## v1.0.6
  * Fix new `-Wformat` warnings.

## v1.0.5
  * Address roxygen2 breaking changes:

  * Add explicit alias for `fansi-package` now that it is no longer
    auto-generated by roxgen2 from the [`@docType package`
    directive](r-lib/roxygen2#1491).
  * Work around [changed behavior for
    `@inheritParams`](r-lib/roxygen2#1515).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants