darray and varray should only be keywords when followed by "["
commit411ddd9285760e11dc1d1b8aba11d722db637d4b
authorMichael Tingley <tingley@fb.com>
Wed, 26 Apr 2017 02:16:55 +0000 (25 19:16 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 26 Apr 2017 02:17:30 +0000 (25 19:17 -0700)
tree111418b70a300a502cccb41e59608da57aa25131
parent223f2a88dc758c1cb0859784abcc9d38ce1e4476
darray and varray should only be keywords when followed by "["

Summary: `darray` and `varray` in an expression position are only interpreted as words with a special meaning when followed by `[`. This means that `darray` and `varray` can be used as function names. This should allow a definition of these functions that, under the hood, uses an `array` cast in order to take a `mixed` type object and return a `darray` or a `varray` with the required type parameters.

Reviewed By: KendallHopkins

Differential Revision: D4950084

fbshipit-source-id: c238ac0bb58e1ab8ed27f82a7865633c0b267ab9
hphp/hack/src/parser/parser_hack.ml
hphp/hack/test/typecheck/array/no_safe_array/cast_darray.php [new file with mode: 0644]
hphp/hack/test/typecheck/array/no_safe_array/cast_darray.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/array/no_safe_array/cast_varray.php [new file with mode: 0644]
hphp/hack/test/typecheck/array/no_safe_array/cast_varray.php.exp [new file with mode: 0644]