Skip to content

Commit 25838a8

Browse files
authored
R7 was renamed to S7 (#1688)
1 parent ec5c80a commit 25838a8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

R/standalone-obj-type.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# ---
22
# repo: r-lib/rlang
33
# file: standalone-obj-type.R
4-
# last-updated: 2023-05-01
4+
# last-updated: 2024-02-14
55
# license: https://unlicense.org
66
# imports: rlang (>= 1.1.0)
77
# ---
88
#
99
# ## Changelog
1010
#
11+
# 2024-02-14:
12+
# - `obj_type_friendly()` now works for S7 objects.
13+
#
1114
# 2023-05-01:
1215
# - `obj_type_friendly()` now only displays the first class of S3 objects.
1316
#
@@ -263,19 +266,19 @@ vec_type_friendly <- function(x, length = FALSE) {
263266
#' Return OO type
264267
#' @param x Any R object.
265268
#' @return One of `"bare"` (for non-OO objects), `"S3"`, `"S4"`,
266-
#' `"R6"`, or `"R7"`.
269+
#' `"R6"`, or `"S7"`.
267270
#' @noRd
268271
obj_type_oo <- function(x) {
269272
if (!is.object(x)) {
270273
return("bare")
271274
}
272275

273-
class <- inherits(x, c("R6", "R7_object"), which = TRUE)
276+
class <- inherits(x, c("R6", "S7_object"), which = TRUE)
274277

275278
if (class[[1]]) {
276279
"R6"
277280
} else if (class[[2]]) {
278-
"R7"
281+
"S7"
279282
} else if (isS4(x)) {
280283
"S4"
281284
} else {

tests/testthat/test-standalone-obj-type.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ test_that("obj_type_oo() works", {
1616
r6 <- R6Class("r6")$new()
1717
expect_equal(obj_type_oo(r6), "R6")
1818

19-
import_or_skip("R7", "new_class")
20-
r7 <- new_class("r7")()
21-
expect_equal(obj_type_oo(r7), "R7")
19+
import_or_skip("S7", "new_class")
20+
s7 <- new_class("s7")()
21+
expect_equal(obj_type_oo(s7), "S7")
2222
})
2323

2424
test_that("stop_input_type() handles I() in `arg` (#1607)", {

0 commit comments

Comments
 (0)