Allow function pointer builtins in constant initializers
commit3cd8e8109ba89970042cb35fd3f66a2aa0e0aedd
authorMartyna Siejba <tysia2512@fb.com>
Thu, 19 Sep 2019 16:19:58 +0000 (19 09:19 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 19 Sep 2019 16:23:29 +0000 (19 09:23 -0700)
treed629f058add995f2cb9cb0f920b308a3230f2f8e
parent8bf3339ad2fb0c7813061815262ac6dc4032f473
Allow function pointer builtins in constant initializers

Summary: Allow use of function pointers and class method pointers in constant expressions. They are translated to `ResolveFunc` and `ResolveClsMethod` in bytecode, which protects them from being evaluated too early and to a wrong value.

Reviewed By: periodic1236

Differential Revision: D16925419

fbshipit-source-id: 78ddf9891ead0a810e75def9b9bfaba435a523c1
57 files changed:
hphp/hack/src/client/ide_service/clientIdeIncremental.ml
hphp/hack/src/facts/facts_parser.ml
hphp/hack/src/facts/facts_parser.mli
hphp/hack/src/facts/facts_parser.rs
hphp/hack/src/facts/rust_facts_ffi.rs
hphp/hack/src/facts/symbols/indexBuilder.ml
hphp/hack/src/hh_parse.ml
hphp/hack/src/hh_single_compile.ml
hphp/hack/src/hh_single_type_check.ml
hphp/hack/src/hhbc/hhbc_options.ml
hphp/hack/src/naming/naming.ml
hphp/hack/src/options/globalOptions.ml
hphp/hack/src/options/globalOptions.mli
hphp/hack/src/options/parserOptions.ml
hphp/hack/src/oxidized/gen/global_options.rs
hphp/hack/src/oxidized/gen/typing_defs.rs
hphp/hack/src/oxidized/manual/global_options_impl.rs
hphp/hack/src/parser/full_fidelity_parser_errors.ml
hphp/hack/src/parser/lowerer_ffi.rs
hphp/hack/src/parser/parser_env.rs
hphp/hack/src/parser/ppl/rust_ppl_class_rewriter_ffi.rs
hphp/hack/src/parser/rust_parser_ffi.rs
hphp/hack/src/server/serverConfig.ml
hphp/hack/test/rust/facts_parse.rs
hphp/hack/test/typecheck/func_ptr_in_constants/allowed_func_ptr_builtins.php [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/allowed_func_ptr_builtins.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/custom_function.php [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/custom_function.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/disallowed/HH_FLAGS [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/disallowed/allowed_func_ptr_builtins.php [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/disallowed/allowed_func_ptr_builtins.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/meth_caller.php [new file with mode: 0644]
hphp/hack/test/typecheck/func_ptr_in_constants/meth_caller.php.exp [new file with mode: 0644]
hphp/runtime/base/runtime-option.h
hphp/runtime/base/type-variant.cpp
hphp/test/slow/func-ptr/const-func-ptr-dynamic-include.php [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr-dynamic-include.php.expect [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr-dynamic-include.php.norepo [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr-dynamic-include.php.opts [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr-include1.inc [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr-include2.inc [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr.php [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr.php.expect [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/func-ptr/const-func-ptr.php.opts [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed.php [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed.php.expectf [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed.php.norepo [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed.php.opts [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed1.php.inc [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed2.php.inc [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed3.php.inc [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const-disallowed4.php.inc [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const.php [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const.php.expect [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/func-ptr/func-ptr-in-const.php.opts [new file with mode: 0644]