-
Notifications
You must be signed in to change notification settings - Fork 195
Use a slightly altered isS3stdGeneric() to detect non-standard generics
#857
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
Changes from all commits
f1edf83
de24ab2
251e174
3917dec
0bb7f23
9d091d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| test_that("is_s3_generic", { | ||
| func <- function(x) { | ||
| print(x) | ||
| UseMethod("func") | ||
| } | ||
|
Comment on lines
+2
to
+5
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a valid use case for the other way around?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's try & keep close to the base definition unless there's a compelling reason? i'm also a bit hesitant for this change if it's not being suggested upstream as well
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The base definition checks the first call, so would find my example iinm. That's why I'm asking.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't the call that's found
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right. I wonder why base R looks for the first call instead of the last, then...
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't see anything about isS3stdGeneric() on r-devel in a quick search... maybe worth bringing up there. cc @moodymudskipper who identified the bug fix at root in #1161 |
||
|
|
||
| expect_true(is_s3_generic(func)) | ||
| }) | ||
|
|
||
| test_that("is_s3_generic doesn't error for namespace-qualified calls", { | ||
| func <- function(...) { | ||
| pkg::call() | ||
| } | ||
|
|
||
| expect_warning(result <- is_s3_generic(func), NA) | ||
| expect_false(result) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.