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

unspecified() and scalar ptype2 symmetry is wrong #807

Closed
DavisVaughan opened this issue Feb 11, 2020 · 4 comments · Fixed by #823
Closed

unspecified() and scalar ptype2 symmetry is wrong #807

DavisVaughan opened this issue Feb 11, 2020 · 4 comments · Fixed by #823

Comments

@DavisVaughan
Copy link
Member

With current master:

library(vctrs)

foobar <- function(x = list()) structure(x, class = "vctrs_foobar")

vec_ptype2(unspecified(), foobar())
#> list()
#> attr(,"class")
#> [1] "vctrs_foobar"

vec_ptype2(foobar(), unspecified())
#> Error: `x` must be a vector, not a `vctrs_foobar` object

Created on 2020-02-11 by the reprex package (v0.3.0)

@DavisVaughan
Copy link
Member Author

vec_ptype2.vctrs_unspecified() may need to call vec_assert() on y

@romainfrancois
Copy link
Contributor

Is this the same issue as this ?

library(vctrs)
library(tibble)
df <- tibble(x = NA)
vec_ptype(df)$x
#> logical(0)
vec_ptype2(df, df)$x
#> <unspecified> [0]

Created on 2020-02-17 by the reprex package (v0.3.0.9000)

@lionel-
Copy link
Member

lionel- commented Feb 17, 2020

@romainfrancois Both ptype and ptype2 return will unfinalised prototypes across all columns once Davis' changes in #816 are merged.

This particular issue is just about a missing vec_assert() though.

@DavisVaughan
Copy link
Member Author

@romainfrancois with current master, because of #816

library(vctrs)
library(tibble)

df <- tibble(x = NA)

vec_ptype(df)$x
#> <unspecified> [0]
vec_ptype2(df, df)$x
#> <unspecified> [0]

vec_ptype_common(df)$x
#> logical(0)
vec_ptype_common(df, df)$x
#> logical(0)

Created on 2020-02-17 by the reprex package (v0.3.0)

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 a pull request may close this issue.

3 participants