Skip to content

Commit dea78b6

Browse files
aristidispmeta-codesync[bot]
authored andcommitted
Annotate uses of non-sealed key types: fbcode/common/hs/
Reviewed By: vitaut Differential Revision: D96427309 fbshipit-source-id: ec8f2dcfa37977a257a2a903f14f85fe33df17f6
1 parent 8dc7352 commit dea78b6

12 files changed

Lines changed: 39 additions & 1 deletion

File tree

exactprint/tests/fbthrift-tests/complex-struct/src/module.thrift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ struct MyStruct {
7777
21: map<i32, i32> mIntegerInteger;
7878
22: map<i32, bool> mIntegerBool;
7979
23: set<i16> sShort;
80+
@thrift.AllowUnsafeNonSealedKeyType
8081
24: set<MyStruct> sMyStruct;
8182
25: set<i64> sLong;
8283
26: set<string> sString;
@@ -169,6 +170,7 @@ struct ComplexNestedStruct {
169170
4: set<list<list<i64>>> setOfListOfListOfLong;
170171
5: set<set<set<i64>>> setOfSetOfsetOfLong;
171172
6: map<i32, list<list<MyStruct>>> mapStructListOfListOfLong;
173+
@thrift.AllowUnsafeNonSealedKeyType
172174
7: map<MyStruct, i32> mKeyStructValInt;
173175
8: list<map<i32, i32>> listOfMapKeyIntValInt;
174176
9: list<map<string, list<MyStruct>>> listOfMapKeyStrValList;
@@ -228,11 +230,15 @@ struct Containers {
228230
2: list<MyUnion> union_list;
229231
3: list<MyEnum> enum_list;
230232

233+
@thrift.AllowUnsafeNonSealedKeyType
231234
4: set<MyStruct> struct_set;
235+
@thrift.AllowUnsafeNonSealedKeyType
232236
5: set<MyUnion> union_set;
233237
6: set<MyEnum> enum_set;
234238

239+
@thrift.AllowUnsafeNonSealedKeyType
235240
7: map<MyStruct, i64> struct_map;
241+
@thrift.AllowUnsafeNonSealedKeyType
236242
8: map<MyUnion, i64> union_map;
237243
9: map<MyEnum, i64> enum_map;
238244

@@ -258,11 +264,15 @@ struct Containers {
258264
25: list<map<MyStruct, i32>> list_map_struct_i32;
259265

260266
26: set<list<i32>> set_list_i32;
267+
@thrift.AllowUnsafeNonSealedKeyType
261268
27: set<list<MyStruct>> set_list_struct;
262269
28: set<set<i32>> set_set_i32;
270+
@thrift.AllowUnsafeNonSealedKeyType
263271
29: set<set<MyStruct>> set_set_struct;
264272
30: set<map<i32, i32>> set_map_i32_i32;
273+
@thrift.AllowUnsafeNonSealedKeyType
265274
31: set<map<i32, MyStruct>> set_map_i32_struct;
275+
@thrift.AllowUnsafeNonSealedKeyType
266276
32: set<map<MyStruct, i32>> set_map_struct_i32;
267277

268278
33: map<i32, map<i32, i32>> map_i32_map_i32_i32;

exactprint/tests/fbthrift-tests/complex-union/src/invariant.thrift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ struct UnionForInvariantTypes {
3535
}
3636

3737
union InvariantTypes {
38+
@thrift.AllowUnsafeNonSealedKeyType
3839
1: map<StructForInvariantTypes, i64> struct_map;
40+
@thrift.AllowUnsafeNonSealedKeyType
3941
2: map<UnionForInvariantTypes, i64> union_map;
4042
}

exactprint/tests/fbthrift-tests/cpp2-struct-footprint/src/module.thrift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ typedef i32 MyInt
5959
typedef SimpleStruct MyStruct
6060
typedef list<SimpleStruct> StructList
6161
typedef map<string, SimpleStruct> StructMap
62+
@thrift.AllowUnsafeNonSealedKeyType
6263
typedef set<SimpleStruct> StructSet
6364

6465
// Interaction for testing interaction constructors

exactprint/tests/fbthrift-tests/encode/src/module.thrift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ struct OpEncodeStruct {
5757
@cpp.Ref{type = cpp.RefType.Shared}
5858
6: optional list<AdaptedFoo> list_shared_ptr_field;
5959
7: list<AdaptedFoo> list_cpp_type_field;
60+
@thrift.AllowUnsafeNonSealedKeyType
6061
8: set<AdaptedFoo> set_field;
62+
@thrift.AllowUnsafeNonSealedKeyType
6163
9: map<AdaptedFoo, AdaptedFoo> map_field;
6264
10: map<i32, list<AdaptedFoo>> nested_field;
6365
11: Bar bar_field;

exactprint/tests/fbthrift-tests/fatal/src/module.thrift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ struct structC {
128128
14: set<i32> k;
129129
15: set<i32> k1;
130130
16: set<enum2> k2;
131+
@thrift.AllowUnsafeNonSealedKeyType
131132
17: set<structB> k3;
132133
18: map<i32, i32> l;
133134
19: map<i32, i32> l1;
@@ -139,8 +140,11 @@ struct structC {
139140
25: map<string, i32> n1;
140141
26: map<string, enum1> n2;
141142
27: map<string, structB> n3;
143+
@thrift.AllowUnsafeNonSealedKeyType
142144
28: map<structA, i32> o1;
145+
@thrift.AllowUnsafeNonSealedKeyType
143146
29: map<structA, enum1> o2;
147+
@thrift.AllowUnsafeNonSealedKeyType
144148
30: map<structA, structB> o3;
145149
}
146150

@@ -181,6 +185,7 @@ struct struct3 {
181185
13: set<i32> fieldM;
182186
14: set<string> fieldN;
183187
15: set<string> fieldO;
188+
@thrift.AllowUnsafeNonSealedKeyType
184189
16: set<structB> fieldP;
185190
17: map<string, structA> fieldQ;
186191
18: map<string, structB> fieldR;

exactprint/tests/fbthrift-tests/go-service/src/module.thrift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct GetEntityResponse {
3434
struct NonComparableStruct {
3535
1: string foo;
3636
2: list<string> bar;
37+
@thrift.AllowUnsafeNonSealedKeyType
3738
3: map<NonComparableStruct, i64> baz;
3839
}
3940

exactprint/tests/fbthrift-tests/go-typedef/src/module1.thrift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct MapKey {
5353
}
5454

5555
struct MapContainer {
56+
@thrift.AllowUnsafeNonSealedKeyType
5657
1: map<MapKey, string> mapval;
5758
}
5859

exactprint/tests/fbthrift-tests/hack_field_wrapper_with_arrays/src/include.thrift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct MyNestedStruct {
5858
5: optional i64WithAdapter optional_adapted_and_wrapped_type;
5959
@hack.FieldWrapper{name = "\\MyFieldWrapper"}
6060
@hack.SkipCodegen{reason = "invalid map key"}
61+
@thrift.AllowUnsafeNonSealedKeyType
6162
6: optional map<MyStruct, string> invalid_key_map;
6263
@hack.FieldWrapper{name = "\\MyFieldWrapper"}
6364
7: i64WithWrapper wrapped_type_int;

exactprint/tests/fbthrift-tests/mcpp2-compare/src/module.thrift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ union SimpleUnion {
129129
typedef i32 simpleTypeDef
130130
typedef map<i16, string> containerTypeDef
131131
typedef list<map<i16, string>> complexContainerTypeDef
132+
@thrift.AllowUnsafeNonSealedKeyType
132133
typedef set<SimpleUnion> unionTypeDef
133134
typedef list<MyStruct> structTypeDef
134135
typedef list<map<Empty, MyStruct>> complexStructTypeDef
@@ -150,6 +151,7 @@ union ComplexUnion {
150151
12: MyEnumA enum_field;
151152
13: list<MyEnumA> enum_container;
152153
14: MyStruct a_struct;
154+
@thrift.AllowUnsafeNonSealedKeyType
153155
15: set<MyStruct> a_set_struct;
154156
16: SimpleUnion a_union;
155157
216: SimpleUnion opt_a_union;
@@ -182,6 +184,7 @@ exception AnException {
182184
6: MyEnumA enum_field;
183185
7: list<MyEnumA> enum_container;
184186
8: MyStruct a_struct;
187+
@thrift.AllowUnsafeNonSealedKeyType
185188
9: set<MyStruct> a_set_struct;
186189
10: list<SimpleUnion> a_union_list;
187190
11: unionTypeDef union_typedef;
@@ -239,6 +242,7 @@ struct ContainerStruct {
239242
23: MyStruct fieldV;
240243
123: required MyStruct req_fieldV;
241244
223: optional MyStruct opt_fieldV;
245+
@thrift.AllowUnsafeNonSealedKeyType
242246
24: set<MyStruct> fieldW;
243247
25: ComplexUnion fieldX;
244248
125: required ComplexUnion req_fieldX;
@@ -433,6 +437,7 @@ service ParamService {
433437
i64 i64_ret_float_double_param(1: float param1, 3: double param2);
434438
i64 i64_ret_string_typedef_param(
435439
1: string param1,
440+
@thrift.AllowUnsafeNonSealedKeyType
436441
3: set<mostComplexTypeDef> param2,
437442
);
438443
@cpp.ProcessInEbThreadUnsafe
@@ -443,7 +448,10 @@ service ParamService {
443448
4: i32 param4,
444449
5: i32 param5,
445450
);
446-
double double_ret_setstruct_param(4: set<MyStruct> param1);
451+
double double_ret_setstruct_param(
452+
@thrift.AllowUnsafeNonSealedKeyType
453+
4: set<MyStruct> param1,
454+
);
447455
string string_ret_string_param(1: string param1);
448456
binary binary_ret_binary_param(1: binary param1);
449457
map<string, i64> map_ret_bool_param(1: bool param1);

exactprint/tests/fbthrift-tests/py-hidden/src/module.thrift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct S1 {
3232
1: i32 normalField;
3333

3434
@python.PyDeprecatedHidden{reason = "Structured keys not supported"}
35+
@thrift.AllowUnsafeNonSealedKeyType
3536
2: map<StructuredKey, StructuredKey> mapField;
3637
}
3738

0 commit comments

Comments
 (0)