diff --git a/R/utils.R b/R/utils.R index 663e11174..1166de42e 100644 --- a/R/utils.R +++ b/R/utils.R @@ -414,10 +414,15 @@ select_decorators <- function(decorators, scope) { #' @keywords internal normalize_decorators <- function(decorators) { if (checkmate::test_list(decorators, "teal_transform_module")) { - if (checkmate::test_names(names(decorators))) { + decorators_names <- names(decorators)[!names(decorators) %in% ""] + # Above is equivalent to decorators_names <- setdiff(names(decorators), "") + # but can return non-unique values. Non-unique values are checked in assert_decorators. + if (length(decorators_names) == 0) { + list(default = decorators) + } else if (length(decorators_names) == length(decorators)) { lapply(decorators, list) } else { - list(default = decorators) + stop("All decorators should either be named or unnamed.") } } else { decorators