Skip to content
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

Don’t use partial matching for attr_getter() #461

Merged
merged 2 commits into from
Feb 7, 2018

Conversation

huftis
Copy link
Contributor

@huftis huftis commented Feb 7, 2018

Changed the attr_getter() fuction to no longer uses partial matching.
For example, if an x object has a labels attribute but no label
attribute, attr_getter("label")(x) will no longer extract the labels
attribute (fixes #460).

Also added some documentation on the attr_getter() function.

Changed the `attr_getter()` fuction to no longer uses partial matching.
For example, if an `x` object has a `labels` attribute but no `label`
attribute, `attr_getter("label")(x)` will no longer extract the `labels`
attribute (fixes tidyverse#460).

Also added some documentation on the `attr_getter()` function.
@hadley
Copy link
Member

hadley commented Feb 7, 2018

Would you mind adding a unit test too please?

@huftis
Copy link
Contributor Author

huftis commented Feb 7, 2018

OK, @hadley, I’ve now added a simple unit test that tests

  1. basic functionality of attr_getter()
  2. that attr_getter() uses exact (non-partial) matching

@hadley hadley merged commit 2948a60 into tidyverse:master Feb 7, 2018
@hadley
Copy link
Member

hadley commented Feb 7, 2018

Thanks!

t-kalinowski pushed a commit to t-kalinowski/purrr that referenced this pull request Feb 8, 2018
* Don’t use partial matching for attr_getter()
* Added unit test for exact matching in attr_getter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

attr_getter() uses partial matching, which is error-prone/dangerous
2 participants