Skip to content

Commit 5d5cd45

Browse files
author
maechler
committed
checkReplaceFuns(): amend c88398
git-svn-id: https://svn.r-project.org/R/trunk@88404 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 378c404 commit 5d5cd45

File tree

1 file changed

+7
-4
lines changed
  • src/library/tools/R

1 file changed

+7
-4
lines changed

src/library/tools/R/QC.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,7 @@ function(package, dir, lib.loc = NULL)
29062906
ns_S3_methods <- as.character(ns_S3_methods)
29072907
}
29082908
## S3 replacement methods from namespace registration?
2909-
replace_funs <- ns_S3_methods[endsWith(ns_S3_generics, "<-")]
2909+
replace_funs <- ns_S3_methods[ns_S3_genRepl <- endsWith(ns_S3_generics, "<-")]
29102910
## Now remove the functions registered as S3 methods.
29112911
objects_in_code <- setdiff(objects_in_code, ns_S3_methods)
29122912
} else
@@ -2941,10 +2941,13 @@ function(package, dir, lib.loc = NULL)
29412941
} else character()
29422942

29432943
if(has_S3_fun_obj) {
2944-
if(!all(ok_lastArg <- vapply(S3_fun_obj, .check_last_formal_arg, NA)))
2944+
## S3 replacement generic/methods
2945+
isRepl <- ns_S3_genRepl[nonCh]
2946+
if(any(isRepl) && any(bad_last <- !vapply(S3_fun_obj[isRepl], .check_last_formal_arg, NA)))
29452947
bad_replace_funs <-
2946-
c(bad_replace_funs, paste0(ns_S3_generics [nonCh], ".:.", # not "." on purpose
2947-
ns_S3_methods_db[nonCh, 2L]))
2948+
c(bad_replace_funs, paste0(ns_S3_generics [nonCh][isRepl][bad_last],
2949+
" . ", # not "." on purpose, but similar
2950+
ns_S3_methods_db[nonCh, 2L][isRepl][bad_last]))
29482951
}
29492952
if(.isMethodsDispatchOn()) {
29502953
S4_generics <- .get_S4_generics(code_env)

0 commit comments

Comments
 (0)