diff --git a/NEWS.md b/NEWS.md index 06aacf69..62c01795 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ * `parameters()` and the `grid_*()` functions give more information in the error message when non-parameter objects are passed in (#437). +* `value_validate()`, `encode_unit()`, `get_p()`, `get_log_p()`, `get_n()`, `get_n_frac()`, `get_n_frac_range()`, and `get_batch_sizes()` now enforce empty dots (#439). + # dials 1.4.2 diff --git a/R/aaa_values.R b/R/aaa_values.R index b28811a6..bf7c2480 100644 --- a/R/aaa_values.R +++ b/R/aaa_values.R @@ -74,6 +74,7 @@ #' @export value_validate <- function(object, values, ..., call = caller_env()) { check_inherits(object, "param") + check_dots_empty() res <- switch( object$type, double = , diff --git a/R/encode_unit.R b/R/encode_unit.R index 07e95361..d4533fb2 100644 --- a/R/encode_unit.R +++ b/R/encode_unit.R @@ -70,6 +70,7 @@ encode_unit.quant_param <- function(x, value, direction, original = TRUE, ...) { #' @rdname encode_unit #' @export encode_unit.qual_param <- function(x, value, direction, ...) { + check_dots_empty() if (has_unknowns(x)) { cli::cli_abort("The parameter object contains unknowns.") } diff --git a/R/finalize.R b/R/finalize.R index 4a440412..383c4146 100644 --- a/R/finalize.R +++ b/R/finalize.R @@ -156,6 +156,7 @@ finalize.default <- function(object, x, force = TRUE, ...) { get_p <- function(object, x, log_vals = FALSE, ...) { check_inherits(object, "param") check_bool(log_vals) + check_dots_empty() rngs <- range_get(object, original = FALSE) if (!is_unknown(rngs$upper)) { @@ -186,7 +187,8 @@ get_p <- function(object, x, log_vals = FALSE, ...) { #' @rdname finalize get_log_p <- function(object, x, ...) { check_inherits(object, "param") - get_p(object, x, log_vals = TRUE, ...) + check_dots_empty() + get_p(object, x, log_vals = TRUE) } #' @export @@ -195,6 +197,7 @@ get_n_frac <- function(object, x, log_vals = FALSE, frac = 1 / 3, ...) { check_inherits(object, "param") check_bool(log_vals) check_number_decimal(frac, min = 0, max = 1) + check_dots_empty() rngs <- range_get(object, original = FALSE) if (!is_unknown(rngs$upper)) { @@ -233,6 +236,7 @@ get_n_frac_range <- function( check_inherits(object, "param") check_bool(log_vals) check_frac_range(frac) + check_dots_empty() rngs <- range_get(object, original = FALSE) if (!is_unknown(rngs$upper)) { @@ -265,7 +269,8 @@ get_n_frac_range <- function( #' @rdname finalize get_n <- function(object, x, log_vals = FALSE, ...) { check_inherits(object, "param") - get_n_frac(object, x, log_vals, frac = 1, ...) + check_dots_empty() + get_n_frac(object, x, log_vals, frac = 1) } #' @export @@ -294,6 +299,7 @@ get_rbf_range <- function(object, x, seed = sample.int(10^5, 1), ...) { #' @export get_batch_sizes <- function(object, x, frac = c(1 / 10, 1 / 3), ...) { lifecycle::deprecate_warn("1.4.2", "get_batch_sizes()") + check_dots_empty() rngs <- range_get(object, original = FALSE) if (!is_unknown(rngs$lower) & !is_unknown(rngs$upper)) { diff --git a/R/space_filling.R b/R/space_filling.R index e5f4a655..6f529912 100644 --- a/R/space_filling.R +++ b/R/space_filling.R @@ -475,9 +475,13 @@ make_max_entropy_grid <- function( sf_grid <- map2( params, sf_grid, - encode_unit, - direction = "backward", - original = original + \(param, grid) { + if (inherits(param, "quant_param")) { + encode_unit(param, grid, direction = "backward", original = original) + } else { + encode_unit(param, grid, direction = "backward") + } + } ) names(sf_grid) <- param_names as_tibble(sf_grid) @@ -566,9 +570,13 @@ make_latin_hypercube_grid <- function( sf_grid <- map2( params, sf_grid, - encode_unit, - direction = "backward", - original = original + \(param, grid) { + if (inherits(param, "quant_param")) { + encode_unit(param, grid, direction = "backward", original = original) + } else { + encode_unit(param, grid, direction = "backward") + } + } ) names(sf_grid) <- param_names as_tibble(sf_grid)