Fix HPHPC handling of foldable functions that can return Hack arrays
commit118a4fea3a51c42fef063c53739e892b8ad68fbb
authorRick Lavoie <rlavoie@fb.com>
Sat, 25 Mar 2017 01:58:09 +0000 (24 18:58 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Sat, 25 Mar 2017 02:12:54 +0000 (24 19:12 -0700)
tree49079574fb2ea8b90cad1fc13199c947a92a83f8
parent1c55b5978d06e7922d093b5b7d77819affbdbb25
Fix HPHPC handling of foldable functions that can return Hack arrays

Summary:
When HPHPC folds a foldable function to a constant, and that constant
is array-like, it assumes that its a PHP array. This can lead to Hack arrays
mysteriously becoming PHP arrays in certain contexts. Instead check for the
actual type of the array and convert it to the right AST node as appropriate.

Reviewed By: markw65

Differential Revision: D4771956

fbshipit-source-id: e546617223f6c12eb211575405450febdb604a6d
hphp/compiler/expression/expression.cpp
hphp/test/slow/hack-arrays-hphpc-const-fold.php [new file with mode: 0644]
hphp/test/slow/hack-arrays-hphpc-const-fold.php.expect [new file with mode: 0644]