See #812 (comment)
vec_ptype2.logical.list() was special cased to not allow vec_assign(list(1), 1, NA), but vec_assign(list(1), 1, unspecified(1)) happened to slip through because it isn't caught by that method. This special case complicates the vec_type2() C code and is why I need vec_ptype2_dispatch_unspecified_list().
I personally think that vec_assign(list(1), 1, NA) should be allowed, and is well defined. NA is cast to list(NULL), and then assigned.
So my suggestion would be to:
-
Remove vec_ptype2.logical.list() entirely, and let vec_ptype2.logical.default() be called
-
Remove the C level vec_ptype2_dispatch_unspecified_list() special case (remove C level stop_incompatible_type() if we do this)
-
Update the test in test-slice-assign.R to allow NA to be assigned into lists (and continue monitoring the existing test that unspecified() can also be assigned into lists)
See #812 (comment)
vec_ptype2.logical.list()was special cased to not allowvec_assign(list(1), 1, NA), butvec_assign(list(1), 1, unspecified(1))happened to slip through because it isn't caught by that method. This special case complicates thevec_type2()C code and is why I needvec_ptype2_dispatch_unspecified_list().I personally think that
vec_assign(list(1), 1, NA)should be allowed, and is well defined.NAis cast tolist(NULL), and then assigned.So my suggestion would be to:
Remove
vec_ptype2.logical.list()entirely, and letvec_ptype2.logical.default()be calledRemove the C level
vec_ptype2_dispatch_unspecified_list()special case (remove C levelstop_incompatible_type()if we do this)Update the test in
test-slice-assign.Rto allowNAto be assigned into lists (and continue monitoring the existing test thatunspecified()can also be assigned into lists)