Skip to content

Commit 58792dc

Browse files
Satish Kumarfacebook-github-bot
authored andcommitted
Delete arrays as a compiler option.
Summary: #What? Delete `arrays` as a compiler option. #Why? `arrays` are now the default in the absence of `legacy_arrays` and `hack_collections`, and cease to exist as an explicit option. # Fixtures - Delete `arrays` from `cmd` files. - 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` are now the default in the absence of `legacy_arrays` and `hack_collections`, 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: rmakheja Differential Revision: D67618067 fbshipit-source-id: d6c20bd9343f868b1492497f8e41b72ec91c45a6
1 parent 72b236c commit 58792dc

File tree

6 files changed

+8
-16
lines changed
  • third-party/thrift/src/thrift/compiler

6 files changed

+8
-16
lines changed

third-party/thrift/src/thrift/compiler/generate/t_hack_generator.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class t_hack_generator : public t_concat_generator {
124124
shapes_allow_unknown_fields_ =
125125
option_is_specified(options, "shapes_allow_unknown_fields");
126126
array_migration_ = option_is_specified(options, "array_migration");
127-
arrays_ = option_is_specified(options, "arrays");
128127
legacy_arrays_ = option_is_specified(options, "legacy_arrays");
129128
hack_collections_ = option_is_specified(options, "hack_collections");
130129

@@ -1185,11 +1184,6 @@ class t_hack_generator : public t_concat_generator {
11851184
*/
11861185
bool array_migration_;
11871186

1188-
/**
1189-
* True to use Hack arrays instead of collections
1190-
*/
1191-
bool arrays_;
1192-
11931187
/**
11941188
* True to never use hack collection objects. Only used for migrations
11951189
*/
@@ -7632,8 +7626,6 @@ THRIFT_REGISTER_GENERATOR(
76327626
" shapes_allow_unknown_fields Allow unknown fields and implicit "
76337627
"subtyping for shapes \n"
76347628
" frommap_construct Generate fromMap_DEPRECATED method.\n"
7635-
" arrays Use Hack arrays for maps/lists/sets instead of "
7636-
"objects.\n"
76377629
" hack_collections Generate hack collections instead of hack arrays.\n"
76387630
" const_collections Use ConstCollection objects rather than their "
76397631
"mutable counterparts.\n"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hack: hack:arrays=1,shapes=1,shape_arraykeys=1 src/module.thrift
1+
hack: hack:shapes=1,shape_arraykeys=1 src/module.thrift
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hack: hack:arrays=1 src/module.thrift
1+
hack: hack src/module.thrift
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hack: hack:json,arrays,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/module.thrift
2-
hack_include: hack:json,arrays,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/include.thrift
3-
hack_annotations: hack:json,arrays,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/annotations.thrift
4-
hack_constants: hack:json,arrays,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/constants.thrift
1+
hack: hack:json,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/module.thrift
2+
hack_include: hack:json,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/include.thrift
3+
hack_annotations: hack:json,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/annotations.thrift
4+
hack_constants: hack:json,shapes,shape_arraykeys,frommap_construct,typedef,server,shapes_use_pipe_structure src/constants.thrift
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
hack: hack:lazy_constants=1,arrays=1 src/module.thrift
1+
hack: hack:lazy_constants=1 src/module.thrift
22
java: mstch_java src/module.thrift
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hack: hack:shapes=1,shapes_allow_unknown_fields=1,arrays=1,shapes_use_pipe_structure=1 src/module.thrift
1+
hack: hack:shapes=1,shapes_allow_unknown_fields=1,shapes_use_pipe_structure=1 src/module.thrift

0 commit comments

Comments
 (0)