diff --git a/R/utils.R b/R/utils.R index e92ef63bb3..f13702f971 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1076,10 +1076,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