-
Notifications
You must be signed in to change notification settings - Fork 235
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
S4 signature for trailing ANY is not created #460
Comments
The basic problem is that the library(methods)
setGeneric("foo", function(x, y) standardGeneric("foo"))
#> [1] "foo"
setMethod("foo", c("numeric", "ANY"), function(x, y) x)
#> [1] "foo"
methods::getMethod("foo", c("numeric", "ANY"))@target
#> An object of class "signature"
#> x
#> "numeric" @lawremi any idea what might be going on here? @wahani are you sure you can just do |
Trailing ANY's are dropped from the signature by My guess is that Roxygen queries the method for its signature just after it is defined, and if every method so far has ANY for some argument, that argument is excluded from the signature. Later, a method is defined with a specific class for that argument, and thus all of the method signatures are updated. Probably the most pragmatic way forward is for roxygen to do the equivalent of |
Thank you for the clarification. With the current version 3.3.1 I am not able to reproduce the warning. The behavior of roxygen is unchanged, however |
I tested the thing with after the fix. I now get the correct entry in the Rd file:
Basically the opposite from what I initially reported. Adding |
Hi, I have the following problem while documenting a S4-generic and its methods:
When I define a method where the trailing argument has type "ANY" an entry in the documentation is only created for the signature "numeric" instead of numeric,ANY in the following example:
This results in a warning from R CMD check because the
numeric,ANY
method documentation entry is missing. I suspect that this happens becausemethods("myGeneric")
will report that there is only a method for signature "numeric" and hence roxygen will only create a doc entry for this signature. This is only an issue when the last argument is of type "ANY" - a different order will work - sincemethods
will report the correct signature.Don't know if this is solvable within roxygen2. My attempts to bypass the issue by creating the doc entry manually have failed so far. I am using roxygen2 version 5.0.1 and R3.2.2 on Ubuntu 14.10
Thanks,
-s
The text was updated successfully, but these errors were encountered: