@@ -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