Skip to content

Commit cfcc115

Browse files
authored
add note about base::inherits() in ?S7_inherits. (RConsortium#488)
1 parent 702f7f6 commit cfcc115

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

R/inherits.R

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#' @returns
1111
#' * `S7_inherits()` returns a single `TRUE` or `FALSE`.
1212
#' * `check_is_S7()` returns nothing; it's called for its side-effects.
13+
#'
14+
#' @note Starting with \R 4.3.0, `base::inherits()` can accept an S7 class as
15+
#' the second argument, supporting usage like `inherits(x, Foo)`.
1316
#' @export
1417
#' @examples
1518
#' Foo1 <- new_class("Foo1")
@@ -21,6 +24,9 @@
2124
#'
2225
#' S7_inherits(Foo1(), Foo2)
2326
#' try(check_is_S7(Foo1(), Foo2))
27+
#'
28+
#' if (getRversion() >= "4.3.0")
29+
#' inherits(Foo1(), Foo1)
2430
S7_inherits <- function(x, class = NULL) {
2531
if (!(is.null(class) || inherits(class, "S7_class"))) {
2632
stop("`class` must be an <S7_class> or NULL")

man/S7_inherits.Rd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)