Skip to content

Commit

Permalink
Replace no_use_hack_collections_ with legacy_arrays_
Browse files Browse the repository at this point in the history
Summary:
# What?
Replace `no_use_hack_collections_` with `legacy_arrays_`.

# Why?
As mentioned in the context, `legacy_arrays_` replaces `no_use_hack_collections_`.

# Fixtures
Generated fixtures must not change.

# Context
`arraysets`, `no_use_hack_collections`, `stricttypes`, `array_migration`, `shape_arraykeys`, `const_collections` are all compiler options that control the generation of container fields. To make code generator simpler and easier to reason about, identify which of these can be removed/merged.

The new options based on the ones that are currently in use:

`legacy_arrays` replaces `no_use_hack_collections`.
`hack_collections`, which was the implicit default in the absence of `arrays` and `no_use_hack_collections`, is now explicit.
`arrays` will eventually become the default and cease to exist as an explicit option.

# The steps
The item in bold corresponds to the current diff.
1. Use new compiler options based on the ones that already exist.
1. Make arrays the default option.
1. Use the legacy arrays + hack collections logical equivalent of arrays.
1. Introduce hack collections wherever necessary.
1. **Replace no use hack collections with legacy arrays.**
1. Remove arraysets if arrays present.
1. Rename `no_use_hack_collections` compiler option to `legacy_arrays`.
1. Add `hack_collections` compiler option.
1. Remove references to the `arrays` compiler option.
1. Delete the `arrays` compiler option.

Reviewed By: yfeldblum

Differential Revision: D67586860

fbshipit-source-id: ffa1160f4f29770b40c6b36ff664584a513590d7
  • Loading branch information
Satish Kumar authored and facebook-github-bot committed Dec 27, 2024
1 parent d64437c commit cdc5ba0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions thrift/compiler/generate/t_hack_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3221,7 +3221,7 @@ void t_hack_generator::generate_php_struct_shape_collection_value_lambda(
if (t->is_struct()) {
out << "$" << tmp << "->__toShape(),\n";
} else if (t->is_set()) {
if (arraysets_ || no_use_hack_collections_) {
if (arraysets_ || legacy_arrays_) {
out << "dict($" << tmp << "),\n";
} else {
out << "ThriftUtil::toDArray(Dict\\fill_keys($" << tmp
Expand Down Expand Up @@ -6935,7 +6935,7 @@ void t_hack_generator::_generate_service_client(
continue;
}
_generate_service_client_child_fn(out, tservice, function);
if (no_use_hack_collections_) {
if (legacy_arrays_) {
_generate_service_client_child_fn(
out,
tservice,
Expand Down

0 comments on commit cdc5ba0

Please sign in to comment.