Introduce readonly variant of idx
commit7d534b943372a0ee434233e451b043820fa226e3
authorJames Wu <jjwu@fb.com>
Tue, 5 Oct 2021 23:15:23 +0000 (5 16:15 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 5 Oct 2021 23:17:25 +0000 (5 16:17 -0700)
treefdf2ac7deeabf7f6a7b89c6b170c5bef48a50189
parenta017049020c19739cdccacf953500530ed8bed58
Introduce readonly variant of idx

Summary:
This diff introduces idxReadonly, which acts as idx on a readonly collection (and returns a readonly result).

Because we do not have ways to parameterize on readonly (nor do we intend to build such a feature in the near future), some collection HSL functions will need readonly variants, like idx.

Reviewed By: oulgen

Differential Revision: D31317828

fbshipit-source-id: 363edba72d737abf227950870c33987414e92857
22 files changed:
hphp/hack/hhi/idx.hhi
hphp/hack/src/hhbc/hhbc_by_ref/emit_expression.rs
hphp/hack/src/naming/naming_special_names.ml
hphp/hack/src/naming/naming_special_names.rs
hphp/hack/src/parser/hh_autoimport.ml
hphp/hack/src/parser/hh_autoimport.rs
hphp/hack/src/typing/typing_special_fun.ml
hphp/hack/test/identify_symbol/idx.php.exp
hphp/hack/test/typecheck/idx2_2.php.exp
hphp/hack/test/typecheck/idx2_4.php.exp
hphp/hack/test/typecheck/idx3_5.php.exp
hphp/hack/test/typecheck/idx_too_few_args.php.exp
hphp/hack/test/typecheck/idx_too_many_args.php.exp
hphp/hack/test/typecheck/readonly/readonly_idx_2.php [new file with mode: 0644]
hphp/hack/test/typecheck/readonly/readonly_idx_2.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/readonly/readonly_idx_3.php [new file with mode: 0644]
hphp/hack/test/typecheck/readonly/readonly_idx_3.php.exp [new file with mode: 0644]
hphp/system/php/misc/idx.php
hphp/test/slow/readonly/readonly_idx.php [new file with mode: 0644]
hphp/test/slow/readonly/readonly_idx.php.expectf [new file with mode: 0644]
hphp/test/slow/readonly/readonly_idx2.php [new file with mode: 0644]
hphp/test/slow/readonly/readonly_idx2.php.expectf [new file with mode: 0644]