covr icon indicating copy to clipboard operation
covr copied to clipboard

Warning when switch has trailing `,`

Open hadley opened this issue 3 years ago • 0 comments

Something like:

function(x) {
  switch(x, 1, 2, 3,)
}

Leads to something like:

Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  (converted from warning) longer argument not a multiple of length of shorter
Backtrace:
     ▆
  1. └─covr::environment_coverage(env, "tests/testthat/test-parse.R")
  2.   └─covr:::trace_environment(env)
  3.     ├─covr:::compact(...)
  4.     └─base::lapply(ls(env, all.names = TRUE), replacement, env = env)
  5.       └─covr:::FUN(X[[i]], ...)
  6.         └─covr:::trace_calls(target_value, name)
  7.           └─covr:::trace_calls(fun_body, parent_functions)
  8.             └─base::Map(trace_calls, x, src_ref, MoreArgs = list(parent_functions = parent_functions))
  9.               └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)
 10.                 └─(function (x, parent_functions = NULL, parent_ref = NULL) ...
 11.                   └─base::Map(trace_calls, x, src_ref, MoreArgs = list(parent_functions = parent_functions))
 12.                     └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)

hadley avatar Jun 22 '21 22:06 hadley