hhvm / type-assert

Hack library for converting untyped data to typed data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatic coercion should apply to varrays, darrays, vecs, and dicts

skishore opened this issue · comments

The next release of HHVM will eliminate "plain" PHP arrays. After this release:

  • vec assertions should accept both vecs and varrays, coercing both to vecs
  • varray assertions should accept both vecs and varrays, coercing both to varrays
  • similarly for dict and darray assertions

We can use the HH\is_vec_or_varray and HH\is_dict_or_darray helpers to implement this logic. These helpers don't log, like type tests that distinguish PHP and Hack arrays do, since they're safe for the next steps of Hack Array Migration.

Varray and darray are no more. TypeAssert requires hhvm 4.115 (hadva'd). Is this issue okay to close? I can't close issues on hhvm/type-assert myself.

Hmm. It's...almost there? I think we should now eliminate VarraySpec and DarraySpec. They're close to VecSpec and DictSpec, but I think there are some small differences in the trace that's created.

I'll close this task and open a new one.