Trying to fix a HH complain... Basically the code is doing something similar to this
Sfirstgroup = idx($largegroup, "first");
$final_thing = null
if(HH\is_any_array(Sfirstgroup) && Sfirstgroup){
/*HH_FIXME[4110] Error revealed by is_arry refining to varray_or_darray */
$final_thing = idx(Sfirstgroup[0],"final_thing")
}
I think it must have some thing to with firstgroup[0] doesn't have a collection type. but couldn't figure out how to fix this...
Thanks a lot!
You have two type errors:
$firstgroup[0]doesn't work very well with the inferred type fromis_any_array, which infers wildcard generics for the key type (i.e. it's aKeyedContainer<_,_>). Either change$a[0]toidx($a, 0)or useis_vec_or_varrayif all your keys areint, since it refines tovec<_>.$firstgroup[0]is aKeyedContainerto use your secondidxcall for$final_thing. The refinement checks likeis_any_arraywon't work on an indexed variable (like$firstgroup[0]), so you have to make a temporary variable to refine it.All in all, here's one possible solution: