-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for duplicate names when supplying character literals #367
Conversation
@@ -18,36 +18,12 @@ vars_select_eval <- function(vars, | |||
return(pos) | |||
} | |||
|
|||
uniquely_named <- uniquely_named %||% is.data.frame(data) | |||
|
|||
if (!is_symbolic(wrapped)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this early exit for literals so that all inputs go through the same path via the tidyselect interpreter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a very good idea for consistency
@@ -301,11 +277,6 @@ chr_as_locations <- function(x, vars, call = caller_env(), arg = NULL) { | |||
set_names(out, names(x)) | |||
} | |||
|
|||
as_indices <- function(x, vars, strict = TRUE, call) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unused.
internal <- data_mask$.__tidyselect__.$internal | ||
|
||
if (internal$uniquely_named && is_character(expr)) { | ||
# Since tidyselect allows repairing data frames with duplicate names by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully this comment is clear 😬
vars_split <- vctrs::vec_split(seq_along(vars), vars) | ||
|
||
# Mark data duplicates so we can fail instead of disambiguating them | ||
# when renaming | ||
uniquely_named <- uniquely_named %||% is.data.frame(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I didn't know the uniqueness check behavior depended on whether or not the input was a data frame vs like a named list or named character vector
@@ -18,36 +18,12 @@ vars_select_eval <- function(vars, | |||
return(pos) | |||
} | |||
|
|||
uniquely_named <- uniquely_named %||% is.data.frame(data) | |||
|
|||
if (!is_symbolic(wrapped)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a very good idea for consistency
1d54d2d
to
9f75fb9
Compare
Closes #346.