From 764c1d5e56ad34341c0bab8cad0e6c3fcb256179 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Sat, 9 Jul 2022 21:14:42 -0500 Subject: [PATCH] Only show inherited methods if they exist Fixes #1371 --- R/rd-r6.R | 4 +++- tests/testthat/_snaps/rd-r6.md | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/R/rd-r6.R b/R/rd-r6.R index 2cb5bdd0..a70c8552 100644 --- a/R/rd-r6.R +++ b/R/rd-r6.R @@ -258,9 +258,11 @@ r6_inherited_method_list <- function(block, r6data) { self <- r6data$self super_meth <- super_meth[! super_meth$name %in% self$name, ] super_meth <- super_meth[! duplicated(super_meth$name), ] + if (nrow(super_meth) == 0) { + return() + } super_meth <- super_meth[rev(seq_len(nrow(super_meth))), ] - details <- paste0( "Inherited methods - - - }} \if{html}{\out{
}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-C2-meth1}{}}}