Skip to content

Commit

Permalink
More accurate comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Oct 28, 2024
1 parent 9be5b2e commit 9f75fb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# tidyselect (development version)

* `matches()` now uses `perl = TRUE` by default. This makes it more consitent with regular expressions in stringr (#330).

* `eval_select()` now fails when data has duplicate names and a character vector is provided as input (#346).

* `eval_select()` and `eval_relocate()` gain a new `error_arg` argument that can be specified to throw a better error message when `allow_empty = FALSE` or `allow_rename = FALSE` (@olivroy, #327).
Expand Down
14 changes: 7 additions & 7 deletions R/eval-walk.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,13 @@ eval_literal <- function(expr, data_mask, context_mask) {

if (internal$uniquely_named && is_character(expr)) {
# Since tidyselect allows repairing data frames with duplicate names by
# renaming positions, we can't check the input for duplicates. Instead, we
# check the output. But in case of character literals, checking the output
# doesn't work because we use `vctrs::vec_as_location()` to transform the
# strings to locations and it ignores duplicate names. So we instead check
# the input here, since it's not possible to repair duplicate names by
# matching them by name. This avoids an inconsistency with the symbolic
# path (#346).
# renaming or selecting positions, we can't check the input for duplicates.
# Instead, we check the output. But in case of character literals, checking
# the output doesn't work because we use `vctrs::vec_as_location()` to
# transform the strings to locations and it ignores duplicate names. So we
# instead check the input here, since it's not possible to repair duplicate
# names by matching them by name. This avoids an inconsistency with the
# symbolic path (#346).
vctrs::vec_as_names(
internal$vars,
repair = "check_unique",
Expand Down

0 comments on commit 9f75fb9

Please sign in to comment.