Skip to content

Commit 7e54733

Browse files
committed
add fix for s4
1 parent d763816 commit 7e54733

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

inst/tests/S4.Rraw

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,8 @@ setMethod(`%foo%`, c("Date", "CustomDurationClass"), function (e1, e2) e1 - e2@.
126126
test(8, as.IDate("2025-03-01") %foo% CustomDurationClass(1), as.IDate("2025-02-28"))
127127
removeGeneric("%foo%")
128128
removeClass("CustomDurationClass")
129+
130+
# data.table(s4) #6874 should work
131+
s4cl = setClass("s4cl", slots = list(x="integer"))
132+
DT = setalloccol(structure(list(a = new("s4cl", x = 1L)), row.names = c(NA, -1L), class = c("data.table", "data.frame")))
133+
test(9, data.table(a=s4cl(x=1L)), DT)

src/assign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ SEXP setdt_nrows(SEXP x)
232232
}
233233
len_xi = INTEGER(dim_xi)[0];
234234
} else {
235-
len_xi = LENGTH(xi);
235+
len_xi = length(xi);
236236
}
237237
if (!base_length) {
238238
base_length = len_xi;

0 commit comments

Comments
 (0)