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

Match vctrs coercion rules for simple types #904

Closed
hadley opened this issue Aug 29, 2022 · 0 comments · Fixed by #914
Closed

Match vctrs coercion rules for simple types #904

hadley opened this issue Aug 29, 2022 · 0 comments · Fixed by #914
Labels
feature a feature request or enhancement vctrs ♣️

Comments

@hadley
Copy link
Member

hadley commented Aug 29, 2022

library(purrr)

# Should succeed
map_lgl(0, identity)
#> Error: Can't coerce element 1 from a double to a logical
map_lgl(1, identity)
#> Error: Can't coerce element 1 from a double to a logical

map_int(1, identity)
#> Error: Can't coerce element 1 from a double to a integer

# Should error
map_chr(TRUE, identity)
#> [1] "TRUE"
map_chr(1L, identity)
#> [1] "1"
map_chr(1, identity)
#> [1] "1.000000"

Created on 2022-08-29 by the reprex package (v2.0.1)

Requires a set of (relatively straightforward) changes to set_vector_value()

May need to deprecate if this breaks too many revdeps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement vctrs ♣️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant