diff --git a/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_metadata.cpp b/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_metadata.cpp index 5bb959025ca..15b65a1831d 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_metadata.cpp +++ b/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_metadata.cpp @@ -88,14 +88,14 @@ StructMetadata<::facebook::thrift::test::Foo>::gen(ThriftMetadata& metadata) { module_Foo.is_union() = false; static const auto* const module_Foo_fields = new std::array{{ - {1, "intField", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, - {2, "optionalIntField", true, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, - {3, "intFieldWithDefault", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {1, "intField", false, std::make_unique("module.i32_5137", std::make_unique("module.i32_5137", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {2, "optionalIntField", true, std::make_unique("module.i32_5137", std::make_unique("module.i32_5137", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {3, "intFieldWithDefault", false, std::make_unique("module.i32_5137", std::make_unique("module.i32_5137", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, {4, "setField", false, std::make_unique("module.SetWithAdapter", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}}, {5, "optionalSetField", true, std::make_unique("module.SetWithAdapter", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}}, - {6, "mapField", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter", std::make_unique(std::make_unique("module.StringWithAdapter", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), })), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}), std::vector{}), std::vector{})), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter3")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, - {7, "optionalMapField", true, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter", std::make_unique(std::make_unique("module.StringWithAdapter", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), })), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}), std::vector{}), std::vector{})), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter3")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, - {8, "binaryField", false, std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, + {6, "mapField", false, std::make_unique("module.map_string_ListWithElemAdapter_withAdapter_8454", std::make_unique("module.map_string_ListWithElemAdapter_withAdapter_8454", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter", std::make_unique(std::make_unique("module.StringWithAdapter", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), })), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}), std::vector{})), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter3")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, + {7, "optionalMapField", true, std::make_unique("module.map_string_ListWithElemAdapter_withAdapter_8454", std::make_unique("module.map_string_ListWithElemAdapter_withAdapter_8454", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter", std::make_unique(std::make_unique("module.StringWithAdapter", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), })), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}), std::vector{})), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter3")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, + {8, "binaryField", false, std::make_unique("module.binary_5673", std::make_unique("module.binary_5673", std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, {9, "longField", false, std::make_unique("module.MyI64", std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{*cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("module.MyAnnotation", {{"signature", cvString("MyI64")}, {"color", cvInteger(2)}}).cv_struct_ref(), }), std::vector{}}, {10, "adaptedLongField", false, std::make_unique("module.MyI64", std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{*cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("module.MyAnnotation", {{"signature", cvString("MyI64")}, {"color", cvInteger(2)}}).cv_struct_ref(), }), std::vector{*cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("python.Adapter", {{"name", cvString("my.Adapter3")}, {"typeHint", cvString("my.AdaptedType3[]")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }}, {11, "doubleAdaptedField", false, std::make_unique("module.DoubleTypedefI64", std::make_unique("module.MyI64", std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{*cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("module.MyAnnotation", {{"signature", cvString("MyI64")}, {"color", cvInteger(2)}}).cv_struct_ref(), }), std::vector{}), std::vector{}}, @@ -122,10 +122,10 @@ StructMetadata<::facebook::thrift::test::Baz>::gen(ThriftMetadata& metadata) { module_Baz.is_union() = true; static const auto* const module_Baz_fields = new std::array{{ - {1, "intField", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {1, "intField", false, std::make_unique("module.i32_5137", std::make_unique("module.i32_5137", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, {4, "setField", false, std::make_unique("module.SetWithAdapter", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}}, - {6, "mapField", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter", std::make_unique(std::make_unique("module.StringWithAdapter", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), })), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}), std::vector{}), std::vector{})), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter3")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, - {8, "binaryField", false, std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {6, "mapField", false, std::make_unique("module.map_string_ListWithElemAdapter_withAdapter_8454", std::make_unique("module.map_string_ListWithElemAdapter_withAdapter_8454", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique("module.ListWithElemAdapter_withAdapter_2312", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter_withAdapter", std::make_unique("module.ListWithElemAdapter", std::make_unique(std::make_unique("module.StringWithAdapter", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), })), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter2")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter2")}}).cv_struct_ref(), }), std::vector{}), std::vector{})), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter3")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter3")}}).cv_struct_ref(), }}, + {8, "binaryField", false, std::make_unique("module.binary_5673", std::make_unique("module.binary_5673", std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, {9, "longField", false, std::make_unique("module.MyI64", std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{*cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("module.MyAnnotation", {{"signature", cvString("MyI64")}, {"color", cvInteger(2)}}).cv_struct_ref(), }), std::vector{}}, }}; for (const auto& f : *module_Baz_fields) { @@ -150,12 +150,12 @@ StructMetadata<::facebook::thrift::test::Bar>::gen(ThriftMetadata& metadata) { module_Bar.is_union() = false; static const auto* const module_Bar_fields = new std::array{{ - {1, "structField", false, std::make_unique("module.Foo", std::make_unique>("module.Foo"), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}, {"adaptedType", cvString("::my::Cpp::Type1")}}).cv_struct_ref(), }}, - {2, "optionalStructField", true, std::make_unique("module.Foo", std::make_unique>("module.Foo"), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {1, "structField", false, std::make_unique("module.Foo_6868", std::make_unique("module.Foo_6868", std::make_unique("module.Foo", std::make_unique>("module.Foo"), std::vector{}), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}, {"adaptedType", cvString("::my::Cpp::Type1")}}).cv_struct_ref(), }}, + {2, "optionalStructField", true, std::make_unique("module.Foo_3943", std::make_unique("module.Foo_3943", std::make_unique("module.Foo", std::make_unique>("module.Foo"), std::vector{}), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, {3, "structListField", false, std::make_unique(std::make_unique("module.FooWithAdapter_9317", std::make_unique("module.FooWithAdapter_9317", std::make_unique("module.FooWithAdapter", std::make_unique("module.FooWithAdapter", std::make_unique>("module.Foo"), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }), std::vector{}), std::vector{}), std::vector{})), std::vector{}}, {4, "optionalStructListField", true, std::make_unique(std::make_unique("module.FooWithAdapter_9317", std::make_unique("module.FooWithAdapter_9317", std::make_unique("module.FooWithAdapter", std::make_unique("module.FooWithAdapter", std::make_unique>("module.Foo"), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), *cvStruct("rust.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }), std::vector{}), std::vector{}), std::vector{})), std::vector{}}, - {5, "unionField", false, std::make_unique("module.Baz", std::make_unique>("module.Baz"), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, - {6, "optionalUnionField", true, std::make_unique("module.Baz", std::make_unique>("module.Baz"), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {5, "unionField", false, std::make_unique("module.Baz_7352", std::make_unique("module.Baz_7352", std::make_unique("module.Baz", std::make_unique>("module.Baz"), std::vector{}), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, + {6, "optionalUnionField", true, std::make_unique("module.Baz_7352", std::make_unique("module.Baz_7352", std::make_unique("module.Baz", std::make_unique>("module.Baz"), std::vector{}), std::vector{}), std::vector{}), std::vector{*cvStruct("hack.Adapter", {{"name", cvString("\\Adapter1")}}).cv_struct_ref(), *cvStruct("cpp.Adapter", {{"name", cvString("::my::Adapter1")}}).cv_struct_ref(), }}, {7, "adaptedStructField", false, std::make_unique("module.DirectlyAdapted", std::make_unique>("module.DirectlyAdapted"), std::vector{}), std::vector{}}, }}; for (const auto& f : *module_Bar_fields) { diff --git a/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.cpp index 827ba6e0bee..bc04ffb9e71 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.cpp @@ -228,7 +228,7 @@ Foo& Foo::operator=(const Foo& other) { Foo::Foo() : __fbthrift_field_intField(), __fbthrift_field_optionalIntField(), - __fbthrift_field_intFieldWithDefault(::apache::thrift::adapt_detail::fromThriftField<::my::Adapter1, 3>(::std::int32_t(static_cast<::std::int32_t>(13)), *this)), + __fbthrift_field_intFieldWithDefault(::apache::thrift::adapt_detail::fromThriftField<::my::Adapter1, 3>(::facebook::thrift::test::i32_5137(static_cast<::facebook::thrift::test::i32_5137>(13)), *this)), __fbthrift_field_longField(), __fbthrift_field_adaptedLongField(), __fbthrift_field_doubleAdaptedField() { @@ -291,7 +291,7 @@ Foo& Foo::operator=(FOLLY_MAYBE_UNUSED Foo&& other) noexcept { } -Foo::Foo(apache::thrift::FragileConstructor, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Foo> intField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::std::int32_t, Foo> optionalIntField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 3, ::std::int32_t, Foo> intFieldWithDefault__arg, ::facebook::thrift::test::SetWithAdapter setField__arg, ::facebook::thrift::test::SetWithAdapter optionalSetField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Foo> mapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 7, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Foo> optionalMapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 8, ::std::string, Foo> binaryField__arg, ::facebook::thrift::test::MyI64 longField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter2, 10, ::facebook::thrift::test::MyI64, Foo> adaptedLongField__arg, ::facebook::thrift::test::DoubleTypedefI64 doubleAdaptedField__arg) : +Foo::Foo(apache::thrift::FragileConstructor, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Foo> intField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::i32_5137, Foo> optionalIntField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 3, ::facebook::thrift::test::i32_5137, Foo> intFieldWithDefault__arg, ::facebook::thrift::test::SetWithAdapter setField__arg, ::facebook::thrift::test::SetWithAdapter optionalSetField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Foo> mapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 7, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Foo> optionalMapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 8, ::facebook::thrift::test::binary_5673, Foo> binaryField__arg, ::facebook::thrift::test::MyI64 longField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter2, 10, ::facebook::thrift::test::MyI64, Foo> adaptedLongField__arg, ::facebook::thrift::test::DoubleTypedefI64 doubleAdaptedField__arg) : __fbthrift_field_intField(std::move(intField__arg)), __fbthrift_field_optionalIntField(std::move(optionalIntField__arg)), __fbthrift_field_intFieldWithDefault(std::move(intFieldWithDefault__arg)), @@ -592,7 +592,7 @@ Bar& Bar::operator=(FOLLY_MAYBE_UNUSED Bar&& other) noexcept { } -Bar::Bar(apache::thrift::FragileConstructor, ::my::Cpp::Type1 structField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::Foo, Bar> optionalStructField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> structListField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> optionalStructListField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 5, ::facebook::thrift::test::Baz, Bar> unionField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 6, ::facebook::thrift::test::Baz, Bar> optionalUnionField__arg, ::facebook::thrift::test::DirectlyAdapted adaptedStructField__arg) : +Bar::Bar(apache::thrift::FragileConstructor, ::my::Cpp::Type1 structField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::Foo_3943, Bar> optionalStructField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> structListField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> optionalStructListField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 5, ::facebook::thrift::test::Baz_7352, Bar> unionField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 6, ::facebook::thrift::test::Baz_7352, Bar> optionalUnionField__arg, ::facebook::thrift::test::DirectlyAdapted adaptedStructField__arg) : __fbthrift_field_structField(std::move(structField__arg)), __fbthrift_field_optionalStructField(std::move(optionalStructField__arg)), __fbthrift_field_structListField(std::move(structListField__arg)), @@ -684,25 +684,25 @@ static_assert( ::apache::thrift::detail::st::gen_check_json< Bar, ::apache::thrift::type_class::structure, - ::facebook::thrift::test::Foo>, + ::facebook::thrift::test::Foo_6868>, "inconsistent use of json option"); static_assert( ::apache::thrift::detail::st::gen_check_json< Bar, ::apache::thrift::type_class::structure, - ::facebook::thrift::test::Foo>, + ::facebook::thrift::test::Foo_3943>, "inconsistent use of json option"); static_assert( ::apache::thrift::detail::st::gen_check_json< Bar, ::apache::thrift::type_class::variant, - ::facebook::thrift::test::Baz>, + ::facebook::thrift::test::Baz_7352>, "inconsistent use of json option"); static_assert( ::apache::thrift::detail::st::gen_check_json< Bar, ::apache::thrift::type_class::variant, - ::facebook::thrift::test::Baz>, + ::facebook::thrift::test::Baz_7352>, "inconsistent use of json option"); static_assert( ::apache::thrift::detail::st::gen_check_json< @@ -4027,26 +4027,26 @@ template uint32_t Person2::serializedSizeZC<>(apache::thrift::CompactProtocolWri namespace facebook { namespace thrift { namespace test { namespace { FOLLY_MAYBE_UNUSED FOLLY_ERASE void validateAdapters() { - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 1, ::std::int32_t, ::facebook::thrift::test::Foo>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 2, ::std::int32_t, ::facebook::thrift::test::Foo>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 3, ::std::int32_t, ::facebook::thrift::test::Foo>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, ::facebook::thrift::test::Foo>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 2, ::facebook::thrift::test::i32_5137, ::facebook::thrift::test::Foo>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 3, ::facebook::thrift::test::i32_5137, ::facebook::thrift::test::Foo>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter2, 4, ::std::set<::std::string>, ::facebook::thrift::test::Foo>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter2, 5, ::std::set<::std::string>, ::facebook::thrift::test::Foo>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter>, ::facebook::thrift::test::Foo>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 7, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter>, ::facebook::thrift::test::Foo>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 8, ::std::string, ::facebook::thrift::test::Foo>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, ::facebook::thrift::test::Foo>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 7, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, ::facebook::thrift::test::Foo>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 8, ::facebook::thrift::test::binary_5673, ::facebook::thrift::test::Foo>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 9, ::std::int64_t, ::facebook::thrift::test::Foo>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter2, 10, ::std::int64_t, ::facebook::thrift::test::Foo>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 11, ::std::int64_t, ::facebook::thrift::test::Foo>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 1, ::std::int32_t, ::facebook::thrift::test::Baz>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, ::facebook::thrift::test::Baz>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter2, 4, ::std::set<::std::string>, ::facebook::thrift::test::Baz>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter>, ::facebook::thrift::test::Baz>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 8, ::std::string, ::facebook::thrift::test::Baz>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, ::facebook::thrift::test::Baz>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, ::facebook::thrift::test::Baz>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 9, ::std::int64_t, ::facebook::thrift::test::Baz>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 1, ::facebook::thrift::test::Foo, ::facebook::thrift::test::Bar>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 2, ::facebook::thrift::test::Foo, ::facebook::thrift::test::Bar>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 5, ::facebook::thrift::test::Baz, ::facebook::thrift::test::Bar>(); - ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 6, ::facebook::thrift::test::Baz, ::facebook::thrift::test::Bar>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 1, ::facebook::thrift::test::Foo_6868, ::facebook::thrift::test::Bar>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 2, ::facebook::thrift::test::Foo_3943, ::facebook::thrift::test::Bar>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 5, ::facebook::thrift::test::Baz_7352, ::facebook::thrift::test::Bar>(); + ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 6, ::facebook::thrift::test::Baz_7352, ::facebook::thrift::test::Bar>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter, 7, ::facebook::thrift::test::detail::DirectlyAdapted, ::facebook::thrift::test::Bar>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 1, ::std::int32_t, ::facebook::thrift::test::StructWithFieldAdapter>(); ::apache::thrift::adapt_detail::validateFieldAdapter<::my::Adapter1, 2, ::std::int32_t, ::facebook::thrift::test::StructWithFieldAdapter>(); diff --git a/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.h index 0f3987e4ac4..8c7b51bae37 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_types.h @@ -633,6 +633,9 @@ typedef ::apache::thrift::adapt_detail::adapted_t<::my::Adapter1, ::std::int64_t typedef ::facebook::thrift::test::MyI64 DoubleTypedefI64; typedef ::apache::thrift::adapt_detail::adapted_t<::my::Adapter1, ::std::int32_t> MyI32; typedef ::facebook::thrift::test::ListWithElemAdapter_withAdapter ListWithElemAdapter_withAdapter_2312; +typedef ::std::string binary_5673; +typedef ::std::int32_t i32_5137; +typedef ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312> map_string_ListWithElemAdapter_withAdapter_8454; class Foo final { private: @@ -707,7 +710,7 @@ class Foo final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - Foo(apache::thrift::FragileConstructor, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Foo> intField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::std::int32_t, Foo> optionalIntField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 3, ::std::int32_t, Foo> intFieldWithDefault__arg, ::facebook::thrift::test::SetWithAdapter setField__arg, ::facebook::thrift::test::SetWithAdapter optionalSetField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Foo> mapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 7, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Foo> optionalMapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 8, ::std::string, Foo> binaryField__arg, ::facebook::thrift::test::MyI64 longField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter2, 10, ::facebook::thrift::test::MyI64, Foo> adaptedLongField__arg, ::facebook::thrift::test::DoubleTypedefI64 doubleAdaptedField__arg); + Foo(apache::thrift::FragileConstructor, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Foo> intField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::i32_5137, Foo> optionalIntField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 3, ::facebook::thrift::test::i32_5137, Foo> intFieldWithDefault__arg, ::facebook::thrift::test::SetWithAdapter setField__arg, ::facebook::thrift::test::SetWithAdapter optionalSetField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Foo> mapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 7, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Foo> optionalMapField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 8, ::facebook::thrift::test::binary_5673, Foo> binaryField__arg, ::facebook::thrift::test::MyI64 longField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter2, 10, ::facebook::thrift::test::MyI64, Foo> adaptedLongField__arg, ::facebook::thrift::test::DoubleTypedefI64 doubleAdaptedField__arg); Foo(Foo&&) noexcept; Foo(const Foo& src); @@ -719,21 +722,21 @@ class Foo final { ~Foo(); private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Foo> __fbthrift_field_intField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Foo> __fbthrift_field_intField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::std::int32_t, Foo> __fbthrift_field_optionalIntField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::i32_5137, Foo> __fbthrift_field_optionalIntField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 3, ::std::int32_t, Foo> __fbthrift_field_intFieldWithDefault; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 3, ::facebook::thrift::test::i32_5137, Foo> __fbthrift_field_intFieldWithDefault; private: ::facebook::thrift::test::SetWithAdapter __fbthrift_field_setField; private: ::facebook::thrift::test::SetWithAdapter __fbthrift_field_optionalSetField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Foo> __fbthrift_field_mapField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Foo> __fbthrift_field_mapField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 7, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Foo> __fbthrift_field_optionalMapField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 7, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Foo> __fbthrift_field_optionalMapField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 8, ::std::string, Foo> __fbthrift_field_binaryField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 8, ::facebook::thrift::test::binary_5673, Foo> __fbthrift_field_binaryField; private: ::facebook::thrift::test::MyI64 __fbthrift_field_longField; private: @@ -748,122 +751,122 @@ class Foo final { bool operator==(const Foo&) const; bool operator<(const Foo&) const; - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField_ref() const& { return {this->__fbthrift_field_intField, __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField_ref() const&& { return {static_cast(this->__fbthrift_field_intField), __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField_ref() & { return {this->__fbthrift_field_intField, __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField_ref() && { return {static_cast(this->__fbthrift_field_intField), __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField() const& { return {this->__fbthrift_field_intField, __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField() const&& { return {static_cast(this->__fbthrift_field_intField), __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField() & { return {this->__fbthrift_field_intField, __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intField() && { return {static_cast(this->__fbthrift_field_intField), __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField_ref() const& { return {this->__fbthrift_field_optionalIntField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField_ref() const&& { return {static_cast(this->__fbthrift_field_optionalIntField), __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField_ref() & { return {this->__fbthrift_field_optionalIntField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField_ref() && { return {static_cast(this->__fbthrift_field_optionalIntField), __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField() const& { return {this->__fbthrift_field_optionalIntField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField() const&& { return {static_cast(this->__fbthrift_field_optionalIntField), __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField() & { return {this->__fbthrift_field_optionalIntField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalIntField() && { return {static_cast(this->__fbthrift_field_optionalIntField), __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault_ref() const& { return {this->__fbthrift_field_intFieldWithDefault, __isset.at(2), __isset.bit(2)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault_ref() const&& { return {static_cast(this->__fbthrift_field_intFieldWithDefault), __isset.at(2), __isset.bit(2)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault_ref() & { return {this->__fbthrift_field_intFieldWithDefault, __isset.at(2), __isset.bit(2)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault_ref() && { return {static_cast(this->__fbthrift_field_intFieldWithDefault), __isset.at(2), __isset.bit(2)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault() const& { return {this->__fbthrift_field_intFieldWithDefault, __isset.at(2), __isset.bit(2)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault() const&& { return {static_cast(this->__fbthrift_field_intFieldWithDefault), __isset.at(2), __isset.bit(2)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault() & { return {this->__fbthrift_field_intFieldWithDefault, __isset.at(2), __isset.bit(2)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref intFieldWithDefault() && { return {static_cast(this->__fbthrift_field_intFieldWithDefault), __isset.at(2), __isset.bit(2)}; } @@ -948,122 +951,122 @@ class Foo final { return {static_cast(this->__fbthrift_field_optionalSetField), __isset.at(4), __isset.bit(4)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField_ref() const& { return {this->__fbthrift_field_mapField, __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField_ref() const&& { return {static_cast(this->__fbthrift_field_mapField), __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField_ref() & { return {this->__fbthrift_field_mapField, __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField_ref() && { return {static_cast(this->__fbthrift_field_mapField), __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField() const& { return {this->__fbthrift_field_mapField, __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField() const&& { return {static_cast(this->__fbthrift_field_mapField), __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField() & { return {this->__fbthrift_field_mapField, __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::field_ref mapField() && { return {static_cast(this->__fbthrift_field_mapField), __isset.at(5), __isset.bit(5)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField_ref() const& { return {this->__fbthrift_field_optionalMapField, __isset.at(6), __isset.bit(6)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField_ref() const&& { return {static_cast(this->__fbthrift_field_optionalMapField), __isset.at(6), __isset.bit(6)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField_ref() & { return {this->__fbthrift_field_optionalMapField, __isset.at(6), __isset.bit(6)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField_ref() && { return {static_cast(this->__fbthrift_field_optionalMapField), __isset.at(6), __isset.bit(6)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField() const& { return {this->__fbthrift_field_optionalMapField, __isset.at(6), __isset.bit(6)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField() const&& { return {static_cast(this->__fbthrift_field_optionalMapField), __isset.at(6), __isset.bit(6)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField() & { return {this->__fbthrift_field_optionalMapField, __isset.at(6), __isset.bit(6)}; } - template , Foo>> + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalMapField() && { return {static_cast(this->__fbthrift_field_optionalMapField), __isset.at(6), __isset.bit(6)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField_ref() const& { return {this->__fbthrift_field_binaryField, __isset.at(7), __isset.bit(7)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField_ref() const&& { return {static_cast(this->__fbthrift_field_binaryField), __isset.at(7), __isset.bit(7)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField_ref() & { return {this->__fbthrift_field_binaryField, __isset.at(7), __isset.bit(7)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField_ref() && { return {static_cast(this->__fbthrift_field_binaryField), __isset.at(7), __isset.bit(7)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField() const& { return {this->__fbthrift_field_binaryField, __isset.at(7), __isset.bit(7)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField() const&& { return {static_cast(this->__fbthrift_field_binaryField), __isset.at(7), __isset.bit(7)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField() & { return {this->__fbthrift_field_binaryField, __isset.at(7), __isset.bit(7)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref binaryField() && { return {static_cast(this->__fbthrift_field_binaryField), __isset.at(7), __isset.bit(7)}; } @@ -1454,10 +1457,10 @@ class Baz final { } union storage_type { - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz> intField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz> intField; ::facebook::thrift::test::SetWithAdapter setField; - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz> mapField; - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz> binaryField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz> mapField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz> binaryField; ::facebook::thrift::test::MyI64 longField; storage_type() {} @@ -1468,8 +1471,8 @@ class Baz final { bool operator<(const Baz&) const; template = 0> - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz>& set_intField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz> t = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz>()) { - using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz>; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz>& set_intField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz> t = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz>()) { + using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz>; using T = folly::type_t; __fbthrift_clear(); type_ = folly::to_underlying(Type::intField); @@ -1505,8 +1508,8 @@ class Baz final { } template = 0> - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>& set_mapField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz> const &t) { - using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>& set_mapField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz> const &t) { + using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>; using T = folly::type_t; __fbthrift_clear(); type_ = folly::to_underlying(Type::mapField); @@ -1515,8 +1518,8 @@ class Baz final { } template = 0> - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>& set_mapField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>&& t) { - using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>& set_mapField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>&& t) { + using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>; using T = folly::type_t; __fbthrift_clear(); type_ = folly::to_underlying(Type::mapField); @@ -1524,16 +1527,16 @@ class Baz final { return value_.mapField; } - template, Baz>, T...>> ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>& set_mapField(T&&... t) { + template, T...>> ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>& set_mapField(T&&... t) { __fbthrift_clear(); type_ = folly::to_underlying(Type::mapField); - ::new (std::addressof(value_.mapField)) ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>(std::forward(t)...); + ::new (std::addressof(value_.mapField)) ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>(std::forward(t)...); return value_.mapField; } template = 0> - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>& set_binaryField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz> const &t) { - using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>& set_binaryField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz> const &t) { + using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>; using T = folly::type_t; __fbthrift_clear(); type_ = folly::to_underlying(Type::binaryField); @@ -1542,8 +1545,8 @@ class Baz final { } template = 0> - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>& set_binaryField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>&& t) { - using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>& set_binaryField(::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>&& t) { + using T0 = ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>; using T = folly::type_t; __fbthrift_clear(); type_ = folly::to_underlying(Type::binaryField); @@ -1551,10 +1554,10 @@ class Baz final { return value_.binaryField; } - template, T...>> ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>& set_binaryField(T&&... t) { + template, T...>> ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>& set_binaryField(T&&... t) { __fbthrift_clear(); type_ = folly::to_underlying(Type::binaryField); - ::new (std::addressof(value_.binaryField)) ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>(std::forward(t)...); + ::new (std::addressof(value_.binaryField)) ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>(std::forward(t)...); return value_.binaryField; } @@ -1568,7 +1571,7 @@ class Baz final { return value_.longField; } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz> const& get_intField() const { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz> const& get_intField() const { if (getType() != Type::intField) { ::apache::thrift::detail::throw_on_bad_union_field_access(); } @@ -1582,14 +1585,14 @@ class Baz final { return value_.setField; } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz> const& get_mapField() const { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz> const& get_mapField() const { if (getType() != Type::mapField) { ::apache::thrift::detail::throw_on_bad_union_field_access(); } return value_.mapField; } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz> const& get_binaryField() const { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz> const& get_binaryField() const { if (getType() != Type::binaryField) { ::apache::thrift::detail::throw_on_bad_union_field_access(); } @@ -1603,7 +1606,7 @@ class Baz final { return value_.longField; } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz>& mutable_intField() { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz>& mutable_intField() { assert(getType() == Type::intField); return value_.intField; } @@ -1613,12 +1616,12 @@ class Baz final { return value_.setField; } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz>& mutable_mapField() { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz>& mutable_mapField() { assert(getType() == Type::mapField); return value_.mapField; } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz>& mutable_binaryField() { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz>& mutable_binaryField() { assert(getType() == Type::binaryField); return value_.binaryField; } @@ -1628,7 +1631,7 @@ class Baz final { return value_.longField; } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::int32_t, Baz> move_intField() { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::facebook::thrift::test::i32_5137, Baz> move_intField() { assert(getType() == Type::intField); return std::move(value_.intField); } @@ -1638,12 +1641,12 @@ class Baz final { return std::move(value_.setField); } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::std::map<::std::string, ::facebook::thrift::test::ListWithElemAdapter_withAdapter_2312>, Baz> move_mapField() { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter3, 6, ::facebook::thrift::test::map_string_ListWithElemAdapter_withAdapter_8454, Baz> move_mapField() { assert(getType() == Type::mapField); return std::move(value_.mapField); } - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::std::string, Baz> move_binaryField() { + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 8, ::facebook::thrift::test::binary_5673, Baz> move_binaryField() { assert(getType() == Type::binaryField); return std::move(value_.binaryField); } @@ -1653,22 +1656,22 @@ class Baz final { return std::move(value_.longField); } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref intField_ref() const& { return {value_.intField, type_, folly::to_underlying(Type::intField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref intField_ref() const&& { return {std::move(value_.intField), type_, folly::to_underlying(Type::intField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref intField_ref() & { return {value_.intField, type_, folly::to_underlying(Type::intField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref intField_ref() && { return {std::move(value_.intField), type_, folly::to_underlying(Type::intField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } @@ -1691,41 +1694,41 @@ class Baz final { FOLLY_ERASE ::apache::thrift::union_field_ref setField_ref() && { return {std::move(value_.setField), type_, folly::to_underlying(Type::setField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template , Baz>> + template > FOLLY_ERASE ::apache::thrift::union_field_ref mapField_ref() const& { return {value_.mapField, type_, folly::to_underlying(Type::mapField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template , Baz>> + template > FOLLY_ERASE ::apache::thrift::union_field_ref mapField_ref() const&& { return {std::move(value_.mapField), type_, folly::to_underlying(Type::mapField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template , Baz>> + template > FOLLY_ERASE ::apache::thrift::union_field_ref mapField_ref() & { return {value_.mapField, type_, folly::to_underlying(Type::mapField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template , Baz>> + template > FOLLY_ERASE ::apache::thrift::union_field_ref mapField_ref() && { return {std::move(value_.mapField), type_, folly::to_underlying(Type::mapField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref binaryField_ref() const& { return {value_.binaryField, type_, folly::to_underlying(Type::binaryField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref binaryField_ref() const&& { return {std::move(value_.binaryField), type_, folly::to_underlying(Type::binaryField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref binaryField_ref() & { return {value_.binaryField, type_, folly::to_underlying(Type::binaryField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } - template > + template > FOLLY_ERASE ::apache::thrift::union_field_ref binaryField_ref() && { return {std::move(value_.binaryField), type_, folly::to_underlying(Type::binaryField), this, ::apache::thrift::detail::union_field_ref_owner_vtable_for}; } @@ -1936,6 +1939,9 @@ unsigned long DirectlyAdapted::read(Protocol_* iprot) { using DirectlyAdapted = ::apache::thrift::adapt_detail::adapted_t<::my::Adapter, ::facebook::thrift::test::detail::DirectlyAdapted>; typedef ::facebook::thrift::test::FooWithAdapter FooWithAdapter_9317; +typedef ::facebook::thrift::test::Baz Baz_7352; +typedef ::facebook::thrift::test::Foo Foo_3943; +typedef ::facebook::thrift::test::Foo Foo_6868; class Bar final { private: @@ -2002,7 +2008,7 @@ class Bar final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - Bar(apache::thrift::FragileConstructor, ::my::Cpp::Type1 structField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::Foo, Bar> optionalStructField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> structListField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> optionalStructListField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 5, ::facebook::thrift::test::Baz, Bar> unionField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 6, ::facebook::thrift::test::Baz, Bar> optionalUnionField__arg, ::facebook::thrift::test::DirectlyAdapted adaptedStructField__arg); + Bar(apache::thrift::FragileConstructor, ::my::Cpp::Type1 structField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::Foo_3943, Bar> optionalStructField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> structListField__arg, ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> optionalStructListField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 5, ::facebook::thrift::test::Baz_7352, Bar> unionField__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 6, ::facebook::thrift::test::Baz_7352, Bar> optionalUnionField__arg, ::facebook::thrift::test::DirectlyAdapted adaptedStructField__arg); Bar(Bar&&) noexcept; Bar(const Bar& src); @@ -2016,15 +2022,15 @@ class Bar final { private: ::my::Cpp::Type1 __fbthrift_field_structField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::Foo, Bar> __fbthrift_field_optionalStructField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 2, ::facebook::thrift::test::Foo_3943, Bar> __fbthrift_field_optionalStructField; private: ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> __fbthrift_field_structListField; private: ::std::vector<::facebook::thrift::test::FooWithAdapter_9317> __fbthrift_field_optionalStructListField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 5, ::facebook::thrift::test::Baz, Bar> __fbthrift_field_unionField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 5, ::facebook::thrift::test::Baz_7352, Bar> __fbthrift_field_unionField; private: - ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 6, ::facebook::thrift::test::Baz, Bar> __fbthrift_field_optionalUnionField; + ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 6, ::facebook::thrift::test::Baz_7352, Bar> __fbthrift_field_optionalUnionField; private: ::facebook::thrift::test::DirectlyAdapted __fbthrift_field_adaptedStructField; private: @@ -2075,42 +2081,42 @@ class Bar final { return {static_cast(this->__fbthrift_field_structField), __isset.at(0), __isset.bit(0)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField_ref() const& { return {this->__fbthrift_field_optionalStructField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField_ref() const&& { return {static_cast(this->__fbthrift_field_optionalStructField), __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField_ref() & { return {this->__fbthrift_field_optionalStructField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField_ref() && { return {static_cast(this->__fbthrift_field_optionalStructField), __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField() const& { return {this->__fbthrift_field_optionalStructField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField() const&& { return {static_cast(this->__fbthrift_field_optionalStructField), __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField() & { return {this->__fbthrift_field_optionalStructField, __isset.at(1), __isset.bit(1)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalStructField() && { return {static_cast(this->__fbthrift_field_optionalStructField), __isset.at(1), __isset.bit(1)}; } @@ -2195,82 +2201,82 @@ class Bar final { return {static_cast(this->__fbthrift_field_optionalStructListField), __isset.at(3), __isset.bit(3)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField_ref() const& { return {this->__fbthrift_field_unionField, __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField_ref() const&& { return {static_cast(this->__fbthrift_field_unionField), __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField_ref() & { return {this->__fbthrift_field_unionField, __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField_ref() && { return {static_cast(this->__fbthrift_field_unionField), __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField() const& { return {this->__fbthrift_field_unionField, __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField() const&& { return {static_cast(this->__fbthrift_field_unionField), __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField() & { return {this->__fbthrift_field_unionField, __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::field_ref unionField() && { return {static_cast(this->__fbthrift_field_unionField), __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField_ref() const& { return {this->__fbthrift_field_optionalUnionField, __isset.at(5), __isset.bit(5)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField_ref() const&& { return {static_cast(this->__fbthrift_field_optionalUnionField), __isset.at(5), __isset.bit(5)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField_ref() & { return {this->__fbthrift_field_optionalUnionField, __isset.at(5), __isset.bit(5)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField_ref() && { return {static_cast(this->__fbthrift_field_optionalUnionField), __isset.at(5), __isset.bit(5)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField() const& { return {this->__fbthrift_field_optionalUnionField, __isset.at(5), __isset.bit(5)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField() const&& { return {static_cast(this->__fbthrift_field_optionalUnionField), __isset.at(5), __isset.bit(5)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField() & { return {this->__fbthrift_field_optionalUnionField, __isset.at(5), __isset.bit(5)}; } - template > + template > FOLLY_ERASE ::apache::thrift::optional_field_ref optionalUnionField() && { return {static_cast(this->__fbthrift_field_optionalUnionField), __isset.at(5), __isset.bit(5)}; } diff --git a/thrift/compiler/test/fixtures/adapter/gen-go/module/ttypes.go b/thrift/compiler/test/fixtures/adapter/gen-go/module/ttypes.go index 005848de205..01a1041222b 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-go/module/ttypes.go +++ b/thrift/compiler/test/fixtures/adapter/gen-go/module/ttypes.go @@ -259,6 +259,36 @@ type StringWithAdapter_7208 = StringWithAdapter func StringWithAdapter_7208Ptr(v StringWithAdapter_7208) *StringWithAdapter_7208 { return &v } +type Baz_7352 = *Baz + +func Baz_7352Ptr(v Baz_7352) *Baz_7352 { return &v } + +func NewBaz_7352() Baz_7352 { return NewBaz() } + +type Foo_3943 = *Foo + +func Foo_3943Ptr(v Foo_3943) *Foo_3943 { return &v } + +func NewFoo_3943() Foo_3943 { return NewFoo() } + +type Foo_6868 = *Foo + +func Foo_6868Ptr(v Foo_6868) *Foo_6868 { return &v } + +func NewFoo_6868() Foo_6868 { return NewFoo() } + +type Binary_5673 = []byte + +func Binary_5673Ptr(v Binary_5673) *Binary_5673 { return &v } + +type I32_5137 = int32 + +func I32_5137Ptr(v I32_5137) *I32_5137 { return &v } + +type MapString_ListWithElemAdapterWithAdapter_8454 = map[string]ListWithElemAdapterWithAdapter_2312 + +func MapString_ListWithElemAdapterWithAdapter_8454Ptr(v MapString_ListWithElemAdapterWithAdapter_8454) *MapString_ListWithElemAdapterWithAdapter_8454 { return &v } + // Attributes: // - Signature // - Color @@ -433,8 +463,8 @@ type Foo struct { IntFieldWithDefault int32 `thrift:"intFieldWithDefault,3" db:"intFieldWithDefault" json:"intFieldWithDefault"` SetField SetWithAdapter `thrift:"setField,4" db:"setField" json:"setField"` OptionalSetField SetWithAdapter `thrift:"optionalSetField,5,optional" db:"optionalSetField" json:"optionalSetField,omitempty"` - MapField map[string][]StringWithAdapter `thrift:"mapField,6" db:"mapField" json:"mapField"` - OptionalMapField map[string][]StringWithAdapter `thrift:"optionalMapField,7,optional" db:"optionalMapField" json:"optionalMapField,omitempty"` + MapField map[string]ListWithElemAdapterWithAdapter_2312 `thrift:"mapField,6" db:"mapField" json:"mapField"` + OptionalMapField map[string]ListWithElemAdapterWithAdapter_2312 `thrift:"optionalMapField,7,optional" db:"optionalMapField" json:"optionalMapField,omitempty"` BinaryField []byte `thrift:"binaryField,8" db:"binaryField" json:"binaryField"` LongField MyI64 `thrift:"longField,9" db:"longField" json:"longField"` AdaptedLongField MyI64 `thrift:"adaptedLongField,10" db:"adaptedLongField" json:"adaptedLongField"` @@ -472,12 +502,12 @@ func (p *Foo) GetOptionalSetField() SetWithAdapter { return p.OptionalSetField } -func (p *Foo) GetMapField() map[string][]StringWithAdapter { +func (p *Foo) GetMapField() map[string]ListWithElemAdapterWithAdapter_2312 { return p.MapField } -var Foo_OptionalMapField_DEFAULT map[string][]StringWithAdapter +var Foo_OptionalMapField_DEFAULT map[string]ListWithElemAdapterWithAdapter_2312 -func (p *Foo) GetOptionalMapField() map[string][]StringWithAdapter { +func (p *Foo) GetOptionalMapField() map[string]ListWithElemAdapterWithAdapter_2312 { return p.OptionalMapField } @@ -559,12 +589,12 @@ func (f *FooBuilder) OptionalSetField(optionalSetField SetWithAdapter) *FooBuild return f } -func (f *FooBuilder) MapField(mapField map[string][]StringWithAdapter) *FooBuilder { +func (f *FooBuilder) MapField(mapField map[string]ListWithElemAdapterWithAdapter_2312) *FooBuilder { f.obj.MapField = mapField return f } -func (f *FooBuilder) OptionalMapField(optionalMapField map[string][]StringWithAdapter) *FooBuilder { +func (f *FooBuilder) OptionalMapField(optionalMapField map[string]ListWithElemAdapterWithAdapter_2312) *FooBuilder { f.obj.OptionalMapField = optionalMapField return f } @@ -614,12 +644,12 @@ func (f *Foo) SetOptionalSetField(optionalSetField SetWithAdapter) *Foo { return f } -func (f *Foo) SetMapField(mapField map[string][]StringWithAdapter) *Foo { +func (f *Foo) SetMapField(mapField map[string]ListWithElemAdapterWithAdapter_2312) *Foo { f.MapField = mapField return f } -func (f *Foo) SetOptionalMapField(optionalMapField map[string][]StringWithAdapter) *Foo { +func (f *Foo) SetOptionalMapField(optionalMapField map[string]ListWithElemAdapterWithAdapter_2312) *Foo { f.OptionalMapField = optionalMapField return f } @@ -720,7 +750,8 @@ func (p *Foo) ReadField1(iprot thrift.Protocol) error { if v, err := iprot.ReadI32(); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - p.IntField = v + temp := I32_5137(v) + p.IntField = temp } return nil } @@ -729,7 +760,8 @@ func (p *Foo) ReadField2(iprot thrift.Protocol) error { if v, err := iprot.ReadI32(); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { - p.OptionalIntField = &v + temp := I32_5137(v) + p.OptionalIntField = &temp } return nil } @@ -738,7 +770,8 @@ func (p *Foo) ReadField3(iprot thrift.Protocol) error { if v, err := iprot.ReadI32(); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { - p.IntFieldWithDefault = v + temp := I32_5137(v) + p.IntFieldWithDefault = temp } return nil } @@ -792,7 +825,7 @@ func (p *Foo) ReadField6(iprot thrift.Protocol) error { if err != nil { return thrift.PrependError("error reading map begin: ", err) } - tMap := make(map[string][]StringWithAdapter, size) + tMap := make(map[string]ListWithElemAdapterWithAdapter_2312, size) p.MapField = tMap for i := 0; i < size; i ++ { var _key2 string @@ -805,7 +838,7 @@ func (p *Foo) ReadField6(iprot thrift.Protocol) error { if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([]StringWithAdapter, 0, size) + tSlice := make(ListWithElemAdapterWithAdapter_2312, 0, size) _val3 := tSlice for i := 0; i < size; i ++ { var _elem4 StringWithAdapter @@ -833,7 +866,7 @@ func (p *Foo) ReadField7(iprot thrift.Protocol) error { if err != nil { return thrift.PrependError("error reading map begin: ", err) } - tMap := make(map[string][]StringWithAdapter, size) + tMap := make(map[string]ListWithElemAdapterWithAdapter_2312, size) p.OptionalMapField = tMap for i := 0; i < size; i ++ { var _key5 string @@ -846,7 +879,7 @@ func (p *Foo) ReadField7(iprot thrift.Protocol) error { if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([]StringWithAdapter, 0, size) + tSlice := make(ListWithElemAdapterWithAdapter_2312, 0, size) _val6 := tSlice for i := 0; i < size; i ++ { var _elem7 StringWithAdapter @@ -873,7 +906,8 @@ func (p *Foo) ReadField8(iprot thrift.Protocol) error { if v, err := iprot.ReadBinary(); err != nil { return thrift.PrependError("error reading field 8: ", err) } else { - p.BinaryField = v + temp := Binary_5673(v) + p.BinaryField = temp } return nil } @@ -1146,7 +1180,7 @@ type Baz struct { // unused fields # 2 to 3 SetField SetWithAdapter `thrift:"setField,4,optional" db:"setField" json:"setField,omitempty"` // unused field # 5 - MapField map[string][]StringWithAdapter `thrift:"mapField,6,optional" db:"mapField" json:"mapField,omitempty"` + MapField map[string]ListWithElemAdapterWithAdapter_2312 `thrift:"mapField,6,optional" db:"mapField" json:"mapField,omitempty"` // unused field # 7 BinaryField []byte `thrift:"binaryField,8,optional" db:"binaryField" json:"binaryField,omitempty"` LongField *MyI64 `thrift:"longField,9,optional" db:"longField" json:"longField,omitempty"` @@ -1168,9 +1202,9 @@ var Baz_SetField_DEFAULT SetWithAdapter func (p *Baz) GetSetField() SetWithAdapter { return p.SetField } -var Baz_MapField_DEFAULT map[string][]StringWithAdapter +var Baz_MapField_DEFAULT map[string]ListWithElemAdapterWithAdapter_2312 -func (p *Baz) GetMapField() map[string][]StringWithAdapter { +func (p *Baz) GetMapField() map[string]ListWithElemAdapterWithAdapter_2312 { return p.MapField } var Baz_BinaryField_DEFAULT []byte @@ -1256,7 +1290,7 @@ func (b *BazBuilder) SetField(setField SetWithAdapter) *BazBuilder { return b } -func (b *BazBuilder) MapField(mapField map[string][]StringWithAdapter) *BazBuilder { +func (b *BazBuilder) MapField(mapField map[string]ListWithElemAdapterWithAdapter_2312) *BazBuilder { b.obj.MapField = mapField return b } @@ -1281,7 +1315,7 @@ func (b *Baz) SetSetField(setField SetWithAdapter) *Baz { return b } -func (b *Baz) SetMapField(mapField map[string][]StringWithAdapter) *Baz { +func (b *Baz) SetMapField(mapField map[string]ListWithElemAdapterWithAdapter_2312) *Baz { b.MapField = mapField return b } @@ -1348,7 +1382,8 @@ func (p *Baz) ReadField1(iprot thrift.Protocol) error { if v, err := iprot.ReadI32(); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - p.IntField = &v + temp := I32_5137(v) + p.IntField = &temp } return nil } @@ -1380,7 +1415,7 @@ func (p *Baz) ReadField6(iprot thrift.Protocol) error { if err != nil { return thrift.PrependError("error reading map begin: ", err) } - tMap := make(map[string][]StringWithAdapter, size) + tMap := make(map[string]ListWithElemAdapterWithAdapter_2312, size) p.MapField = tMap for i := 0; i < size; i ++ { var _key9 string @@ -1393,7 +1428,7 @@ func (p *Baz) ReadField6(iprot thrift.Protocol) error { if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make([]StringWithAdapter, 0, size) + tSlice := make(ListWithElemAdapterWithAdapter_2312, 0, size) _val10 := tSlice for i := 0; i < size; i ++ { var _elem11 StringWithAdapter @@ -1420,7 +1455,8 @@ func (p *Baz) ReadField8(iprot thrift.Protocol) error { if v, err := iprot.ReadBinary(); err != nil { return thrift.PrependError("error reading field 8: ", err) } else { - p.BinaryField = v + temp := Binary_5673(v) + p.BinaryField = temp } return nil } @@ -1589,7 +1625,7 @@ type Bar struct { func NewBar() *Bar { return &Bar{ - StructField: NewFoo(), + StructField: NewFoo_6868(), AdaptedStructField: NewDirectlyAdapted(), } } @@ -1811,7 +1847,7 @@ func (p *Bar) Read(iprot thrift.Protocol) error { } func (p *Bar) ReadField1(iprot thrift.Protocol) error { - p.StructField = NewFoo() + p.StructField = NewFoo_6868() if err := p.StructField.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.StructField), err) } @@ -1819,7 +1855,7 @@ func (p *Bar) ReadField1(iprot thrift.Protocol) error { } func (p *Bar) ReadField2(iprot thrift.Protocol) error { - p.OptionalStructField = NewFoo() + p.OptionalStructField = NewFoo_3943() if err := p.OptionalStructField.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.OptionalStructField), err) } @@ -1867,7 +1903,7 @@ func (p *Bar) ReadField4(iprot thrift.Protocol) error { } func (p *Bar) ReadField5(iprot thrift.Protocol) error { - p.UnionField = NewBaz() + p.UnionField = NewBaz_7352() if err := p.UnionField.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UnionField), err) } @@ -1875,7 +1911,7 @@ func (p *Bar) ReadField5(iprot thrift.Protocol) error { } func (p *Bar) ReadField6(iprot thrift.Protocol) error { - p.OptionalUnionField = NewBaz() + p.OptionalUnionField = NewBaz_7352() if err := p.OptionalUnionField.Read(iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.OptionalUnionField), err) } diff --git a/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/metadata.go b/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/metadata.go index 1bf7e3789e9..9e2863afab2 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/metadata.go +++ b/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/metadata.go @@ -21,9 +21,11 @@ var ( metadata.NewThriftEnumType(). SetName("module.Color"), ) - premadeThriftType_i32 = metadata.NewThriftType().SetTPrimitive( - metadata.ThriftPrimitiveType_THRIFT_I32_TYPE.Ptr(), - ) + premadeThriftType_module_i32_5137 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.i32_5137"). + SetUnderlyingType(premadeThriftType_i32), + ) premadeThriftType_set_string = metadata.NewThriftType().SetTSet( metadata.NewThriftSetType(). SetValueType(premadeThriftType_string), @@ -33,19 +35,16 @@ var ( SetName("module.SetWithAdapter"). SetUnderlyingType(premadeThriftType_set_string), ) - premadeThriftType_module_ListWithElemAdapter_withAdapter_2312 = metadata.NewThriftType().SetTTypedef( + premadeThriftType_module_map_string_ListWithElemAdapter_withAdapter_8454 = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). - SetName("module.ListWithElemAdapter_withAdapter_2312"). - SetUnderlyingType(premadeThriftType_module_ListWithElemAdapter_withAdapter), + SetName("module.map_string_ListWithElemAdapter_withAdapter_8454"). + SetUnderlyingType(premadeThriftType_map_string_module_ListWithElemAdapter_withAdapter_2312), + ) + premadeThriftType_module_binary_5673 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.binary_5673"). + SetUnderlyingType(premadeThriftType_binary), ) - premadeThriftType_map_string_module_ListWithElemAdapter_withAdapter_2312 = metadata.NewThriftType().SetTMap( - metadata.NewThriftMapType(). - SetKeyType(premadeThriftType_string). - SetValueType(premadeThriftType_module_ListWithElemAdapter_withAdapter_2312), - ) - premadeThriftType_binary = metadata.NewThriftType().SetTPrimitive( - metadata.ThriftPrimitiveType_THRIFT_BINARY_TYPE.Ptr(), - ) premadeThriftType_i64 = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_I64_TYPE.Ptr(), ) @@ -59,9 +58,15 @@ var ( SetName("module.DoubleTypedefI64"). SetUnderlyingType(premadeThriftType_module_MyI64), ) - premadeThriftType_module_Foo = metadata.NewThriftType().SetTStruct( - metadata.NewThriftStructType(). - SetName("module.Foo"), + premadeThriftType_module_Foo_6868 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.Foo_6868"). + SetUnderlyingType(premadeThriftType_module_Foo), + ) + premadeThriftType_module_Foo_3943 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.Foo_3943"). + SetUnderlyingType(premadeThriftType_module_Foo), ) premadeThriftType_module_FooWithAdapter_9317 = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). @@ -72,14 +77,18 @@ var ( metadata.NewThriftListType(). SetValueType(premadeThriftType_module_FooWithAdapter_9317), ) - premadeThriftType_module_Baz = metadata.NewThriftType().SetTUnion( - metadata.NewThriftUnionType(). - SetName("module.Baz"), + premadeThriftType_module_Baz_7352 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.Baz_7352"). + SetUnderlyingType(premadeThriftType_module_Baz), ) premadeThriftType_module_DirectlyAdapted = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). SetName("module.DirectlyAdapted"), ) + premadeThriftType_i32 = metadata.NewThriftType().SetTPrimitive( + metadata.ThriftPrimitiveType_THRIFT_I32_TYPE.Ptr(), + ) premadeThriftType_set_i32 = metadata.NewThriftType().SetTSet( metadata.NewThriftSetType(). SetValueType(premadeThriftType_i32), @@ -94,6 +103,9 @@ var ( SetName("module.DurationMs"). SetUnderlyingType(premadeThriftType_i64), ) + premadeThriftType_binary = metadata.NewThriftType().SetTPrimitive( + metadata.ThriftPrimitiveType_THRIFT_BINARY_TYPE.Ptr(), + ) premadeThriftType_module_IOBuf = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("module.IOBuf"). @@ -241,10 +253,18 @@ var ( SetName("module.ListWithElemAdapter"). SetUnderlyingType(premadeThriftType_list_module_StringWithAdapter), ) + premadeThriftType_module_Foo = metadata.NewThriftType().SetTStruct( + metadata.NewThriftStructType(). + SetName("module.Foo"), + ) premadeThriftType_module_Bar = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). SetName("module.Bar"), ) + premadeThriftType_module_Baz = metadata.NewThriftType().SetTUnion( + metadata.NewThriftUnionType(). + SetName("module.Baz"), + ) premadeThriftType_module_A = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). SetName("module.A"), @@ -268,6 +288,16 @@ var ( SetName("module.MyI32"). SetUnderlyingType(premadeThriftType_i32), ) + premadeThriftType_module_ListWithElemAdapter_withAdapter_2312 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.ListWithElemAdapter_withAdapter_2312"). + SetUnderlyingType(premadeThriftType_module_ListWithElemAdapter_withAdapter), + ) + premadeThriftType_map_string_module_ListWithElemAdapter_withAdapter_2312 = metadata.NewThriftType().SetTMap( + metadata.NewThriftMapType(). + SetKeyType(premadeThriftType_string). + SetValueType(premadeThriftType_module_ListWithElemAdapter_withAdapter_2312), + ) premadeThriftType_module_MyI32_4873 = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("module.MyI32_4873"). @@ -311,17 +341,17 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(1). SetName("intField"). SetIsOptional(false). - SetType(premadeThriftType_i32), + SetType(premadeThriftType_module_i32_5137), metadata.NewThriftField(). SetId(2). SetName("optionalIntField"). SetIsOptional(true). - SetType(premadeThriftType_i32), + SetType(premadeThriftType_module_i32_5137), metadata.NewThriftField(). SetId(3). SetName("intFieldWithDefault"). SetIsOptional(false). - SetType(premadeThriftType_i32), + SetType(premadeThriftType_module_i32_5137), metadata.NewThriftField(). SetId(4). SetName("setField"). @@ -336,17 +366,17 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(6). SetName("mapField"). SetIsOptional(false). - SetType(premadeThriftType_map_string_module_ListWithElemAdapter_withAdapter_2312), + SetType(premadeThriftType_module_map_string_ListWithElemAdapter_withAdapter_8454), metadata.NewThriftField(). SetId(7). SetName("optionalMapField"). SetIsOptional(true). - SetType(premadeThriftType_map_string_module_ListWithElemAdapter_withAdapter_2312), + SetType(premadeThriftType_module_map_string_ListWithElemAdapter_withAdapter_8454), metadata.NewThriftField(). SetId(8). SetName("binaryField"). SetIsOptional(false). - SetType(premadeThriftType_binary), + SetType(premadeThriftType_module_binary_5673), metadata.NewThriftField(). SetId(9). SetName("longField"). @@ -373,7 +403,7 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(1). SetName("intField"). SetIsOptional(false). - SetType(premadeThriftType_i32), + SetType(premadeThriftType_module_i32_5137), metadata.NewThriftField(). SetId(4). SetName("setField"). @@ -383,12 +413,12 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(6). SetName("mapField"). SetIsOptional(false). - SetType(premadeThriftType_map_string_module_ListWithElemAdapter_withAdapter_2312), + SetType(premadeThriftType_module_map_string_ListWithElemAdapter_withAdapter_8454), metadata.NewThriftField(). SetId(8). SetName("binaryField"). SetIsOptional(false). - SetType(premadeThriftType_binary), + SetType(premadeThriftType_module_binary_5673), metadata.NewThriftField(). SetId(9). SetName("longField"). @@ -405,12 +435,12 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(1). SetName("structField"). SetIsOptional(false). - SetType(premadeThriftType_module_Foo), + SetType(premadeThriftType_module_Foo_6868), metadata.NewThriftField(). SetId(2). SetName("optionalStructField"). SetIsOptional(true). - SetType(premadeThriftType_module_Foo), + SetType(premadeThriftType_module_Foo_3943), metadata.NewThriftField(). SetId(3). SetName("structListField"). @@ -425,12 +455,12 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(5). SetName("unionField"). SetIsOptional(false). - SetType(premadeThriftType_module_Baz), + SetType(premadeThriftType_module_Baz_7352), metadata.NewThriftField(). SetId(6). SetName("optionalUnionField"). SetIsOptional(true). - SetType(premadeThriftType_module_Baz), + SetType(premadeThriftType_module_Baz_7352), metadata.NewThriftField(). SetId(7). SetName("adaptedStructField"). diff --git a/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/types.go b/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/types.go index f9a02877169..69f4d14cd46 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/types.go +++ b/thrift/compiler/test/fixtures/adapter/gen-go_mstch/module/types.go @@ -924,6 +924,212 @@ if err != nil { return decodeResult, decodeErr } +type Baz_7352 = Baz + +func NewBaz_7352() *Baz_7352 { + return NewBaz() +} + +func WriteBaz_7352(item *Baz_7352, p thrift.Protocol) error { + if err := item.Write(p); err != nil { + return err +} + return nil +} + +func ReadBaz_7352(p thrift.Protocol) (Baz_7352, error) { + var decodeResult Baz_7352 + decodeErr := func() error { + result := *NewBaz() +err := result.Read(p) +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type Foo_3943 = Foo + +func NewFoo_3943() *Foo_3943 { + return NewFoo() +} + +func WriteFoo_3943(item *Foo_3943, p thrift.Protocol) error { + if err := item.Write(p); err != nil { + return err +} + return nil +} + +func ReadFoo_3943(p thrift.Protocol) (Foo_3943, error) { + var decodeResult Foo_3943 + decodeErr := func() error { + result := *NewFoo() +err := result.Read(p) +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type Foo_6868 = Foo + +func NewFoo_6868() *Foo_6868 { + return NewFoo() +} + +func WriteFoo_6868(item *Foo_6868, p thrift.Protocol) error { + if err := item.Write(p); err != nil { + return err +} + return nil +} + +func ReadFoo_6868(p thrift.Protocol) (Foo_6868, error) { + var decodeResult Foo_6868 + decodeErr := func() error { + result := *NewFoo() +err := result.Read(p) +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type Binary_5673 = []byte + +func NewBinary_5673() Binary_5673 { + return []byte("") +} + +func WriteBinary_5673(item Binary_5673, p thrift.Protocol) error { + if err := p.WriteBinary(item); err != nil { + return err +} + return nil +} + +func ReadBinary_5673(p thrift.Protocol) (Binary_5673, error) { + var decodeResult Binary_5673 + decodeErr := func() error { + result, err := p.ReadBinary() +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type I32_5137 = int32 + +func NewI32_5137() I32_5137 { + return 0 +} + +func WriteI32_5137(item I32_5137, p thrift.Protocol) error { + if err := p.WriteI32(item); err != nil { + return err +} + return nil +} + +func ReadI32_5137(p thrift.Protocol) (I32_5137, error) { + var decodeResult I32_5137 + decodeErr := func() error { + result, err := p.ReadI32() +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type MapString_ListWithElemAdapterWithAdapter_8454 = map[string]ListWithElemAdapterWithAdapter_2312 + +func NewMapString_ListWithElemAdapterWithAdapter_8454() MapString_ListWithElemAdapterWithAdapter_8454 { + return make(map[string]ListWithElemAdapterWithAdapter_2312) +} + +func WriteMapString_ListWithElemAdapterWithAdapter_8454(item MapString_ListWithElemAdapterWithAdapter_8454, p thrift.Protocol) error { + if err := p.WriteMapBegin(thrift.STRING, thrift.LIST, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteString(item); err != nil { + return err +} + } + + { + item := v + err := WriteListWithElemAdapterWithAdapter_2312(item, p) +if err != nil { + return err +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + return nil +} + +func ReadMapString_ListWithElemAdapterWithAdapter_8454(p thrift.Protocol) (MapString_ListWithElemAdapterWithAdapter_8454, error) { + var decodeResult MapString_ListWithElemAdapterWithAdapter_8454 + decodeErr := func() error { + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[string]ListWithElemAdapterWithAdapter_2312, size) +for i := 0; i < size; i++ { + var key string + { + result, err := p.ReadString() +if err != nil { + return err +} + key = result + } + + var value ListWithElemAdapterWithAdapter_2312 + { + result, err := ReadListWithElemAdapterWithAdapter_2312(p) +if err != nil { + return err +} + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + type Color int32 const ( @@ -1273,14 +1479,14 @@ func (x *MyAnnotation) String() string { } type Foo struct { - IntField int32 `thrift:"intField,1" json:"intField" db:"intField"` - OptionalIntField *int32 `thrift:"optionalIntField,2,optional" json:"optionalIntField,omitempty" db:"optionalIntField"` - IntFieldWithDefault int32 `thrift:"intFieldWithDefault,3" json:"intFieldWithDefault" db:"intFieldWithDefault"` + IntField I32_5137 `thrift:"intField,1" json:"intField" db:"intField"` + OptionalIntField *I32_5137 `thrift:"optionalIntField,2,optional" json:"optionalIntField,omitempty" db:"optionalIntField"` + IntFieldWithDefault I32_5137 `thrift:"intFieldWithDefault,3" json:"intFieldWithDefault" db:"intFieldWithDefault"` SetField SetWithAdapter `thrift:"setField,4" json:"setField" db:"setField"` OptionalSetField SetWithAdapter `thrift:"optionalSetField,5,optional" json:"optionalSetField,omitempty" db:"optionalSetField"` - MapField map[string]ListWithElemAdapterWithAdapter_2312 `thrift:"mapField,6" json:"mapField" db:"mapField"` - OptionalMapField map[string]ListWithElemAdapterWithAdapter_2312 `thrift:"optionalMapField,7,optional" json:"optionalMapField,omitempty" db:"optionalMapField"` - BinaryField []byte `thrift:"binaryField,8" json:"binaryField" db:"binaryField"` + MapField MapString_ListWithElemAdapterWithAdapter_8454 `thrift:"mapField,6" json:"mapField" db:"mapField"` + OptionalMapField MapString_ListWithElemAdapterWithAdapter_8454 `thrift:"optionalMapField,7,optional" json:"optionalMapField,omitempty" db:"optionalMapField"` + BinaryField Binary_5673 `thrift:"binaryField,8" json:"binaryField" db:"binaryField"` LongField MyI64 `thrift:"longField,9" json:"longField" db:"longField"` AdaptedLongField MyI64 `thrift:"adaptedLongField,10" json:"adaptedLongField" db:"adaptedLongField"` DoubleAdaptedField DoubleTypedefI64 `thrift:"doubleAdaptedField,11" json:"doubleAdaptedField" db:"doubleAdaptedField"` @@ -1290,41 +1496,41 @@ var _ thrift.Struct = &Foo{} func NewFoo() *Foo { return (&Foo{}). - SetIntFieldNonCompat(0). + SetIntFieldNonCompat(NewI32_5137()). SetIntFieldWithDefaultNonCompat(13). SetSetFieldNonCompat(NewSetWithAdapter()). - SetMapFieldNonCompat(make(map[string]ListWithElemAdapterWithAdapter_2312)). - SetBinaryFieldNonCompat([]byte("")). + SetMapFieldNonCompat(NewMapString_ListWithElemAdapterWithAdapter_8454()). + SetBinaryFieldNonCompat(NewBinary_5673()). SetLongFieldNonCompat(NewMyI64()). SetAdaptedLongFieldNonCompat(NewMyI64()). SetDoubleAdaptedFieldNonCompat(NewDoubleTypedefI64()) } -func (x *Foo) GetIntFieldNonCompat() int32 { +func (x *Foo) GetIntFieldNonCompat() I32_5137 { return x.IntField } -func (x *Foo) GetIntField() int32 { +func (x *Foo) GetIntField() I32_5137 { return x.IntField } -func (x *Foo) GetOptionalIntFieldNonCompat() *int32 { +func (x *Foo) GetOptionalIntFieldNonCompat() *I32_5137 { return x.OptionalIntField } -func (x *Foo) GetOptionalIntField() int32 { +func (x *Foo) GetOptionalIntField() I32_5137 { if !x.IsSetOptionalIntField() { - return 0 + return NewI32_5137() } return *x.OptionalIntField } -func (x *Foo) GetIntFieldWithDefaultNonCompat() int32 { +func (x *Foo) GetIntFieldWithDefaultNonCompat() I32_5137 { return x.IntFieldWithDefault } -func (x *Foo) GetIntFieldWithDefault() int32 { +func (x *Foo) GetIntFieldWithDefault() I32_5137 { return x.IntFieldWithDefault } @@ -1352,37 +1558,37 @@ func (x *Foo) GetOptionalSetField() SetWithAdapter { return x.OptionalSetField } -func (x *Foo) GetMapFieldNonCompat() map[string]ListWithElemAdapterWithAdapter_2312 { +func (x *Foo) GetMapFieldNonCompat() MapString_ListWithElemAdapterWithAdapter_8454 { return x.MapField } -func (x *Foo) GetMapField() map[string]ListWithElemAdapterWithAdapter_2312 { +func (x *Foo) GetMapField() MapString_ListWithElemAdapterWithAdapter_8454 { if !x.IsSetMapField() { - return make(map[string]ListWithElemAdapterWithAdapter_2312) + return NewMapString_ListWithElemAdapterWithAdapter_8454() } return x.MapField } -func (x *Foo) GetOptionalMapFieldNonCompat() map[string]ListWithElemAdapterWithAdapter_2312 { +func (x *Foo) GetOptionalMapFieldNonCompat() MapString_ListWithElemAdapterWithAdapter_8454 { return x.OptionalMapField } -func (x *Foo) GetOptionalMapField() map[string]ListWithElemAdapterWithAdapter_2312 { +func (x *Foo) GetOptionalMapField() MapString_ListWithElemAdapterWithAdapter_8454 { if !x.IsSetOptionalMapField() { - return make(map[string]ListWithElemAdapterWithAdapter_2312) + return NewMapString_ListWithElemAdapterWithAdapter_8454() } return x.OptionalMapField } -func (x *Foo) GetBinaryFieldNonCompat() []byte { +func (x *Foo) GetBinaryFieldNonCompat() Binary_5673 { return x.BinaryField } -func (x *Foo) GetBinaryField() []byte { +func (x *Foo) GetBinaryField() Binary_5673 { if !x.IsSetBinaryField() { - return []byte("") + return NewBinary_5673() } return x.BinaryField @@ -1412,32 +1618,32 @@ func (x *Foo) GetDoubleAdaptedField() DoubleTypedefI64 { return x.DoubleAdaptedField } -func (x *Foo) SetIntFieldNonCompat(value int32) *Foo { +func (x *Foo) SetIntFieldNonCompat(value I32_5137) *Foo { x.IntField = value return x } -func (x *Foo) SetIntField(value int32) *Foo { +func (x *Foo) SetIntField(value I32_5137) *Foo { x.IntField = value return x } -func (x *Foo) SetOptionalIntFieldNonCompat(value int32) *Foo { +func (x *Foo) SetOptionalIntFieldNonCompat(value I32_5137) *Foo { x.OptionalIntField = &value return x } -func (x *Foo) SetOptionalIntField(value *int32) *Foo { +func (x *Foo) SetOptionalIntField(value *I32_5137) *Foo { x.OptionalIntField = value return x } -func (x *Foo) SetIntFieldWithDefaultNonCompat(value int32) *Foo { +func (x *Foo) SetIntFieldWithDefaultNonCompat(value I32_5137) *Foo { x.IntFieldWithDefault = value return x } -func (x *Foo) SetIntFieldWithDefault(value int32) *Foo { +func (x *Foo) SetIntFieldWithDefault(value I32_5137) *Foo { x.IntFieldWithDefault = value return x } @@ -1462,32 +1668,32 @@ func (x *Foo) SetOptionalSetField(value SetWithAdapter) *Foo { return x } -func (x *Foo) SetMapFieldNonCompat(value map[string]ListWithElemAdapterWithAdapter_2312) *Foo { +func (x *Foo) SetMapFieldNonCompat(value MapString_ListWithElemAdapterWithAdapter_8454) *Foo { x.MapField = value return x } -func (x *Foo) SetMapField(value map[string]ListWithElemAdapterWithAdapter_2312) *Foo { +func (x *Foo) SetMapField(value MapString_ListWithElemAdapterWithAdapter_8454) *Foo { x.MapField = value return x } -func (x *Foo) SetOptionalMapFieldNonCompat(value map[string]ListWithElemAdapterWithAdapter_2312) *Foo { +func (x *Foo) SetOptionalMapFieldNonCompat(value MapString_ListWithElemAdapterWithAdapter_8454) *Foo { x.OptionalMapField = value return x } -func (x *Foo) SetOptionalMapField(value map[string]ListWithElemAdapterWithAdapter_2312) *Foo { +func (x *Foo) SetOptionalMapField(value MapString_ListWithElemAdapterWithAdapter_8454) *Foo { x.OptionalMapField = value return x } -func (x *Foo) SetBinaryFieldNonCompat(value []byte) *Foo { +func (x *Foo) SetBinaryFieldNonCompat(value Binary_5673) *Foo { x.BinaryField = value return x } -func (x *Foo) SetBinaryField(value []byte) *Foo { +func (x *Foo) SetBinaryField(value Binary_5673) *Foo { x.BinaryField = value return x } @@ -1552,7 +1758,8 @@ func (x *Foo) writeField1(p thrift.Protocol) error { // IntField } item := x.GetIntFieldNonCompat() - if err := p.WriteI32(item); err != nil { + err := WriteI32_5137(item, p) +if err != nil { return err } @@ -1572,7 +1779,8 @@ func (x *Foo) writeField2(p thrift.Protocol) error { // OptionalIntField } item := *x.GetOptionalIntFieldNonCompat() - if err := p.WriteI32(item); err != nil { + err := WriteI32_5137(item, p) +if err != nil { return err } @@ -1588,7 +1796,8 @@ func (x *Foo) writeField3(p thrift.Protocol) error { // IntFieldWithDefault } item := x.GetIntFieldWithDefaultNonCompat() - if err := p.WriteI32(item); err != nil { + err := WriteI32_5137(item, p) +if err != nil { return err } @@ -1642,28 +1851,10 @@ func (x *Foo) writeField6(p thrift.Protocol) error { // MapField } item := x.GetMapFieldNonCompat() - if err := p.WriteMapBegin(thrift.STRING, thrift.LIST, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteString(item); err != nil { - return err -} - } - - { - item := v - err := WriteListWithElemAdapterWithAdapter_2312(item, p) + err := WriteMapString_ListWithElemAdapterWithAdapter_8454(item, p) if err != nil { return err } - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -1681,28 +1872,10 @@ func (x *Foo) writeField7(p thrift.Protocol) error { // OptionalMapField } item := x.GetOptionalMapFieldNonCompat() - if err := p.WriteMapBegin(thrift.STRING, thrift.LIST, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteString(item); err != nil { - return err -} - } - - { - item := v - err := WriteListWithElemAdapterWithAdapter_2312(item, p) + err := WriteMapString_ListWithElemAdapterWithAdapter_8454(item, p) if err != nil { return err } - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -1716,7 +1889,8 @@ func (x *Foo) writeField8(p thrift.Protocol) error { // BinaryField } item := x.GetBinaryFieldNonCompat() - if err := p.WriteBinary(item); err != nil { + err := WriteBinary_5673(item, p) +if err != nil { return err } @@ -1778,7 +1952,7 @@ if err != nil { } func (x *Foo) readField1(p thrift.Protocol) error { // IntField - result, err := p.ReadI32() + result, err := ReadI32_5137(p) if err != nil { return err } @@ -1788,7 +1962,7 @@ if err != nil { } func (x *Foo) readField2(p thrift.Protocol) error { // OptionalIntField - result, err := p.ReadI32() + result, err := ReadI32_5137(p) if err != nil { return err } @@ -1798,7 +1972,7 @@ if err != nil { } func (x *Foo) readField3(p thrift.Protocol) error { // IntFieldWithDefault - result, err := p.ReadI32() + result, err := ReadI32_5137(p) if err != nil { return err } @@ -1828,83 +2002,27 @@ if err != nil { } func (x *Foo) readField6(p thrift.Protocol) error { // MapField - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[string]ListWithElemAdapterWithAdapter_2312, size) -for i := 0; i < size; i++ { - var key string - { - result, err := p.ReadString() -if err != nil { - return err -} - key = result - } - - var value ListWithElemAdapterWithAdapter_2312 - { - result, err := ReadListWithElemAdapterWithAdapter_2312(p) + result, err := ReadMapString_ListWithElemAdapterWithAdapter_8454(p) if err != nil { return err } - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult x.SetMapFieldNonCompat(result) return nil } func (x *Foo) readField7(p thrift.Protocol) error { // OptionalMapField - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[string]ListWithElemAdapterWithAdapter_2312, size) -for i := 0; i < size; i++ { - var key string - { - result, err := p.ReadString() + result, err := ReadMapString_ListWithElemAdapterWithAdapter_8454(p) if err != nil { return err } - key = result - } - - var value ListWithElemAdapterWithAdapter_2312 - { - result, err := ReadListWithElemAdapterWithAdapter_2312(p) -if err != nil { - return err -} - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult x.SetOptionalMapFieldNonCompat(result) return nil } func (x *Foo) readField8(p thrift.Protocol) error { // BinaryField - result, err := p.ReadBinary() + result, err := ReadBinary_5673(p) if err != nil { return err } @@ -2008,21 +2126,21 @@ func NewFooBuilder() *FooBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewFoo().Set().Set() -func (x *FooBuilder) IntField(value int32) *FooBuilder { +func (x *FooBuilder) IntField(value I32_5137) *FooBuilder { x.obj.IntField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewFoo().Set().Set() -func (x *FooBuilder) OptionalIntField(value *int32) *FooBuilder { +func (x *FooBuilder) OptionalIntField(value *I32_5137) *FooBuilder { x.obj.OptionalIntField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewFoo().Set().Set() -func (x *FooBuilder) IntFieldWithDefault(value int32) *FooBuilder { +func (x *FooBuilder) IntFieldWithDefault(value I32_5137) *FooBuilder { x.obj.IntFieldWithDefault = value return x } @@ -2043,21 +2161,21 @@ func (x *FooBuilder) OptionalSetField(value SetWithAdapter) *FooBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewFoo().Set().Set() -func (x *FooBuilder) MapField(value map[string]ListWithElemAdapterWithAdapter_2312) *FooBuilder { +func (x *FooBuilder) MapField(value MapString_ListWithElemAdapterWithAdapter_8454) *FooBuilder { x.obj.MapField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewFoo().Set().Set() -func (x *FooBuilder) OptionalMapField(value map[string]ListWithElemAdapterWithAdapter_2312) *FooBuilder { +func (x *FooBuilder) OptionalMapField(value MapString_ListWithElemAdapterWithAdapter_8454) *FooBuilder { x.obj.OptionalMapField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewFoo().Set().Set() -func (x *FooBuilder) BinaryField(value []byte) *FooBuilder { +func (x *FooBuilder) BinaryField(value Binary_5673) *FooBuilder { x.obj.BinaryField = value return x } @@ -2252,10 +2370,10 @@ func (x *Foo) String() string { } type Baz struct { - IntField *int32 `thrift:"intField,1" json:"intField,omitempty" db:"intField"` + IntField *I32_5137 `thrift:"intField,1" json:"intField,omitempty" db:"intField"` SetField SetWithAdapter `thrift:"setField,4" json:"setField,omitempty" db:"setField"` - MapField map[string]ListWithElemAdapterWithAdapter_2312 `thrift:"mapField,6" json:"mapField,omitempty" db:"mapField"` - BinaryField []byte `thrift:"binaryField,8" json:"binaryField,omitempty" db:"binaryField"` + MapField MapString_ListWithElemAdapterWithAdapter_8454 `thrift:"mapField,6" json:"mapField,omitempty" db:"mapField"` + BinaryField Binary_5673 `thrift:"binaryField,8" json:"binaryField,omitempty" db:"binaryField"` LongField *MyI64 `thrift:"longField,9" json:"longField,omitempty" db:"longField"` } // Compile time interface enforcer @@ -2265,13 +2383,13 @@ func NewBaz() *Baz { return (&Baz{}) } -func (x *Baz) GetIntFieldNonCompat() *int32 { +func (x *Baz) GetIntFieldNonCompat() *I32_5137 { return x.IntField } -func (x *Baz) GetIntField() int32 { +func (x *Baz) GetIntField() I32_5137 { if !x.IsSetIntField() { - return 0 + return NewI32_5137() } return *x.IntField @@ -2289,25 +2407,25 @@ func (x *Baz) GetSetField() SetWithAdapter { return x.SetField } -func (x *Baz) GetMapFieldNonCompat() map[string]ListWithElemAdapterWithAdapter_2312 { +func (x *Baz) GetMapFieldNonCompat() MapString_ListWithElemAdapterWithAdapter_8454 { return x.MapField } -func (x *Baz) GetMapField() map[string]ListWithElemAdapterWithAdapter_2312 { +func (x *Baz) GetMapField() MapString_ListWithElemAdapterWithAdapter_8454 { if !x.IsSetMapField() { - return make(map[string]ListWithElemAdapterWithAdapter_2312) + return NewMapString_ListWithElemAdapterWithAdapter_8454() } return x.MapField } -func (x *Baz) GetBinaryFieldNonCompat() []byte { +func (x *Baz) GetBinaryFieldNonCompat() Binary_5673 { return x.BinaryField } -func (x *Baz) GetBinaryField() []byte { +func (x *Baz) GetBinaryField() Binary_5673 { if !x.IsSetBinaryField() { - return []byte("") + return NewBinary_5673() } return x.BinaryField @@ -2325,12 +2443,12 @@ func (x *Baz) GetLongField() MyI64 { return *x.LongField } -func (x *Baz) SetIntFieldNonCompat(value int32) *Baz { +func (x *Baz) SetIntFieldNonCompat(value I32_5137) *Baz { x.IntField = &value return x } -func (x *Baz) SetIntField(value *int32) *Baz { +func (x *Baz) SetIntField(value *I32_5137) *Baz { x.IntField = value return x } @@ -2345,22 +2463,22 @@ func (x *Baz) SetSetField(value SetWithAdapter) *Baz { return x } -func (x *Baz) SetMapFieldNonCompat(value map[string]ListWithElemAdapterWithAdapter_2312) *Baz { +func (x *Baz) SetMapFieldNonCompat(value MapString_ListWithElemAdapterWithAdapter_8454) *Baz { x.MapField = value return x } -func (x *Baz) SetMapField(value map[string]ListWithElemAdapterWithAdapter_2312) *Baz { +func (x *Baz) SetMapField(value MapString_ListWithElemAdapterWithAdapter_8454) *Baz { x.MapField = value return x } -func (x *Baz) SetBinaryFieldNonCompat(value []byte) *Baz { +func (x *Baz) SetBinaryFieldNonCompat(value Binary_5673) *Baz { x.BinaryField = value return x } -func (x *Baz) SetBinaryField(value []byte) *Baz { +func (x *Baz) SetBinaryField(value Binary_5673) *Baz { x.BinaryField = value return x } @@ -2405,7 +2523,8 @@ func (x *Baz) writeField1(p thrift.Protocol) error { // IntField } item := *x.GetIntFieldNonCompat() - if err := p.WriteI32(item); err != nil { + err := WriteI32_5137(item, p) +if err != nil { return err } @@ -2446,28 +2565,10 @@ func (x *Baz) writeField6(p thrift.Protocol) error { // MapField } item := x.GetMapFieldNonCompat() - if err := p.WriteMapBegin(thrift.STRING, thrift.LIST, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteString(item); err != nil { - return err -} - } - - { - item := v - err := WriteListWithElemAdapterWithAdapter_2312(item, p) + err := WriteMapString_ListWithElemAdapterWithAdapter_8454(item, p) if err != nil { return err } - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -2485,7 +2586,8 @@ func (x *Baz) writeField8(p thrift.Protocol) error { // BinaryField } item := x.GetBinaryFieldNonCompat() - if err := p.WriteBinary(item); err != nil { + err := WriteBinary_5673(item, p) +if err != nil { return err } @@ -2517,7 +2619,7 @@ if err != nil { } func (x *Baz) readField1(p thrift.Protocol) error { // IntField - result, err := p.ReadI32() + result, err := ReadI32_5137(p) if err != nil { return err } @@ -2537,45 +2639,17 @@ if err != nil { } func (x *Baz) readField6(p thrift.Protocol) error { // MapField - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[string]ListWithElemAdapterWithAdapter_2312, size) -for i := 0; i < size; i++ { - var key string - { - result, err := p.ReadString() + result, err := ReadMapString_ListWithElemAdapterWithAdapter_8454(p) if err != nil { return err } - key = result - } - - var value ListWithElemAdapterWithAdapter_2312 - { - result, err := ReadListWithElemAdapterWithAdapter_2312(p) -if err != nil { - return err -} - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult x.SetMapFieldNonCompat(result) return nil } func (x *Baz) readField8(p thrift.Protocol) error { // BinaryField - result, err := p.ReadBinary() + result, err := ReadBinary_5673(p) if err != nil { return err } @@ -2663,7 +2737,7 @@ func NewBazBuilder() *BazBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewBaz().Set().Set() -func (x *BazBuilder) IntField(value *int32) *BazBuilder { +func (x *BazBuilder) IntField(value *I32_5137) *BazBuilder { x.obj.IntField = value return x } @@ -2677,14 +2751,14 @@ func (x *BazBuilder) SetField(value SetWithAdapter) *BazBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewBaz().Set().Set() -func (x *BazBuilder) MapField(value map[string]ListWithElemAdapterWithAdapter_2312) *BazBuilder { +func (x *BazBuilder) MapField(value MapString_ListWithElemAdapterWithAdapter_8454) *BazBuilder { x.obj.MapField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewBaz().Set().Set() -func (x *BazBuilder) BinaryField(value []byte) *BazBuilder { +func (x *BazBuilder) BinaryField(value Binary_5673) *BazBuilder { x.obj.BinaryField = value return x } @@ -2814,12 +2888,12 @@ func (x *Baz) String() string { } type Bar struct { - StructField *Foo `thrift:"structField,1" json:"structField" db:"structField"` - OptionalStructField *Foo `thrift:"optionalStructField,2,optional" json:"optionalStructField,omitempty" db:"optionalStructField"` + StructField *Foo_6868 `thrift:"structField,1" json:"structField" db:"structField"` + OptionalStructField *Foo_3943 `thrift:"optionalStructField,2,optional" json:"optionalStructField,omitempty" db:"optionalStructField"` StructListField []*FooWithAdapter_9317 `thrift:"structListField,3" json:"structListField" db:"structListField"` OptionalStructListField []*FooWithAdapter_9317 `thrift:"optionalStructListField,4,optional" json:"optionalStructListField,omitempty" db:"optionalStructListField"` - UnionField *Baz `thrift:"unionField,5" json:"unionField" db:"unionField"` - OptionalUnionField *Baz `thrift:"optionalUnionField,6,optional" json:"optionalUnionField,omitempty" db:"optionalUnionField"` + UnionField *Baz_7352 `thrift:"unionField,5" json:"unionField" db:"unionField"` + OptionalUnionField *Baz_7352 `thrift:"optionalUnionField,6,optional" json:"optionalUnionField,omitempty" db:"optionalUnionField"` AdaptedStructField *DirectlyAdapted `thrift:"adaptedStructField,7" json:"adaptedStructField" db:"adaptedStructField"` } // Compile time interface enforcer @@ -2827,17 +2901,17 @@ var _ thrift.Struct = &Bar{} func NewBar() *Bar { return (&Bar{}). - SetStructFieldNonCompat(*NewFoo()). + SetStructFieldNonCompat(*NewFoo_6868()). SetStructListFieldNonCompat(make([]*FooWithAdapter_9317, 0)). - SetUnionFieldNonCompat(*NewBaz()). + SetUnionFieldNonCompat(*NewBaz_7352()). SetAdaptedStructFieldNonCompat(*NewDirectlyAdapted()) } -func (x *Bar) GetStructFieldNonCompat() *Foo { +func (x *Bar) GetStructFieldNonCompat() *Foo_6868 { return x.StructField } -func (x *Bar) GetStructField() *Foo { +func (x *Bar) GetStructField() *Foo_6868 { if !x.IsSetStructField() { return nil } @@ -2845,11 +2919,11 @@ func (x *Bar) GetStructField() *Foo { return x.StructField } -func (x *Bar) GetOptionalStructFieldNonCompat() *Foo { +func (x *Bar) GetOptionalStructFieldNonCompat() *Foo_3943 { return x.OptionalStructField } -func (x *Bar) GetOptionalStructField() *Foo { +func (x *Bar) GetOptionalStructField() *Foo_3943 { if !x.IsSetOptionalStructField() { return nil } @@ -2881,11 +2955,11 @@ func (x *Bar) GetOptionalStructListField() []*FooWithAdapter_9317 { return x.OptionalStructListField } -func (x *Bar) GetUnionFieldNonCompat() *Baz { +func (x *Bar) GetUnionFieldNonCompat() *Baz_7352 { return x.UnionField } -func (x *Bar) GetUnionField() *Baz { +func (x *Bar) GetUnionField() *Baz_7352 { if !x.IsSetUnionField() { return nil } @@ -2893,11 +2967,11 @@ func (x *Bar) GetUnionField() *Baz { return x.UnionField } -func (x *Bar) GetOptionalUnionFieldNonCompat() *Baz { +func (x *Bar) GetOptionalUnionFieldNonCompat() *Baz_7352 { return x.OptionalUnionField } -func (x *Bar) GetOptionalUnionField() *Baz { +func (x *Bar) GetOptionalUnionField() *Baz_7352 { if !x.IsSetOptionalUnionField() { return nil } @@ -2917,22 +2991,22 @@ func (x *Bar) GetAdaptedStructField() *DirectlyAdapted { return x.AdaptedStructField } -func (x *Bar) SetStructFieldNonCompat(value Foo) *Bar { +func (x *Bar) SetStructFieldNonCompat(value Foo_6868) *Bar { x.StructField = &value return x } -func (x *Bar) SetStructField(value *Foo) *Bar { +func (x *Bar) SetStructField(value *Foo_6868) *Bar { x.StructField = value return x } -func (x *Bar) SetOptionalStructFieldNonCompat(value Foo) *Bar { +func (x *Bar) SetOptionalStructFieldNonCompat(value Foo_3943) *Bar { x.OptionalStructField = &value return x } -func (x *Bar) SetOptionalStructField(value *Foo) *Bar { +func (x *Bar) SetOptionalStructField(value *Foo_3943) *Bar { x.OptionalStructField = value return x } @@ -2957,22 +3031,22 @@ func (x *Bar) SetOptionalStructListField(value []*FooWithAdapter_9317) *Bar { return x } -func (x *Bar) SetUnionFieldNonCompat(value Baz) *Bar { +func (x *Bar) SetUnionFieldNonCompat(value Baz_7352) *Bar { x.UnionField = &value return x } -func (x *Bar) SetUnionField(value *Baz) *Bar { +func (x *Bar) SetUnionField(value *Baz_7352) *Bar { x.UnionField = value return x } -func (x *Bar) SetOptionalUnionFieldNonCompat(value Baz) *Bar { +func (x *Bar) SetOptionalUnionFieldNonCompat(value Baz_7352) *Bar { x.OptionalUnionField = &value return x } -func (x *Bar) SetOptionalUnionField(value *Baz) *Bar { +func (x *Bar) SetOptionalUnionField(value *Baz_7352) *Bar { x.OptionalUnionField = value return x } @@ -3025,7 +3099,8 @@ func (x *Bar) writeField1(p thrift.Protocol) error { // StructField } item := x.GetStructFieldNonCompat() - if err := item.Write(p); err != nil { + err := WriteFoo_6868(item, p) +if err != nil { return err } @@ -3045,7 +3120,8 @@ func (x *Bar) writeField2(p thrift.Protocol) error { // OptionalStructField } item := x.GetOptionalStructFieldNonCompat() - if err := item.Write(p); err != nil { + err := WriteFoo_3943(item, p) +if err != nil { return err } @@ -3125,7 +3201,8 @@ func (x *Bar) writeField5(p thrift.Protocol) error { // UnionField } item := x.GetUnionFieldNonCompat() - if err := item.Write(p); err != nil { + err := WriteBaz_7352(item, p) +if err != nil { return err } @@ -3145,7 +3222,8 @@ func (x *Bar) writeField6(p thrift.Protocol) error { // OptionalUnionField } item := x.GetOptionalUnionFieldNonCompat() - if err := item.Write(p); err != nil { + err := WriteBaz_7352(item, p) +if err != nil { return err } @@ -3176,8 +3254,7 @@ func (x *Bar) writeField7(p thrift.Protocol) error { // AdaptedStructField } func (x *Bar) readField1(p thrift.Protocol) error { // StructField - result := *NewFoo() -err := result.Read(p) + result, err := ReadFoo_6868(p) if err != nil { return err } @@ -3187,8 +3264,7 @@ if err != nil { } func (x *Bar) readField2(p thrift.Protocol) error { // OptionalStructField - result := *NewFoo() -err := result.Read(p) + result, err := ReadFoo_3943(p) if err != nil { return err } @@ -3254,8 +3330,7 @@ result := listResult } func (x *Bar) readField5(p thrift.Protocol) error { // UnionField - result := *NewBaz() -err := result.Read(p) + result, err := ReadBaz_7352(p) if err != nil { return err } @@ -3265,8 +3340,7 @@ if err != nil { } func (x *Bar) readField6(p thrift.Protocol) error { // OptionalUnionField - result := *NewBaz() -err := result.Read(p) + result, err := ReadBaz_7352(p) if err != nil { return err } @@ -3315,33 +3389,33 @@ func (x *Bar) toString7() string { // AdaptedStructField } // Deprecated: Use NewBar().GetStructField() instead. -func (x *Bar) DefaultGetStructField() *Foo { +func (x *Bar) DefaultGetStructField() *Foo_6868 { if !x.IsSetStructField() { - return NewFoo() + return NewFoo_6868() } return x.StructField } // Deprecated: Use NewBar().GetOptionalStructField() instead. -func (x *Bar) DefaultGetOptionalStructField() *Foo { +func (x *Bar) DefaultGetOptionalStructField() *Foo_3943 { if !x.IsSetOptionalStructField() { - return NewFoo() + return NewFoo_3943() } return x.OptionalStructField } // Deprecated: Use NewBar().GetUnionField() instead. -func (x *Bar) DefaultGetUnionField() *Baz { +func (x *Bar) DefaultGetUnionField() *Baz_7352 { if !x.IsSetUnionField() { - return NewBaz() + return NewBaz_7352() } return x.UnionField } // Deprecated: Use NewBar().GetOptionalUnionField() instead. -func (x *Bar) DefaultGetOptionalUnionField() *Baz { +func (x *Bar) DefaultGetOptionalUnionField() *Baz_7352 { if !x.IsSetOptionalUnionField() { - return NewBaz() + return NewBaz_7352() } return x.OptionalUnionField } @@ -3371,14 +3445,14 @@ func NewBarBuilder() *BarBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewBar().Set().Set() -func (x *BarBuilder) StructField(value *Foo) *BarBuilder { +func (x *BarBuilder) StructField(value *Foo_6868) *BarBuilder { x.obj.StructField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewBar().Set().Set() -func (x *BarBuilder) OptionalStructField(value *Foo) *BarBuilder { +func (x *BarBuilder) OptionalStructField(value *Foo_3943) *BarBuilder { x.obj.OptionalStructField = value return x } @@ -3399,14 +3473,14 @@ func (x *BarBuilder) OptionalStructListField(value []*FooWithAdapter_9317) *BarB // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewBar().Set().Set() -func (x *BarBuilder) UnionField(value *Baz) *BarBuilder { +func (x *BarBuilder) UnionField(value *Baz_7352) *BarBuilder { x.obj.UnionField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewBar().Set().Set() -func (x *BarBuilder) OptionalUnionField(value *Baz) *BarBuilder { +func (x *BarBuilder) OptionalUnionField(value *Baz_7352) *BarBuilder { x.obj.OptionalUnionField = value return x } diff --git a/thrift/compiler/test/fixtures/adapter/gen-hack/module_types.php b/thrift/compiler/test/fixtures/adapter/gen-hack/module_types.php index 930ed18a0af..bad776c050f 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-hack/module_types.php +++ b/thrift/compiler/test/fixtures/adapter/gen-hack/module_types.php @@ -108,6 +108,12 @@ public static function getAllStructuredAnnotations()[write_props]: \TEnumAnnotat type ListWithElemAdapter_withAdapter_2312 = \Adapter2::THackType; type MyI32_4873 = \Adapter1::THackType; type StringWithAdapter_7208 = \Adapter1::THackType; +type Baz_7352 = \facebook\thrift\test\Baz; +type Foo_3943 = \facebook\thrift\test\Foo; +type Foo_6868 = \facebook\thrift\test\Foo; +type binary_5673 = string; +type i32_5137 = int; +type map_string_ListWithElemAdapter_withAdapter_8454 = Map; /** * Original thrift struct:- * MyAnnotation @@ -412,20 +418,20 @@ class Foo implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapish 'adaptedLongField' => \facebook\thrift\test\MyI64, 'doubleAdaptedField' => \facebook\thrift\test\DoubleTypedefI64, ); - const int STRUCTURAL_ID = 5127579417322622320; + const int STRUCTURAL_ID = 7737420440299883894; /** * Original thrift field:- - * 1: i32 intField + * 1: module.i32_5137 intField */ public \Adapter1::THackType $intField; /** * Original thrift field:- - * 2: i32 optionalIntField + * 2: module.i32_5137 optionalIntField */ public ?\Adapter1::THackType $optionalIntField; /** * Original thrift field:- - * 3: i32 intFieldWithDefault + * 3: module.i32_5137 intFieldWithDefault */ public \Adapter1::THackType $intFieldWithDefault; /** @@ -440,17 +446,17 @@ class Foo implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapish public ?\facebook\thrift\test\SetWithAdapter $optionalSetField; /** * Original thrift field:- - * 6: map mapField + * 6: module.map_string_ListWithElemAdapter_withAdapter_8454 mapField */ public \Adapter3::THackType $mapField; /** * Original thrift field:- - * 7: map optionalMapField + * 7: module.map_string_ListWithElemAdapter_withAdapter_8454 optionalMapField */ public ?\Adapter3::THackType $optionalMapField; /** * Original thrift field:- - * 8: binary binaryField + * 8: module.binary_5673 binaryField */ public \Adapter1::THackType $binaryField; /** @@ -520,7 +526,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 1, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "intField", @@ -531,7 +555,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 2, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "optionalIntField", @@ -543,7 +585,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 3, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "intFieldWithDefault", @@ -611,28 +671,28 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 6, "type" => \tmeta_ThriftType::fromShape( shape( - "t_map" => \tmeta_ThriftMapType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "keyType" => \tmeta_ThriftType::fromShape( - shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, - ) - ), - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.map_string_ListWithElemAdapter_withAdapter_8454", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter_2312", + "name" => "module.map_string_ListWithElemAdapter_withAdapter_8454", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + "t_map" => \tmeta_ThriftMapType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter_2312", - "underlyingType" => \tmeta_ThriftType::fromShape( + "keyType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + "valueType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter", + "name" => "module.ListWithElemAdapter_withAdapter_2312", "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( @@ -642,19 +702,28 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter", + "name" => "module.ListWithElemAdapter_withAdapter", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_list" => \tmeta_ThriftListType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.ListWithElemAdapter", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + "t_list" => \tmeta_ThriftListType::fromShape( shape( - "name" => "module.StringWithAdapter", - "underlyingType" => \tmeta_ThriftType::fromShape( + "valueType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.StringWithAdapter", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + ) + ), ) ), ) @@ -697,28 +766,28 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 7, "type" => \tmeta_ThriftType::fromShape( shape( - "t_map" => \tmeta_ThriftMapType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "keyType" => \tmeta_ThriftType::fromShape( - shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, - ) - ), - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.map_string_ListWithElemAdapter_withAdapter_8454", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter_2312", + "name" => "module.map_string_ListWithElemAdapter_withAdapter_8454", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + "t_map" => \tmeta_ThriftMapType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter_2312", - "underlyingType" => \tmeta_ThriftType::fromShape( + "keyType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + "valueType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter", + "name" => "module.ListWithElemAdapter_withAdapter_2312", "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( @@ -728,19 +797,28 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter", + "name" => "module.ListWithElemAdapter_withAdapter", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_list" => \tmeta_ThriftListType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.ListWithElemAdapter", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + "t_list" => \tmeta_ThriftListType::fromShape( shape( - "name" => "module.StringWithAdapter", - "underlyingType" => \tmeta_ThriftType::fromShape( + "valueType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.StringWithAdapter", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + ) + ), ) ), ) @@ -784,7 +862,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 8, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.binary_5673", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.binary_5673", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "binaryField", @@ -1135,7 +1231,7 @@ public function readFromJson(string $jsonText): void { } if (idx($parsed, 'intField') !== null) { - $_tmp0 = (int)HH\FIXME\UNSAFE_CAST($parsed['intField']); + $_tmp0 = (int)HH\FIXME\UNSAFE_CAST($parsed['intField']); if ($_tmp0 > 0x7fffffff) { throw new \TProtocolException("number exceeds limit in field"); } else { @@ -1143,7 +1239,7 @@ public function readFromJson(string $jsonText): void { } } if (idx($parsed, 'optionalIntField') !== null) { - $_tmp1 = (int)HH\FIXME\UNSAFE_CAST($parsed['optionalIntField']); + $_tmp1 = (int)HH\FIXME\UNSAFE_CAST($parsed['optionalIntField']); if ($_tmp1 > 0x7fffffff) { throw new \TProtocolException("number exceeds limit in field"); } else { @@ -1151,7 +1247,7 @@ public function readFromJson(string $jsonText): void { } } if (idx($parsed, 'intFieldWithDefault') !== null) { - $_tmp2 = (int)HH\FIXME\UNSAFE_CAST($parsed['intFieldWithDefault']); + $_tmp2 = (int)HH\FIXME\UNSAFE_CAST($parsed['intFieldWithDefault']); if ($_tmp2 > 0x7fffffff) { throw new \TProtocolException("number exceeds limit in field"); } else { @@ -1179,7 +1275,7 @@ public function readFromJson(string $jsonText): void { $this->optionalSetField = $_container13; } if (idx($parsed, 'mapField') !== null) { - $_json18 = HH\FIXME\UNSAFE_CAST>($parsed['mapField']); + $_json18 = HH\FIXME\UNSAFE_CAST($parsed['mapField']); $_container19 = Map {}; foreach($_json18 as $_key16 => $_value17) { $_value20 = Vector {}; @@ -1196,7 +1292,7 @@ public function readFromJson(string $jsonText): void { $this->mapField = $_container19; } if (idx($parsed, 'optionalMapField') !== null) { - $_json30 = HH\FIXME\UNSAFE_CAST>($parsed['optionalMapField']); + $_json30 = HH\FIXME\UNSAFE_CAST($parsed['optionalMapField']); $_container31 = Map {}; foreach($_json30 as $_key28 => $_value29) { $_value32 = Vector {}; @@ -1213,7 +1309,7 @@ public function readFromJson(string $jsonText): void { $this->optionalMapField = $_container31; } if (idx($parsed, 'binaryField') !== null) { - $this->binaryField = HH\FIXME\UNSAFE_CAST($parsed['binaryField']); + $this->binaryField = HH\FIXME\UNSAFE_CAST($parsed['binaryField']); } if (idx($parsed, 'longField') !== null) { $this->longField = HH\FIXME\UNSAFE_CAST($parsed['longField']); @@ -1227,11 +1323,12 @@ public function readFromJson(string $jsonText): void { } private static function __hackAdapterTypeChecks()[]: void { - \ThriftUtil::requireSameType<\Adapter1::TThriftType, int>(); + \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\binary_5673>(); + \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\i32_5137>(); \ThriftUtil::requireSameType<\Adapter1::TThriftType, string>(); \ThriftUtil::requireSameType<\Adapter2::TThriftType, Set>(); \ThriftUtil::requireSameType<\Adapter2::TThriftType, Vector<\facebook\thrift\test\StringWithAdapter>>(); - \ThriftUtil::requireSameType<\Adapter3::TThriftType, Map>(); + \ThriftUtil::requireSameType<\Adapter3::TThriftType, \facebook\thrift\test\map_string_ListWithElemAdapter_withAdapter_8454>(); } } @@ -1329,10 +1426,10 @@ class Baz implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftUnion<\ ?'binaryField' => ?\Adapter1::THackType, ?'longField' => ?\facebook\thrift\test\MyI64, ); - const int STRUCTURAL_ID = 8924052603013047554; + const int STRUCTURAL_ID = 1906005273047242984; /** * Original thrift field:- - * 1: i32 intField + * 1: module.i32_5137 intField */ public ?\Adapter1::THackType $intField; /** @@ -1342,12 +1439,12 @@ class Baz implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftUnion<\ public ?\facebook\thrift\test\SetWithAdapter $setField; /** * Original thrift field:- - * 6: map mapField + * 6: module.map_string_ListWithElemAdapter_withAdapter_8454 mapField */ public ?\Adapter3::THackType $mapField; /** * Original thrift field:- - * 8: binary binaryField + * 8: module.binary_5673 binaryField */ public ?\Adapter1::THackType $binaryField; /** @@ -1539,7 +1636,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 1, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_5137", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "intField", @@ -1578,28 +1693,28 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 6, "type" => \tmeta_ThriftType::fromShape( shape( - "t_map" => \tmeta_ThriftMapType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "keyType" => \tmeta_ThriftType::fromShape( - shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, - ) - ), - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.map_string_ListWithElemAdapter_withAdapter_8454", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter_2312", + "name" => "module.map_string_ListWithElemAdapter_withAdapter_8454", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + "t_map" => \tmeta_ThriftMapType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter_2312", - "underlyingType" => \tmeta_ThriftType::fromShape( + "keyType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + "valueType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter_withAdapter", + "name" => "module.ListWithElemAdapter_withAdapter_2312", "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( @@ -1609,19 +1724,28 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.ListWithElemAdapter", + "name" => "module.ListWithElemAdapter_withAdapter", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_list" => \tmeta_ThriftListType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.ListWithElemAdapter", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + "t_list" => \tmeta_ThriftListType::fromShape( shape( - "name" => "module.StringWithAdapter", - "underlyingType" => \tmeta_ThriftType::fromShape( + "valueType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.StringWithAdapter", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + ) + ), ) ), ) @@ -1664,7 +1788,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 8, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.binary_5673", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.binary_5673", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "binaryField", @@ -1837,7 +1979,7 @@ public function readFromJson(string $jsonText): void { } if (idx($parsed, 'intField') !== null) { - $_tmp0 = (int)HH\FIXME\UNSAFE_CAST($parsed['intField']); + $_tmp0 = (int)HH\FIXME\UNSAFE_CAST($parsed['intField']); if ($_tmp0 > 0x7fffffff) { throw new \TProtocolException("number exceeds limit in field"); } else { @@ -1857,7 +1999,7 @@ public function readFromJson(string $jsonText): void { $this->_type = \facebook\thrift\test\BazEnum::setField; } if (idx($parsed, 'mapField') !== null) { - $_json10 = HH\FIXME\UNSAFE_CAST>($parsed['mapField']); + $_json10 = HH\FIXME\UNSAFE_CAST($parsed['mapField']); $_container11 = Map {}; foreach($_json10 as $_key8 => $_value9) { $_value12 = Vector {}; @@ -1875,7 +2017,7 @@ public function readFromJson(string $jsonText): void { $this->_type = \facebook\thrift\test\BazEnum::mapField; } if (idx($parsed, 'binaryField') !== null) { - $this->binaryField = HH\FIXME\UNSAFE_CAST($parsed['binaryField']); + $this->binaryField = HH\FIXME\UNSAFE_CAST($parsed['binaryField']); $this->_type = \facebook\thrift\test\BazEnum::binaryField; } if (idx($parsed, 'longField') !== null) { @@ -1885,11 +2027,12 @@ public function readFromJson(string $jsonText): void { } private static function __hackAdapterTypeChecks()[]: void { - \ThriftUtil::requireSameType<\Adapter1::TThriftType, int>(); + \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\binary_5673>(); + \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\i32_5137>(); \ThriftUtil::requireSameType<\Adapter1::TThriftType, string>(); \ThriftUtil::requireSameType<\Adapter2::TThriftType, Set>(); \ThriftUtil::requireSameType<\Adapter2::TThriftType, Vector<\facebook\thrift\test\StringWithAdapter>>(); - \ThriftUtil::requireSameType<\Adapter3::TThriftType, Map>(); + \ThriftUtil::requireSameType<\Adapter3::TThriftType, \facebook\thrift\test\map_string_ListWithElemAdapter_withAdapter_8454>(); } } @@ -1984,15 +2127,15 @@ class Bar implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapish ?'optionalUnionField' => ?\Adapter1::THackType, ?'adaptedStructField' => ?\facebook\thrift\test\DirectlyAdapted::TShape, ); - const int STRUCTURAL_ID = 7938871189708910014; + const int STRUCTURAL_ID = 8821530390027423431; /** * Original thrift field:- - * 1: module.Foo structField + * 1: module.Foo_6868 structField */ public ?\Adapter1::THackType $structField; /** * Original thrift field:- - * 2: module.Foo optionalStructField + * 2: module.Foo_3943 optionalStructField */ public ?\Adapter1::THackType $optionalStructField; /** @@ -2007,12 +2150,12 @@ class Bar implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftShapish public ?Vector<\facebook\thrift\test\FooWithAdapter_9317> $optionalStructListField; /** * Original thrift field:- - * 5: module.Baz unionField + * 5: module.Baz_7352 unionField */ public ?\Adapter1::THackType $unionField; /** * Original thrift field:- - * 6: module.Baz optionalUnionField + * 6: module.Baz_7352 optionalUnionField */ public ?\Adapter1::THackType $optionalUnionField; /** @@ -2066,12 +2209,30 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Foo", + "name" => "module.Foo_6868", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_struct" => \tmeta_ThriftStructType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Foo", + "name" => "module.Foo_6868", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.Foo", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_struct" => \tmeta_ThriftStructType::fromShape( + shape( + "name" => "module.Foo", + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -2090,12 +2251,30 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Foo", + "name" => "module.Foo_3943", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_struct" => \tmeta_ThriftStructType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Foo", + "name" => "module.Foo_3943", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.Foo", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_struct" => \tmeta_ThriftStructType::fromShape( + shape( + "name" => "module.Foo", + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -2234,12 +2413,30 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Baz", + "name" => "module.Baz_7352", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_struct" => \tmeta_ThriftStructType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Baz", + "name" => "module.Baz_7352", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.Baz", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_struct" => \tmeta_ThriftStructType::fromShape( + shape( + "name" => "module.Baz", + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -2258,12 +2455,30 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Baz", + "name" => "module.Baz_7352", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_struct" => \tmeta_ThriftStructType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.Baz", + "name" => "module.Baz_7352", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.Baz", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_struct" => \tmeta_ThriftStructType::fromShape( + shape( + "name" => "module.Baz", + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -2442,13 +2657,13 @@ public function readFromJson(string $jsonText): void { } if (idx($parsed, 'structField') !== null) { - $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['structField'])); + $_tmp0 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['structField'])); $_tmp1 = \facebook\thrift\test\Foo::withDefaultValues(); $_tmp1->readFromJson($_tmp0); $this->structField = $_tmp1; } if (idx($parsed, 'optionalStructField') !== null) { - $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['optionalStructField'])); + $_tmp2 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['optionalStructField'])); $_tmp3 = \facebook\thrift\test\Foo::withDefaultValues(); $_tmp3->readFromJson($_tmp2); $this->optionalStructField = $_tmp3; @@ -2480,13 +2695,13 @@ public function readFromJson(string $jsonText): void { $this->optionalStructListField = $_container16; } if (idx($parsed, 'unionField') !== null) { - $_tmp20 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['unionField'])); + $_tmp20 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['unionField'])); $_tmp21 = \facebook\thrift\test\Baz::withDefaultValues(); $_tmp21->readFromJson($_tmp20); $this->unionField = $_tmp21; } if (idx($parsed, 'optionalUnionField') !== null) { - $_tmp22 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['optionalUnionField'])); + $_tmp22 = \json_encode(HH\FIXME\UNSAFE_CAST($parsed['optionalUnionField'])); $_tmp23 = \facebook\thrift\test\Baz::withDefaultValues(); $_tmp23->readFromJson($_tmp22); $this->optionalUnionField = $_tmp23; @@ -2500,8 +2715,10 @@ public function readFromJson(string $jsonText): void { } private static function __hackAdapterTypeChecks()[]: void { - \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\Baz>(); + \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\Baz_7352>(); \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\Foo>(); + \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\Foo_3943>(); + \ThriftUtil::requireSameType<\Adapter1::TThriftType, \facebook\thrift\test\Foo_6868>(); } } diff --git a/thrift/compiler/test/fixtures/adapter/gen-json/module.json b/thrift/compiler/test/fixtures/adapter/gen-json/module.json index df117186a39..5c6a664f59f 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-json/module.json +++ b/thrift/compiler/test/fixtures/adapter/gen-json/module.json @@ -3,241 +3,241 @@ "thrift_module" : "module", "constants" : { "var1" : { - "lineno" : 232, + "lineno" : 226, "value" : 10, "type_enum" : "I32", "spec_args" : null, "source_range" : { "begin" : { - "line" : 232, + "line" : 226, "column" : 1 }, "end" : { - "line" : 233, + "line" : 227, "column" : 21 } } }, "var2" : { - "lineno" : 235, + "lineno" : 229, "value" : "20", "type_enum" : "STRING", "spec_args" : null, "source_range" : { "begin" : { - "line" : 235, + "line" : 229, "column" : 1 }, "end" : { - "line" : 236, + "line" : 230, "column" : 26 } } }, "var3" : { - "lineno" : 243, + "lineno" : 237, "value" : { "field" : 30, "set_string" : [ "10", "20" ] }, "type_enum" : "STRUCT", "spec_args" : "MyStruct", "source_range" : { "begin" : { - "line" : 243, + "line" : 237, "column" : 1 }, "end" : { - "line" : 244, + "line" : 238, "column" : 71 } } }, "var4" : { - "lineno" : 246, + "lineno" : 240, "value" : 40, "type_enum" : "I32", "spec_args" : null, "source_range" : { "begin" : { - "line" : 246, + "line" : 240, "column" : 1 }, "end" : { - "line" : 247, + "line" : 241, "column" : 21 } } }, "var5" : { - "lineno" : 249, + "lineno" : 243, "value" : "50", "type_enum" : "STRING", "spec_args" : null, "source_range" : { "begin" : { - "line" : 249, + "line" : 243, "column" : 1 }, "end" : { - "line" : 250, + "line" : 244, "column" : 26 } } }, "var6" : { - "lineno" : 252, + "lineno" : 246, "value" : { "field" : 60, "set_string" : [ "30", "40" ] }, "type_enum" : "STRUCT", "spec_args" : "MyStruct", "source_range" : { "begin" : { - "line" : 252, + "line" : 246, "column" : 1 }, "end" : { - "line" : 253, + "line" : 247, "column" : 71 } } }, "timeout" : { - "lineno" : 472, + "lineno" : 466, "value" : 42, "type_enum" : "I32", "spec_args" : null, "source_range" : { "begin" : { - "line" : 472, + "line" : 466, "column" : 1 }, "end" : { - "line" : 473, + "line" : 467, "column" : 24 } } }, "msg" : { - "lineno" : 475, + "lineno" : 469, "value" : "hello, world", "type_enum" : "STRING", "spec_args" : null, "source_range" : { "begin" : { - "line" : 475, + "line" : 469, "column" : 1 }, "end" : { - "line" : 476, + "line" : 470, "column" : 35 } } }, "person" : { - "lineno" : 482, + "lineno" : 476, "value" : { "name" : "DefaultName" }, "type_enum" : "STRUCT", "spec_args" : "Person2", "source_range" : { "begin" : { - "line" : 482, + "line" : 476, "column" : 1 }, "end" : { - "line" : 483, + "line" : 477, "column" : 54 } } }, "timeout_no_transitive" : { - "lineno" : 485, + "lineno" : 479, "value" : 420, "type_enum" : "I32", "spec_args" : null, "source_range" : { "begin" : { - "line" : 485, + "line" : 479, "column" : 1 }, "end" : { - "line" : 486, + "line" : 480, "column" : 39 } } }, "msg_no_transitive" : { - "lineno" : 488, + "lineno" : 482, "value" : "hello, world 2", "type_enum" : "STRING", "spec_args" : null, "source_range" : { "begin" : { - "line" : 488, + "line" : 482, "column" : 1 }, "end" : { - "line" : 489, + "line" : 483, "column" : 51 } } }, "person_no_transitive" : { - "lineno" : 491, + "lineno" : 485, "value" : { "name" : "DefaultName 2" }, "type_enum" : "STRUCT", "spec_args" : "Person2", "source_range" : { "begin" : { - "line" : 491, + "line" : 485, "column" : 1 }, "end" : { - "line" : 492, + "line" : 486, "column" : 70 } } }, "type_adapted" : { - "lineno" : 494, + "lineno" : 488, "value" : true, "type_enum" : "TYPEDEF", "spec_args" : "AdaptedBool", "source_range" : { "begin" : { - "line" : 494, + "line" : 488, "column" : 1 }, "end" : { - "line" : 494, + "line" : 488, "column" : 39 } } }, "nested_adapted" : { - "lineno" : 496, + "lineno" : 490, "value" : { "ptr" : { } }, "type_enum" : "STRUCT", "spec_args" : "MoveOnly", "source_range" : { "begin" : { - "line" : 496, + "line" : 490, "column" : 1 }, "end" : { - "line" : 496, + "line" : 490, "column" : 45 } } }, "container_of_adapted" : { - "lineno" : 498, + "lineno" : 492, "value" : [ 1, 2, 3 ], "type_enum" : "LIST", "spec_args" : { "type_enum" : "TYPEDEF", "spec_args" : "AdaptedByte"} , "source_range" : { "begin" : { - "line" : 498, + "line" : 492, "column" : 1 }, "end" : { - "line" : 498, + "line" : 492, "column" : 58 } } @@ -284,18 +284,18 @@ } }, "ThriftAdaptedEnum" : { - "lineno" : 314, + "lineno" : 308, "constants" : { "Zero" : 0, "One" : 1 }, "source_range" : { "begin" : { - "line" : 314, + "line" : 308, "column" : 1 }, "end" : { - "line" : 317, + "line" : 311, "column" : 2 } } @@ -408,369 +408,429 @@ } }, "FooWithAdapter" : { - "lineno" : 134, + "lineno" : 128, "type_enum" : "STRUCT", "spec_args" : "Foo", "source_range" : { "begin" : { - "line" : 134, + "line" : 128, "column" : 1 }, "end" : { - "line" : 137, + "line" : 131, "column" : 27 } } }, "StructWithAdapter" : { - "lineno" : 200, + "lineno" : 194, "type_enum" : "TYPEDEF", "spec_args" : "Bar", "source_range" : { "begin" : { - "line" : 200, + "line" : 194, "column" : 1 }, "end" : { - "line" : 202, + "line" : 196, "column" : 59 } } }, "UnionWithAdapter" : { - "lineno" : 204, + "lineno" : 198, "type_enum" : "TYPEDEF", "spec_args" : "Baz", "source_range" : { "begin" : { - "line" : 204, + "line" : 198, "column" : 1 }, "end" : { - "line" : 206, + "line" : 200, "column" : 58 } } }, "AdaptedA" : { - "lineno" : 211, + "lineno" : 205, "type_enum" : "STRUCT", "spec_args" : "A", "source_range" : { "begin" : { - "line" : 211, + "line" : 205, "column" : 1 }, "end" : { - "line" : 212, + "line" : 206, "column" : 19 } } }, "DurationMs" : { - "lineno" : 255, + "lineno" : 249, "type_enum" : "I64", "spec_args" : null, "source_range" : { "begin" : { - "line" : 255, + "line" : 249, "column" : 1 }, "end" : { - "line" : 256, + "line" : 250, "column" : 23 } } }, "AdaptedBool" : { - "lineno" : 258, + "lineno" : 252, "type_enum" : "BOOL", "spec_args" : null, "source_range" : { "begin" : { - "line" : 258, + "line" : 252, "column" : 1 }, "end" : { - "line" : 259, + "line" : 253, "column" : 25 } } }, "AdaptedByte" : { - "lineno" : 261, + "lineno" : 255, "type_enum" : "BYTE", "spec_args" : null, "source_range" : { "begin" : { - "line" : 261, + "line" : 255, "column" : 1 }, "end" : { - "line" : 262, + "line" : 256, "column" : 25 } } }, "AdaptedShort" : { - "lineno" : 264, + "lineno" : 258, "type_enum" : "I16", "spec_args" : null, "source_range" : { "begin" : { - "line" : 264, + "line" : 258, "column" : 1 }, "end" : { - "line" : 265, + "line" : 259, "column" : 25 } } }, "AdaptedInteger" : { - "lineno" : 267, + "lineno" : 261, "type_enum" : "I32", "spec_args" : null, "source_range" : { "begin" : { - "line" : 267, + "line" : 261, "column" : 1 }, "end" : { - "line" : 268, + "line" : 262, "column" : 27 } } }, "AdaptedLong" : { - "lineno" : 270, + "lineno" : 264, "type_enum" : "I64", "spec_args" : null, "source_range" : { "begin" : { - "line" : 270, + "line" : 264, "column" : 1 }, "end" : { - "line" : 271, + "line" : 265, "column" : 24 } } }, "AdaptedDouble" : { - "lineno" : 273, + "lineno" : 267, "type_enum" : "DOUBLE", "spec_args" : null, "source_range" : { "begin" : { - "line" : 273, + "line" : 267, "column" : 1 }, "end" : { - "line" : 274, + "line" : 268, "column" : 29 } } }, "AdaptedString" : { - "lineno" : 276, + "lineno" : 270, "type_enum" : "STRING", "spec_args" : null, "source_range" : { "begin" : { - "line" : 276, + "line" : 270, "column" : 1 }, "end" : { - "line" : 277, + "line" : 271, "column" : 29 } } }, "DoubleTypedefBool" : { - "lineno" : 279, + "lineno" : 273, "type_enum" : "TYPEDEF", "spec_args" : "AdaptedBool", "source_range" : { "begin" : { - "line" : 279, + "line" : 273, "column" : 1 }, "end" : { - "line" : 279, + "line" : 273, "column" : 38 } } }, "IOBuf" : { - "lineno" : 281, + "lineno" : 275, "type_enum" : "STRING", "spec_args" : null, "source_range" : { "begin" : { - "line" : 281, + "line" : 275, "column" : 1 }, "end" : { - "line" : 281, + "line" : 275, "column" : 51 } } }, "CustomProtocolType" : { - "lineno" : 282, + "lineno" : 276, "type_enum" : "TYPEDEF", "spec_args" : "IOBuf", "source_range" : { "begin" : { - "line" : 282, + "line" : 276, "column" : 1 }, "end" : { - "line" : 283, + "line" : 277, "column" : 33 } } }, "IndirectionString" : { - "lineno" : 285, + "lineno" : 279, "type_enum" : "STRING", "spec_args" : null, "source_range" : { "begin" : { - "line" : 285, + "line" : 279, "column" : 1 }, "end" : { - "line" : 288, + "line" : 282, "column" : 33 } } }, "AdaptedEnum" : { - "lineno" : 318, + "lineno" : 312, "type_enum" : "ENUM", "spec_args" : "ThriftAdaptedEnum", "source_range" : { "begin" : { - "line" : 318, + "line" : 312, "column" : 1 }, "end" : { - "line" : 321, + "line" : 315, "column" : 38 } } }, "AdaptedTypedef" : { - "lineno" : 370, + "lineno" : 364, "type_enum" : "STRUCT", "spec_args" : "AdaptedStruct", "source_range" : { "begin" : { - "line" : 370, + "line" : 364, "column" : 1 }, "end" : { - "line" : 371, + "line" : 365, "column" : 37 } } }, "TypedefOfDirect" : { - "lineno" : 378, + "lineno" : 372, "type_enum" : "STRUCT", "spec_args" : "DirectlyAdaptedStruct", "source_range" : { "begin" : { - "line" : 378, + "line" : 372, "column" : 1 }, "end" : { - "line" : 378, + "line" : 372, "column" : 46 } } }, "AdaptedCircularAdaptee" : { - "lineno" : 395, + "lineno" : 389, "type_enum" : "STRUCT", "spec_args" : "CircularAdaptee", "source_range" : { "begin" : { - "line" : 395, + "line" : 389, "column" : 1 }, "end" : { - "line" : 399, + "line" : 393, "column" : 47 } } }, "CountingInt" : { - "lineno" : 449, + "lineno" : 443, "type_enum" : "I64", "spec_args" : null, "source_range" : { "begin" : { - "line" : 449, + "line" : 443, "column" : 1 }, "end" : { - "line" : 450, + "line" : 444, "column" : 24 } } }, "FooWithAdapter_9317" : { - "lineno" : 501, + "lineno" : 495, "type_enum" : "TYPEDEF", "spec_args" : "FooWithAdapter", "source_range" : { "begin" : { - "line" : 501, + "line" : 495, "column" : 1 }, "end" : { - "line" : 501, + "line" : 495, "column" : 72 } } }, "ListWithElemAdapter_withAdapter_2312" : { - "lineno" : 502, + "lineno" : 496, "type_enum" : "TYPEDEF", "spec_args" : "ListWithElemAdapter_withAdapter", "source_range" : { "begin" : { - "line" : 502, + "line" : 496, "column" : 1 }, "end" : { - "line" : 504, + "line" : 498, "column" : 39 } } }, "MyI32_4873" : { - "lineno" : 505, + "lineno" : 499, "type_enum" : "TYPEDEF", "spec_args" : "MyI32", "source_range" : { "begin" : { - "line" : 505, + "line" : 499, "column" : 1 }, "end" : { - "line" : 505, + "line" : 499, "column" : 54 } } }, "StringWithAdapter_7208" : { - "lineno" : 506, + "lineno" : 500, "type_enum" : "TYPEDEF", "spec_args" : "StringWithAdapter", + "source_range" : { + "begin" : { + "line" : 500, + "column" : 1 + }, + "end" : { + "line" : 500, + "column" : 78 + } + } + }, + "Baz_7352" : { + "lineno" : 503, + "type_enum" : "TYPEDEF", + "spec_args" : "Baz", + "source_range" : { + "begin" : { + "line" : 503, + "column" : 1 + }, + "end" : { + "line" : 503, + "column" : 50 + } + } + }, + "Foo_3943" : { + "lineno" : 504, + "type_enum" : "TYPEDEF", + "spec_args" : "Foo", + "source_range" : { + "begin" : { + "line" : 504, + "column" : 1 + }, + "end" : { + "line" : 504, + "column" : 50 + } + } + }, + "Foo_6868" : { + "lineno" : 505, + "type_enum" : "TYPEDEF", + "spec_args" : "Foo", + "source_range" : { + "begin" : { + "line" : 505, + "column" : 1 + }, + "end" : { + "line" : 505, + "column" : 52 + } + } + }, + "binary_5673" : { + "lineno" : 506, + "type_enum" : "STRING", + "spec_args" : null, "source_range" : { "begin" : { "line" : 506, @@ -778,7 +838,37 @@ }, "end" : { "line" : 506, - "column" : 78 + "column" : 56 + } + } + }, + "i32_5137" : { + "lineno" : 507, + "type_enum" : "I32", + "spec_args" : null, + "source_range" : { + "begin" : { + "line" : 507, + "column" : 1 + }, + "end" : { + "line" : 507, + "column" : 50 + } + } + }, + "map_string_ListWithElemAdapter_withAdapter_8454" : { + "lineno" : 508, + "type_enum" : "MAP", + "spec_args" : { "key_type" : { "type_enum" : "STRING", "spec_args" : null }, "val_type" : { "type_enum" : "TYPEDEF", "spec_args" : "ListWithElemAdapter_withAdapter_2312"} } , + "source_range" : { + "begin" : { + "line" : 508, + "column" : 1 + }, + "end" : { + "line" : 510, + "column" : 50 } } } @@ -848,7 +938,7 @@ }, "end" : { "line" : 78, - "column" : 48 + "column" : 24 } } }, @@ -863,7 +953,7 @@ }, "end" : { "line" : 82, - "column" : 65 + "column" : 41 } } }, @@ -879,7 +969,7 @@ }, "end" : { "line" : 86, - "column" : 64 + "column" : 40 } } }, @@ -915,7 +1005,7 @@ }, "mapField" : { "type_enum" : "MAP", - "spec_args" : { "key_type" : { "type_enum" : "STRING", "spec_args" : null }, "val_type" : { "type_enum" : "LIST", "spec_args" : { "type_enum" : "TYPEDEF", "spec_args" : "StringWithAdapter"} } } , + "spec_args" : { "key_type" : { "type_enum" : "STRING", "spec_args" : null }, "val_type" : { "type_enum" : "TYPEDEF", "spec_args" : "ListWithElemAdapter_withAdapter_2312"} } , "required" : true, "source_range" : { "begin" : { @@ -923,23 +1013,23 @@ "column" : 3 }, "end" : { - "line" : 94, - "column" : 14 + "line" : 92, + "column" : 63 } } }, "optionalMapField" : { "type_enum" : "MAP", - "spec_args" : { "key_type" : { "type_enum" : "STRING", "spec_args" : null }, "val_type" : { "type_enum" : "LIST", "spec_args" : { "type_enum" : "TYPEDEF", "spec_args" : "StringWithAdapter"} } } , + "spec_args" : { "key_type" : { "type_enum" : "STRING", "spec_args" : null }, "val_type" : { "type_enum" : "TYPEDEF", "spec_args" : "ListWithElemAdapter_withAdapter_2312"} } , "required" : false, "source_range" : { "begin" : { - "line" : 95, + "line" : 93, "column" : 3 }, "end" : { - "line" : 100, - "column" : 22 + "line" : 96, + "column" : 80 } } }, @@ -949,12 +1039,12 @@ "required" : true, "source_range" : { "begin" : { - "line" : 101, + "line" : 97, "column" : 3 }, "end" : { - "line" : 104, - "column" : 54 + "line" : 100, + "column" : 30 } } }, @@ -964,11 +1054,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 105, + "line" : 101, "column" : 3 }, "end" : { - "line" : 105, + "line" : 101, "column" : 22 } } @@ -979,11 +1069,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 106, + "line" : 102, "column" : 3 }, "end" : { - "line" : 109, + "line" : 105, "column" : 30 } } @@ -994,11 +1084,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 110, + "line" : 106, "column" : 3 }, "end" : { - "line" : 110, + "line" : 106, "column" : 43 } } @@ -1010,13 +1100,13 @@ "column" : 1 }, "end" : { - "line" : 113, + "line" : 109, "column" : 2 } } }, "Baz" : { - "lineno" : 115, + "lineno" : 111, "is_exception" : false, "is_union" : true, "fields" : { @@ -1026,12 +1116,12 @@ "required" : true, "source_range" : { "begin" : { - "line" : 116, + "line" : 112, "column" : 3 }, "end" : { - "line" : 119, - "column" : 48 + "line" : 115, + "column" : 24 } } }, @@ -1041,27 +1131,27 @@ "required" : true, "source_range" : { "begin" : { - "line" : 120, + "line" : 116, "column" : 3 }, "end" : { - "line" : 120, + "line" : 116, "column" : 30 } } }, "mapField" : { "type_enum" : "MAP", - "spec_args" : { "key_type" : { "type_enum" : "STRING", "spec_args" : null }, "val_type" : { "type_enum" : "LIST", "spec_args" : { "type_enum" : "TYPEDEF", "spec_args" : "StringWithAdapter"} } } , + "spec_args" : { "key_type" : { "type_enum" : "STRING", "spec_args" : null }, "val_type" : { "type_enum" : "TYPEDEF", "spec_args" : "ListWithElemAdapter_withAdapter_2312"} } , "required" : true, "source_range" : { "begin" : { - "line" : 121, + "line" : 117, "column" : 3 }, "end" : { - "line" : 126, - "column" : 14 + "line" : 120, + "column" : 63 } } }, @@ -1071,12 +1161,12 @@ "required" : true, "source_range" : { "begin" : { - "line" : 127, + "line" : 121, "column" : 3 }, "end" : { - "line" : 130, - "column" : 54 + "line" : 124, + "column" : 30 } } }, @@ -1086,11 +1176,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 131, + "line" : 125, "column" : 3 }, "end" : { - "line" : 131, + "line" : 125, "column" : 22 } } @@ -1098,47 +1188,47 @@ }, "source_range" : { "begin" : { - "line" : 115, + "line" : 111, "column" : 1 }, "end" : { - "line" : 132, + "line" : 126, "column" : 2 } } }, "Bar" : { - "lineno" : 139, + "lineno" : 133, "is_exception" : false, "is_union" : false, "fields" : { "structField" : { - "type_enum" : "TYPEDEF", + "type_enum" : "STRUCT", "spec_args" : "Foo", "required" : true, "source_range" : { "begin" : { - "line" : 140, + "line" : 134, "column" : 3 }, "end" : { - "line" : 142, - "column" : 53 + "line" : 136, + "column" : 27 } } }, "optionalStructField" : { - "type_enum" : "TYPEDEF", + "type_enum" : "STRUCT", "spec_args" : "Foo", "required" : false, "source_range" : { "begin" : { - "line" : 143, + "line" : 137, "column" : 3 }, "end" : { - "line" : 145, - "column" : 68 + "line" : 139, + "column" : 44 } } }, @@ -1148,11 +1238,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 146, + "line" : 140, "column" : 3 }, "end" : { - "line" : 146, + "line" : 140, "column" : 48 } } @@ -1163,42 +1253,42 @@ "required" : false, "source_range" : { "begin" : { - "line" : 147, + "line" : 141, "column" : 3 }, "end" : { - "line" : 147, + "line" : 141, "column" : 65 } } }, "unionField" : { - "type_enum" : "TYPEDEF", + "type_enum" : "STRUCT", "spec_args" : "Baz", "required" : true, "source_range" : { "begin" : { - "line" : 148, + "line" : 142, "column" : 3 }, "end" : { - "line" : 150, - "column" : 50 + "line" : 144, + "column" : 26 } } }, "optionalUnionField" : { - "type_enum" : "TYPEDEF", + "type_enum" : "STRUCT", "spec_args" : "Baz", "required" : false, "source_range" : { "begin" : { - "line" : 151, + "line" : 145, "column" : 3 }, "end" : { - "line" : 153, - "column" : 67 + "line" : 147, + "column" : 43 } } }, @@ -1208,11 +1298,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 154, + "line" : 148, "column" : 3 }, "end" : { - "line" : 154, + "line" : 148, "column" : 41 } } @@ -1220,17 +1310,17 @@ }, "source_range" : { "begin" : { - "line" : 139, + "line" : 133, "column" : 1 }, "end" : { - "line" : 155, + "line" : 149, "column" : 2 } } }, "DirectlyAdapted" : { - "lineno" : 157, + "lineno" : 151, "is_exception" : false, "is_union" : false, "fields" : { @@ -1240,11 +1330,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 163, + "line" : 157, "column" : 3 }, "end" : { - "line" : 163, + "line" : 157, "column" : 16 } } @@ -1252,17 +1342,17 @@ }, "source_range" : { "begin" : { - "line" : 157, + "line" : 151, "column" : 1 }, "end" : { - "line" : 164, + "line" : 158, "column" : 2 } } }, "IndependentDirectlyAdapted" : { - "lineno" : 166, + "lineno" : 160, "is_exception" : false, "is_union" : false, "fields" : { @@ -1272,11 +1362,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 168, + "line" : 162, "column" : 3 }, "end" : { - "line" : 168, + "line" : 162, "column" : 16 } } @@ -1284,17 +1374,17 @@ }, "source_range" : { "begin" : { - "line" : 166, + "line" : 160, "column" : 1 }, "end" : { - "line" : 169, + "line" : 163, "column" : 2 } } }, "StructWithFieldAdapter" : { - "lineno" : 171, + "lineno" : 165, "is_exception" : false, "is_union" : false, "fields" : { @@ -1304,11 +1394,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 172, + "line" : 166, "column" : 3 }, "end" : { - "line" : 175, + "line" : 169, "column" : 16 } } @@ -1319,11 +1409,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 176, + "line" : 170, "column" : 3 }, "end" : { - "line" : 178, + "line" : 172, "column" : 23 } } @@ -1334,11 +1424,11 @@ "required" : false, "source_range" : { "begin" : { - "line" : 179, + "line" : 173, "column" : 3 }, "end" : { - "line" : 182, + "line" : 176, "column" : 36 } } @@ -1349,11 +1439,11 @@ "required" : false, "source_range" : { "begin" : { - "line" : 183, + "line" : 177, "column" : 3 }, "end" : { - "line" : 185, + "line" : 179, "column" : 35 } } @@ -1361,17 +1451,17 @@ }, "source_range" : { "begin" : { - "line" : 171, + "line" : 165, "column" : 1 }, "end" : { - "line" : 186, + "line" : 180, "column" : 2 } } }, "TerseAdaptedFields" : { - "lineno" : 188, + "lineno" : 182, "is_exception" : false, "is_union" : false, "fields" : { @@ -1381,11 +1471,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 189, + "line" : 183, "column" : 3 }, "end" : { - "line" : 191, + "line" : 185, "column" : 20 } } @@ -1396,11 +1486,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 192, + "line" : 186, "column" : 3 }, "end" : { - "line" : 194, + "line" : 188, "column" : 26 } } @@ -1411,11 +1501,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 195, + "line" : 189, "column" : 3 }, "end" : { - "line" : 197, + "line" : 191, "column" : 25 } } @@ -1423,17 +1513,17 @@ }, "source_range" : { "begin" : { - "line" : 188, + "line" : 182, "column" : 1 }, "end" : { - "line" : 198, + "line" : 192, "column" : 2 } } }, "B" : { - "lineno" : 208, + "lineno" : 202, "is_exception" : false, "is_union" : false, "fields" : { @@ -1443,11 +1533,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 209, + "line" : 203, "column" : 3 }, "end" : { - "line" : 209, + "line" : 203, "column" : 17 } } @@ -1455,17 +1545,17 @@ }, "source_range" : { "begin" : { - "line" : 208, + "line" : 202, "column" : 1 }, "end" : { - "line" : 210, + "line" : 204, "column" : 2 } } }, "A" : { - "lineno" : 213, + "lineno" : 207, "is_exception" : false, "is_union" : false, "fields" : { @@ -1473,17 +1563,17 @@ }, "source_range" : { "begin" : { - "line" : 213, + "line" : 207, "column" : 1 }, "end" : { - "line" : 213, + "line" : 207, "column" : 12 } } }, "Config" : { - "lineno" : 224, + "lineno" : 218, "is_exception" : false, "is_union" : false, "fields" : { @@ -1493,11 +1583,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 229, + "line" : 223, "column" : 3 }, "end" : { - "line" : 229, + "line" : 223, "column" : 18 } } @@ -1505,17 +1595,17 @@ }, "source_range" : { "begin" : { - "line" : 224, + "line" : 218, "column" : 1 }, "end" : { - "line" : 230, + "line" : 224, "column" : 2 } } }, "MyStruct" : { - "lineno" : 238, + "lineno" : 232, "is_exception" : false, "is_union" : false, "fields" : { @@ -1525,11 +1615,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 239, + "line" : 233, "column" : 3 }, "end" : { - "line" : 239, + "line" : 233, "column" : 16 } } @@ -1540,11 +1630,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 240, + "line" : 234, "column" : 3 }, "end" : { - "line" : 240, + "line" : 234, "column" : 32 } } @@ -1552,17 +1642,17 @@ }, "source_range" : { "begin" : { - "line" : 238, + "line" : 232, "column" : 1 }, "end" : { - "line" : 241, + "line" : 235, "column" : 2 } } }, "AdaptTestStruct" : { - "lineno" : 290, + "lineno" : 284, "is_exception" : false, "is_union" : false, "fields" : { @@ -1572,11 +1662,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 291, + "line" : 285, "column" : 3 }, "end" : { - "line" : 291, + "line" : 285, "column" : 23 } } @@ -1587,11 +1677,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 292, + "line" : 286, "column" : 3 }, "end" : { - "line" : 292, + "line" : 286, "column" : 32 } } @@ -1602,11 +1692,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 294, + "line" : 288, "column" : 3 }, "end" : { - "line" : 295, + "line" : 289, "column" : 18 } } @@ -1617,11 +1707,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 297, + "line" : 291, "column" : 3 }, "end" : { - "line" : 298, + "line" : 292, "column" : 15 } } @@ -1632,11 +1722,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 299, + "line" : 293, "column" : 3 }, "end" : { - "line" : 299, + "line" : 293, "column" : 18 } } @@ -1647,11 +1737,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 300, + "line" : 294, "column" : 3 }, "end" : { - "line" : 300, + "line" : 294, "column" : 42 } } @@ -1662,11 +1752,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 301, + "line" : 295, "column" : 3 }, "end" : { - "line" : 302, + "line" : 296, "column" : 25 } } @@ -1677,11 +1767,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 304, + "line" : 298, "column" : 3 }, "end" : { - "line" : 305, + "line" : 299, "column" : 38 } } @@ -1692,11 +1782,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 307, + "line" : 301, "column" : 3 }, "end" : { - "line" : 308, + "line" : 302, "column" : 44 } } @@ -1707,11 +1797,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 310, + "line" : 304, "column" : 3 }, "end" : { - "line" : 311, + "line" : 305, "column" : 26 } } @@ -1719,17 +1809,17 @@ }, "source_range" : { "begin" : { - "line" : 290, + "line" : 284, "column" : 1 }, "end" : { - "line" : 312, + "line" : 306, "column" : 2 } } }, "AdaptTemplatedTestStruct" : { - "lineno" : 323, + "lineno" : 317, "is_exception" : false, "is_union" : false, "fields" : { @@ -1739,11 +1829,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 324, + "line" : 318, "column" : 3 }, "end" : { - "line" : 324, + "line" : 318, "column" : 30 } } @@ -1754,11 +1844,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 325, + "line" : 319, "column" : 3 }, "end" : { - "line" : 325, + "line" : 319, "column" : 30 } } @@ -1769,11 +1859,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 326, + "line" : 320, "column" : 3 }, "end" : { - "line" : 326, + "line" : 320, "column" : 32 } } @@ -1784,11 +1874,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 327, + "line" : 321, "column" : 3 }, "end" : { - "line" : 327, + "line" : 321, "column" : 36 } } @@ -1799,11 +1889,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 328, + "line" : 322, "column" : 3 }, "end" : { - "line" : 328, + "line" : 322, "column" : 30 } } @@ -1814,11 +1904,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 329, + "line" : 323, "column" : 3 }, "end" : { - "line" : 329, + "line" : 323, "column" : 34 } } @@ -1829,11 +1919,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 330, + "line" : 324, "column" : 3 }, "end" : { - "line" : 330, + "line" : 324, "column" : 34 } } @@ -1844,11 +1934,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 331, + "line" : 325, "column" : 3 }, "end" : { - "line" : 332, + "line" : 326, "column" : 28 } } @@ -1859,11 +1949,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 333, + "line" : 327, "column" : 3 }, "end" : { - "line" : 334, + "line" : 328, "column" : 26 } } @@ -1874,11 +1964,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 335, + "line" : 329, "column" : 3 }, "end" : { - "line" : 336, + "line" : 330, "column" : 32 } } @@ -1890,11 +1980,11 @@ "default_value" : true, "source_range" : { "begin" : { - "line" : 337, + "line" : 331, "column" : 3 }, "end" : { - "line" : 337, + "line" : 331, "column" : 45 } } @@ -1906,11 +1996,11 @@ "default_value" : 1, "source_range" : { "begin" : { - "line" : 338, + "line" : 332, "column" : 3 }, "end" : { - "line" : 338, + "line" : 332, "column" : 42 } } @@ -1922,11 +2012,11 @@ "default_value" : 2, "source_range" : { "begin" : { - "line" : 339, + "line" : 333, "column" : 3 }, "end" : { - "line" : 339, + "line" : 333, "column" : 44 } } @@ -1938,11 +2028,11 @@ "default_value" : 3, "source_range" : { "begin" : { - "line" : 340, + "line" : 334, "column" : 3 }, "end" : { - "line" : 340, + "line" : 334, "column" : 48 } } @@ -1954,11 +2044,11 @@ "default_value" : 4, "source_range" : { "begin" : { - "line" : 341, + "line" : 335, "column" : 3 }, "end" : { - "line" : 341, + "line" : 335, "column" : 42 } } @@ -1970,11 +2060,11 @@ "default_value" : 5, "source_range" : { "begin" : { - "line" : 342, + "line" : 336, "column" : 3 }, "end" : { - "line" : 342, + "line" : 336, "column" : 46 } } @@ -1986,11 +2076,11 @@ "default_value" : "6", "source_range" : { "begin" : { - "line" : 343, + "line" : 337, "column" : 3 }, "end" : { - "line" : 343, + "line" : 337, "column" : 48 } } @@ -2002,11 +2092,11 @@ "default_value" : 1, "source_range" : { "begin" : { - "line" : 344, + "line" : 338, "column" : 3 }, "end" : { - "line" : 344, + "line" : 338, "column" : 55 } } @@ -2018,11 +2108,11 @@ "default_value" : [ 1 ], "source_range" : { "begin" : { - "line" : 345, + "line" : 339, "column" : 3 }, "end" : { - "line" : 347, + "line" : 341, "column" : 42 } } @@ -2034,11 +2124,11 @@ "default_value" : [ 1 ], "source_range" : { "begin" : { - "line" : 348, + "line" : 342, "column" : 3 }, "end" : { - "line" : 350, + "line" : 344, "column" : 40 } } @@ -2050,11 +2140,11 @@ "default_value" : { "1" : 1 }, "source_range" : { "begin" : { - "line" : 351, + "line" : 345, "column" : 3 }, "end" : { - "line" : 353, + "line" : 347, "column" : 48 } } @@ -2065,11 +2155,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 354, + "line" : 348, "column" : 3 }, "end" : { - "line" : 354, + "line" : 348, "column" : 43 } } @@ -2077,17 +2167,17 @@ }, "source_range" : { "begin" : { - "line" : 323, + "line" : 317, "column" : 1 }, "end" : { - "line" : 355, + "line" : 349, "column" : 2 } } }, "AdaptTemplatedNestedTestStruct" : { - "lineno" : 357, + "lineno" : 351, "is_exception" : false, "is_union" : false, "fields" : { @@ -2097,11 +2187,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 358, + "line" : 352, "column" : 3 }, "end" : { - "line" : 358, + "line" : 352, "column" : 45 } } @@ -2109,17 +2199,17 @@ }, "source_range" : { "begin" : { - "line" : 357, + "line" : 351, "column" : 1 }, "end" : { - "line" : 359, + "line" : 353, "column" : 2 } } }, "AdaptTestUnion" : { - "lineno" : 361, + "lineno" : 355, "is_exception" : false, "is_union" : true, "fields" : { @@ -2129,11 +2219,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 362, + "line" : 356, "column" : 3 }, "end" : { - "line" : 362, + "line" : 356, "column" : 23 } } @@ -2144,11 +2234,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 363, + "line" : 357, "column" : 3 }, "end" : { - "line" : 363, + "line" : 357, "column" : 32 } } @@ -2156,17 +2246,17 @@ }, "source_range" : { "begin" : { - "line" : 361, + "line" : 355, "column" : 1 }, "end" : { - "line" : 364, + "line" : 358, "column" : 38 } } }, "AdaptedStruct" : { - "lineno" : 366, + "lineno" : 360, "is_exception" : false, "is_union" : false, "fields" : { @@ -2176,11 +2266,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 367, + "line" : 361, "column" : 3 }, "end" : { - "line" : 367, + "line" : 361, "column" : 15 } } @@ -2188,17 +2278,17 @@ }, "source_range" : { "begin" : { - "line" : 366, + "line" : 360, "column" : 1 }, "end" : { - "line" : 368, + "line" : 362, "column" : 37 } } }, "DirectlyAdaptedStruct" : { - "lineno" : 373, + "lineno" : 367, "is_exception" : false, "is_union" : false, "fields" : { @@ -2208,11 +2298,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 375, + "line" : 369, "column" : 3 }, "end" : { - "line" : 375, + "line" : 369, "column" : 15 } } @@ -2220,17 +2310,17 @@ }, "source_range" : { "begin" : { - "line" : 373, + "line" : 367, "column" : 1 }, "end" : { - "line" : 376, + "line" : 370, "column" : 2 } } }, "StructFieldAdaptedStruct" : { - "lineno" : 380, + "lineno" : 374, "is_exception" : false, "is_union" : false, "fields" : { @@ -2240,11 +2330,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 381, + "line" : 375, "column" : 3 }, "end" : { - "line" : 382, + "line" : 376, "column" : 34 } } @@ -2255,11 +2345,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 383, + "line" : 377, "column" : 3 }, "end" : { - "line" : 383, + "line" : 377, "column" : 36 } } @@ -2270,11 +2360,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 384, + "line" : 378, "column" : 3 }, "end" : { - "line" : 384, + "line" : 378, "column" : 44 } } @@ -2285,11 +2375,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 385, + "line" : 379, "column" : 3 }, "end" : { - "line" : 385, + "line" : 379, "column" : 39 } } @@ -2297,17 +2387,17 @@ }, "source_range" : { "begin" : { - "line" : 380, + "line" : 374, "column" : 1 }, "end" : { - "line" : 386, + "line" : 380, "column" : 2 } } }, "CircularAdaptee" : { - "lineno" : 388, + "lineno" : 382, "is_exception" : false, "is_union" : false, "fields" : { @@ -2317,11 +2407,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 389, + "line" : 383, "column" : 3 }, "end" : { - "line" : 389, + "line" : 383, "column" : 27 } } @@ -2329,17 +2419,17 @@ }, "source_range" : { "begin" : { - "line" : 388, + "line" : 382, "column" : 1 }, "end" : { - "line" : 390, + "line" : 384, "column" : 2 } } }, "CircularStruct" : { - "lineno" : 391, + "lineno" : 385, "is_exception" : false, "is_union" : false, "fields" : { @@ -2349,11 +2439,11 @@ "required" : false, "source_range" : { "begin" : { - "line" : 392, + "line" : 386, "column" : 3 }, "end" : { - "line" : 393, + "line" : 387, "column" : 44 } } @@ -2361,17 +2451,17 @@ }, "source_range" : { "begin" : { - "line" : 391, + "line" : 385, "column" : 1 }, "end" : { - "line" : 394, + "line" : 388, "column" : 2 } } }, "ReorderedStruct" : { - "lineno" : 401, + "lineno" : 395, "is_exception" : false, "is_union" : false, "fields" : { @@ -2381,11 +2471,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 402, + "line" : 396, "column" : 3 }, "end" : { - "line" : 403, + "line" : 397, "column" : 54 } } @@ -2393,17 +2483,17 @@ }, "source_range" : { "begin" : { - "line" : 401, + "line" : 395, "column" : 1 }, "end" : { - "line" : 404, + "line" : 398, "column" : 2 } } }, "DeclaredAfterStruct" : { - "lineno" : 405, + "lineno" : 399, "is_exception" : false, "is_union" : false, "fields" : { @@ -2411,17 +2501,17 @@ }, "source_range" : { "begin" : { - "line" : 405, + "line" : 399, "column" : 1 }, "end" : { - "line" : 408, + "line" : 402, "column" : 30 } } }, "RenamedStruct" : { - "lineno" : 410, + "lineno" : 404, "is_exception" : false, "is_union" : false, "fields" : { @@ -2431,11 +2521,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 415, + "line" : 409, "column" : 3 }, "end" : { - "line" : 415, + "line" : 409, "column" : 15 } } @@ -2443,17 +2533,17 @@ }, "source_range" : { "begin" : { - "line" : 410, + "line" : 404, "column" : 1 }, "end" : { - "line" : 416, + "line" : 410, "column" : 2 } } }, "SameNamespaceStruct" : { - "lineno" : 418, + "lineno" : 412, "is_exception" : false, "is_union" : false, "fields" : { @@ -2463,11 +2553,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 424, + "line" : 418, "column" : 3 }, "end" : { - "line" : 424, + "line" : 418, "column" : 15 } } @@ -2475,17 +2565,17 @@ }, "source_range" : { "begin" : { - "line" : 418, + "line" : 412, "column" : 1 }, "end" : { - "line" : 425, + "line" : 419, "column" : 2 } } }, "HeapAllocated" : { - "lineno" : 427, + "lineno" : 421, "is_exception" : false, "is_union" : false, "fields" : { @@ -2493,17 +2583,17 @@ }, "source_range" : { "begin" : { - "line" : 427, + "line" : 421, "column" : 1 }, "end" : { - "line" : 428, + "line" : 422, "column" : 24 } } }, "MoveOnly" : { - "lineno" : 430, + "lineno" : 424, "is_exception" : false, "is_union" : false, "fields" : { @@ -2513,11 +2603,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 431, + "line" : 425, "column" : 3 }, "end" : { - "line" : 431, + "line" : 425, "column" : 24 } } @@ -2525,17 +2615,17 @@ }, "source_range" : { "begin" : { - "line" : 430, + "line" : 424, "column" : 1 }, "end" : { - "line" : 432, + "line" : 426, "column" : 2 } } }, "AlsoMoveOnly" : { - "lineno" : 434, + "lineno" : 428, "is_exception" : false, "is_union" : false, "fields" : { @@ -2545,11 +2635,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 435, + "line" : 429, "column" : 3 }, "end" : { - "line" : 439, + "line" : 433, "column" : 14 } } @@ -2557,17 +2647,17 @@ }, "source_range" : { "begin" : { - "line" : 434, + "line" : 428, "column" : 1 }, "end" : { - "line" : 440, + "line" : 434, "column" : 2 } } }, "ApplyAdapter" : { - "lineno" : 442, + "lineno" : 436, "is_exception" : false, "is_union" : false, "fields" : { @@ -2575,17 +2665,17 @@ }, "source_range" : { "begin" : { - "line" : 442, + "line" : 436, "column" : 1 }, "end" : { - "line" : 444, + "line" : 438, "column" : 23 } } }, "TransitiveAdapted" : { - "lineno" : 446, + "lineno" : 440, "is_exception" : false, "is_union" : false, "fields" : { @@ -2593,17 +2683,17 @@ }, "source_range" : { "begin" : { - "line" : 446, + "line" : 440, "column" : 1 }, "end" : { - "line" : 447, + "line" : 441, "column" : 28 } } }, "CountingStruct" : { - "lineno" : 451, + "lineno" : 445, "is_exception" : false, "is_union" : false, "fields" : { @@ -2613,11 +2703,11 @@ "required" : false, "source_range" : { "begin" : { - "line" : 452, + "line" : 446, "column" : 3 }, "end" : { - "line" : 453, + "line" : 447, "column" : 30 } } @@ -2628,11 +2718,11 @@ "required" : false, "source_range" : { "begin" : { - "line" : 454, + "line" : 448, "column" : 3 }, "end" : { - "line" : 454, + "line" : 448, "column" : 39 } } @@ -2643,11 +2733,11 @@ "required" : false, "source_range" : { "begin" : { - "line" : 455, + "line" : 449, "column" : 3 }, "end" : { - "line" : 458, + "line" : 452, "column" : 36 } } @@ -2655,17 +2745,17 @@ }, "source_range" : { "begin" : { - "line" : 451, + "line" : 445, "column" : 1 }, "end" : { - "line" : 459, + "line" : 453, "column" : 2 } } }, "Person" : { - "lineno" : 466, + "lineno" : 460, "is_exception" : false, "is_union" : false, "fields" : { @@ -2675,11 +2765,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 469, + "line" : 463, "column" : 3 }, "end" : { - "line" : 469, + "line" : 463, "column" : 18 } } @@ -2687,17 +2777,17 @@ }, "source_range" : { "begin" : { - "line" : 466, + "line" : 460, "column" : 1 }, "end" : { - "line" : 470, + "line" : 464, "column" : 2 } } }, "Person2" : { - "lineno" : 478, + "lineno" : 472, "is_exception" : false, "is_union" : false, "fields" : { @@ -2707,11 +2797,11 @@ "required" : true, "source_range" : { "begin" : { - "line" : 479, + "line" : 473, "column" : 3 }, "end" : { - "line" : 479, + "line" : 473, "column" : 18 } } @@ -2719,11 +2809,11 @@ }, "source_range" : { "begin" : { - "line" : 478, + "line" : 472, "column" : 1 }, "end" : { - "line" : 480, + "line" : 474, "column" : 2 } } @@ -2731,7 +2821,7 @@ }, "services" : { "Service" : { - "lineno" : 215, + "lineno" : 209, "functions" : { "Service.func" : { "return_type" : { @@ -2758,11 +2848,11 @@ "throws" : [], "source_range" : { "begin" : { - "line" : 216, + "line" : 210, "column" : 3 }, "end" : { - "line" : 221, + "line" : 215, "column" : 5 } } @@ -2770,18 +2860,18 @@ }, "source_range" : { "begin" : { - "line" : 215, + "line" : 209, "column" : 1 }, "end" : { - "line" : 222, + "line" : 216, "column" : 2 } } }, "AdapterService" : { - "lineno" : 461, + "lineno" : 455, "functions" : { "AdapterService.count" : { "return_type" : { @@ -2792,11 +2882,11 @@ "throws" : [], "source_range" : { "begin" : { - "line" : 462, + "line" : 456, "column" : 3 }, "end" : { - "line" : 462, + "line" : 456, "column" : 26 } } @@ -2816,11 +2906,11 @@ "throws" : [], "source_range" : { "begin" : { - "line" : 463, + "line" : 457, "column" : 3 }, "end" : { - "line" : 463, + "line" : 457, "column" : 52 } } @@ -2828,11 +2918,11 @@ }, "source_range" : { "begin" : { - "line" : 461, + "line" : 455, "column" : 1 }, "end" : { - "line" : 464, + "line" : 458, "column" : 2 } } diff --git a/thrift/compiler/test/fixtures/adapter/gen-py/module/AdapterService.py b/thrift/compiler/test/fixtures/adapter/gen-py/module/AdapterService.py index 23b237b359e..bfb617c0885 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-py/module/AdapterService.py +++ b/thrift/compiler/test/fixtures/adapter/gen-py/module/AdapterService.py @@ -16,7 +16,7 @@ if sys.version_info[0] >= 3: long = int -from .ttypes import UTF8STRINGS, Color, ThriftAdaptedEnum, MyAnnotation, Foo, Baz, Bar, DirectlyAdapted, IndependentDirectlyAdapted, StructWithFieldAdapter, TerseAdaptedFields, B, A, Config, MyStruct, AdaptTestStruct, AdaptTemplatedTestStruct, AdaptTemplatedNestedTestStruct, AdaptTestUnion, AdaptedStruct, DirectlyAdaptedStruct, StructFieldAdaptedStruct, CircularAdaptee, CircularStruct, ReorderedStruct, DeclaredAfterStruct, RenamedStruct, SameNamespaceStruct, HeapAllocated, MoveOnly, AlsoMoveOnly, ApplyAdapter, TransitiveAdapted, CountingStruct, Person, Person2, SetWithAdapter, StringWithAdapter, ListWithElemAdapter, ListWithElemAdapter_withAdapter, MyI64, DoubleTypedefI64, MyI32, FooWithAdapter, StructWithAdapter, UnionWithAdapter, AdaptedA, DurationMs, AdaptedBool, AdaptedByte, AdaptedShort, AdaptedInteger, AdaptedLong, AdaptedDouble, AdaptedString, DoubleTypedefBool, IOBuf, CustomProtocolType, IndirectionString, AdaptedEnum, AdaptedTypedef, TypedefOfDirect, AdaptedCircularAdaptee, CountingInt, FooWithAdapter_9317, ListWithElemAdapter_withAdapter_2312, MyI32_4873, StringWithAdapter_7208 +from .ttypes import UTF8STRINGS, Color, ThriftAdaptedEnum, MyAnnotation, Foo, Baz, Bar, DirectlyAdapted, IndependentDirectlyAdapted, StructWithFieldAdapter, TerseAdaptedFields, B, A, Config, MyStruct, AdaptTestStruct, AdaptTemplatedTestStruct, AdaptTemplatedNestedTestStruct, AdaptTestUnion, AdaptedStruct, DirectlyAdaptedStruct, StructFieldAdaptedStruct, CircularAdaptee, CircularStruct, ReorderedStruct, DeclaredAfterStruct, RenamedStruct, SameNamespaceStruct, HeapAllocated, MoveOnly, AlsoMoveOnly, ApplyAdapter, TransitiveAdapted, CountingStruct, Person, Person2, SetWithAdapter, StringWithAdapter, ListWithElemAdapter, ListWithElemAdapter_withAdapter, MyI64, DoubleTypedefI64, MyI32, FooWithAdapter, StructWithAdapter, UnionWithAdapter, AdaptedA, DurationMs, AdaptedBool, AdaptedByte, AdaptedShort, AdaptedInteger, AdaptedLong, AdaptedDouble, AdaptedString, DoubleTypedefBool, IOBuf, CustomProtocolType, IndirectionString, AdaptedEnum, AdaptedTypedef, TypedefOfDirect, AdaptedCircularAdaptee, CountingInt, FooWithAdapter_9317, ListWithElemAdapter_withAdapter_2312, MyI32_4873, StringWithAdapter_7208, Baz_7352, Foo_3943, Foo_6868, binary_5673, i32_5137, map_string_ListWithElemAdapter_withAdapter_8454 import ::my import my diff --git a/thrift/compiler/test/fixtures/adapter/gen-py/module/Service.py b/thrift/compiler/test/fixtures/adapter/gen-py/module/Service.py index f5384fc5211..a8c33169ba5 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-py/module/Service.py +++ b/thrift/compiler/test/fixtures/adapter/gen-py/module/Service.py @@ -16,7 +16,7 @@ if sys.version_info[0] >= 3: long = int -from .ttypes import UTF8STRINGS, Color, ThriftAdaptedEnum, MyAnnotation, Foo, Baz, Bar, DirectlyAdapted, IndependentDirectlyAdapted, StructWithFieldAdapter, TerseAdaptedFields, B, A, Config, MyStruct, AdaptTestStruct, AdaptTemplatedTestStruct, AdaptTemplatedNestedTestStruct, AdaptTestUnion, AdaptedStruct, DirectlyAdaptedStruct, StructFieldAdaptedStruct, CircularAdaptee, CircularStruct, ReorderedStruct, DeclaredAfterStruct, RenamedStruct, SameNamespaceStruct, HeapAllocated, MoveOnly, AlsoMoveOnly, ApplyAdapter, TransitiveAdapted, CountingStruct, Person, Person2, SetWithAdapter, StringWithAdapter, ListWithElemAdapter, ListWithElemAdapter_withAdapter, MyI64, DoubleTypedefI64, MyI32, FooWithAdapter, StructWithAdapter, UnionWithAdapter, AdaptedA, DurationMs, AdaptedBool, AdaptedByte, AdaptedShort, AdaptedInteger, AdaptedLong, AdaptedDouble, AdaptedString, DoubleTypedefBool, IOBuf, CustomProtocolType, IndirectionString, AdaptedEnum, AdaptedTypedef, TypedefOfDirect, AdaptedCircularAdaptee, CountingInt, FooWithAdapter_9317, ListWithElemAdapter_withAdapter_2312, MyI32_4873, StringWithAdapter_7208 +from .ttypes import UTF8STRINGS, Color, ThriftAdaptedEnum, MyAnnotation, Foo, Baz, Bar, DirectlyAdapted, IndependentDirectlyAdapted, StructWithFieldAdapter, TerseAdaptedFields, B, A, Config, MyStruct, AdaptTestStruct, AdaptTemplatedTestStruct, AdaptTemplatedNestedTestStruct, AdaptTestUnion, AdaptedStruct, DirectlyAdaptedStruct, StructFieldAdaptedStruct, CircularAdaptee, CircularStruct, ReorderedStruct, DeclaredAfterStruct, RenamedStruct, SameNamespaceStruct, HeapAllocated, MoveOnly, AlsoMoveOnly, ApplyAdapter, TransitiveAdapted, CountingStruct, Person, Person2, SetWithAdapter, StringWithAdapter, ListWithElemAdapter, ListWithElemAdapter_withAdapter, MyI64, DoubleTypedefI64, MyI32, FooWithAdapter, StructWithAdapter, UnionWithAdapter, AdaptedA, DurationMs, AdaptedBool, AdaptedByte, AdaptedShort, AdaptedInteger, AdaptedLong, AdaptedDouble, AdaptedString, DoubleTypedefBool, IOBuf, CustomProtocolType, IndirectionString, AdaptedEnum, AdaptedTypedef, TypedefOfDirect, AdaptedCircularAdaptee, CountingInt, FooWithAdapter_9317, ListWithElemAdapter_withAdapter_2312, MyI32_4873, StringWithAdapter_7208, Baz_7352, Foo_3943, Foo_6868, binary_5673, i32_5137, map_string_ListWithElemAdapter_withAdapter_8454 import ::my import my diff --git a/thrift/compiler/test/fixtures/adapter/gen-py/module/constants.py b/thrift/compiler/test/fixtures/adapter/gen-py/module/constants.py index 97cb5d3cab3..06346a55467 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-py/module/constants.py +++ b/thrift/compiler/test/fixtures/adapter/gen-py/module/constants.py @@ -20,7 +20,7 @@ import my -from .ttypes import UTF8STRINGS, Color, ThriftAdaptedEnum, MyAnnotation, Foo, Baz, Bar, DirectlyAdapted, IndependentDirectlyAdapted, StructWithFieldAdapter, TerseAdaptedFields, B, A, Config, MyStruct, AdaptTestStruct, AdaptTemplatedTestStruct, AdaptTemplatedNestedTestStruct, AdaptTestUnion, AdaptedStruct, DirectlyAdaptedStruct, StructFieldAdaptedStruct, CircularAdaptee, CircularStruct, ReorderedStruct, DeclaredAfterStruct, RenamedStruct, SameNamespaceStruct, HeapAllocated, MoveOnly, AlsoMoveOnly, ApplyAdapter, TransitiveAdapted, CountingStruct, Person, Person2, SetWithAdapter, StringWithAdapter, ListWithElemAdapter, ListWithElemAdapter_withAdapter, MyI64, DoubleTypedefI64, MyI32, FooWithAdapter, StructWithAdapter, UnionWithAdapter, AdaptedA, DurationMs, AdaptedBool, AdaptedByte, AdaptedShort, AdaptedInteger, AdaptedLong, AdaptedDouble, AdaptedString, DoubleTypedefBool, IOBuf, CustomProtocolType, IndirectionString, AdaptedEnum, AdaptedTypedef, TypedefOfDirect, AdaptedCircularAdaptee, CountingInt, FooWithAdapter_9317, ListWithElemAdapter_withAdapter_2312, MyI32_4873, StringWithAdapter_7208 +from .ttypes import UTF8STRINGS, Color, ThriftAdaptedEnum, MyAnnotation, Foo, Baz, Bar, DirectlyAdapted, IndependentDirectlyAdapted, StructWithFieldAdapter, TerseAdaptedFields, B, A, Config, MyStruct, AdaptTestStruct, AdaptTemplatedTestStruct, AdaptTemplatedNestedTestStruct, AdaptTestUnion, AdaptedStruct, DirectlyAdaptedStruct, StructFieldAdaptedStruct, CircularAdaptee, CircularStruct, ReorderedStruct, DeclaredAfterStruct, RenamedStruct, SameNamespaceStruct, HeapAllocated, MoveOnly, AlsoMoveOnly, ApplyAdapter, TransitiveAdapted, CountingStruct, Person, Person2, SetWithAdapter, StringWithAdapter, ListWithElemAdapter, ListWithElemAdapter_withAdapter, MyI64, DoubleTypedefI64, MyI32, FooWithAdapter, StructWithAdapter, UnionWithAdapter, AdaptedA, DurationMs, AdaptedBool, AdaptedByte, AdaptedShort, AdaptedInteger, AdaptedLong, AdaptedDouble, AdaptedString, DoubleTypedefBool, IOBuf, CustomProtocolType, IndirectionString, AdaptedEnum, AdaptedTypedef, TypedefOfDirect, AdaptedCircularAdaptee, CountingInt, FooWithAdapter_9317, ListWithElemAdapter_withAdapter_2312, MyI32_4873, StringWithAdapter_7208, Baz_7352, Foo_3943, Foo_6868, binary_5673, i32_5137, map_string_ListWithElemAdapter_withAdapter_8454 var1 = 10 diff --git a/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.py b/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.py index 354e9455907..c3a833068e3 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.py +++ b/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.py @@ -47,7 +47,7 @@ def __EXPAND_THRIFT_SPEC(spec): all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 -__all__ = ['UTF8STRINGS', 'Color', 'ThriftAdaptedEnum', 'MyAnnotation', 'Foo', 'Baz', 'Bar', 'DirectlyAdapted', 'IndependentDirectlyAdapted', 'StructWithFieldAdapter', 'TerseAdaptedFields', 'B', 'A', 'Config', 'MyStruct', 'AdaptTestStruct', 'AdaptTemplatedTestStruct', 'AdaptTemplatedNestedTestStruct', 'AdaptTestUnion', 'AdaptedStruct', 'DirectlyAdaptedStruct', 'StructFieldAdaptedStruct', 'CircularAdaptee', 'CircularStruct', 'ReorderedStruct', 'DeclaredAfterStruct', 'RenamedStruct', 'SameNamespaceStruct', 'HeapAllocated', 'MoveOnly', 'AlsoMoveOnly', 'ApplyAdapter', 'TransitiveAdapted', 'CountingStruct', 'Person', 'Person2', 'SetWithAdapter', 'StringWithAdapter', 'ListWithElemAdapter', 'ListWithElemAdapter_withAdapter', 'MyI64', 'DoubleTypedefI64', 'MyI32', 'FooWithAdapter', 'StructWithAdapter', 'UnionWithAdapter', 'AdaptedA', 'DurationMs', 'AdaptedBool', 'AdaptedByte', 'AdaptedShort', 'AdaptedInteger', 'AdaptedLong', 'AdaptedDouble', 'AdaptedString', 'DoubleTypedefBool', 'IOBuf', 'CustomProtocolType', 'IndirectionString', 'AdaptedEnum', 'AdaptedTypedef', 'TypedefOfDirect', 'AdaptedCircularAdaptee', 'CountingInt', 'FooWithAdapter_9317', 'ListWithElemAdapter_withAdapter_2312', 'MyI32_4873', 'StringWithAdapter_7208'] +__all__ = ['UTF8STRINGS', 'Color', 'ThriftAdaptedEnum', 'MyAnnotation', 'Foo', 'Baz', 'Bar', 'DirectlyAdapted', 'IndependentDirectlyAdapted', 'StructWithFieldAdapter', 'TerseAdaptedFields', 'B', 'A', 'Config', 'MyStruct', 'AdaptTestStruct', 'AdaptTemplatedTestStruct', 'AdaptTemplatedNestedTestStruct', 'AdaptTestUnion', 'AdaptedStruct', 'DirectlyAdaptedStruct', 'StructFieldAdaptedStruct', 'CircularAdaptee', 'CircularStruct', 'ReorderedStruct', 'DeclaredAfterStruct', 'RenamedStruct', 'SameNamespaceStruct', 'HeapAllocated', 'MoveOnly', 'AlsoMoveOnly', 'ApplyAdapter', 'TransitiveAdapted', 'CountingStruct', 'Person', 'Person2', 'SetWithAdapter', 'StringWithAdapter', 'ListWithElemAdapter', 'ListWithElemAdapter_withAdapter', 'MyI64', 'DoubleTypedefI64', 'MyI32', 'FooWithAdapter', 'StructWithAdapter', 'UnionWithAdapter', 'AdaptedA', 'DurationMs', 'AdaptedBool', 'AdaptedByte', 'AdaptedShort', 'AdaptedInteger', 'AdaptedLong', 'AdaptedDouble', 'AdaptedString', 'DoubleTypedefBool', 'IOBuf', 'CustomProtocolType', 'IndirectionString', 'AdaptedEnum', 'AdaptedTypedef', 'TypedefOfDirect', 'AdaptedCircularAdaptee', 'CountingInt', 'FooWithAdapter_9317', 'ListWithElemAdapter_withAdapter_2312', 'MyI32_4873', 'StringWithAdapter_7208', 'Baz_7352', 'Foo_3943', 'Foo_6868', 'binary_5673', 'i32_5137', 'map_string_ListWithElemAdapter_withAdapter_8454'] class Color: UNKNOWN = 0 @@ -5117,6 +5117,12 @@ def _to_py_deprecated(self): ListWithElemAdapter_withAdapter_2312 = ListWithElemAdapter_withAdapter MyI32_4873 = MyI32 StringWithAdapter_7208 = StringWithAdapter +Baz_7352 = my.Adapter1.Type +Foo_3943 = my.Adapter1.Type +Foo_6868 = ::my.Adapter1.Type +binary_5673 = UnimplementedTypedef() +i32_5137 = UnimplementedTypedef() +map_string_ListWithElemAdapter_withAdapter_8454 = UnimplementedTypedef() all_structs.append(MyAnnotation) MyAnnotation.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (1, TType.STRING, 'signature', True, None, 2, ), # 1 @@ -5166,6 +5172,8 @@ def MyAnnotation__setstate__(self, state): def Foo__init__(self, intField=None, optionalIntField=None, intFieldWithDefault=Foo.thrift_spec[3][4], setField=None, optionalSetField=None, mapField=None, optionalMapField=None, binaryField=None, longField=None, adaptedLongField=None, doubleAdaptedField=None,): self.intField = intField self.optionalIntField = optionalIntField + if intFieldWithDefault is self.thrift_spec[3][4]: + intFieldWithDefault = 13 self.intFieldWithDefault = intFieldWithDefault self.setField = setField self.optionalSetField = optionalSetField diff --git a/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.pyi b/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.pyi index 574f3a286df..cdc3cfe0ca5 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.pyi +++ b/thrift/compiler/test/fixtures/adapter/gen-py/module/ttypes.pyi @@ -1478,3 +1478,9 @@ FooWithAdapter_9317 = my.Adapter1.Type ListWithElemAdapter_withAdapter_2312 = __T.List[str] MyI32_4873 = int StringWithAdapter_7208 = str +Baz_7352 = my.Adapter1.Type +Foo_3943 = my.Adapter1.Type +Foo_6868 = ::my.Adapter1.Type +binary_5673 = bytes +i32_5137 = int +map_string_ListWithElemAdapter_withAdapter_8454 = __T.Dict[str, __T.List[str]] diff --git a/thrift/compiler/test/fixtures/adapter/gen-rust/types.rs b/thrift/compiler/test/fixtures/adapter/gen-rust/types.rs index f9c11b183a9..37dea0f629d 100644 --- a/thrift/compiler/test/fixtures/adapter/gen-rust/types.rs +++ b/thrift/compiler/test/fixtures/adapter/gen-rust/types.rs @@ -74,6 +74,18 @@ pub type MyI32_4873 = crate::types::MyI32; pub type StringWithAdapter_7208 = crate::types::StringWithAdapter; +pub type Baz_7352 = crate::types::Baz; + +pub type Foo_3943 = crate::types::Foo; + +pub type Foo_6868 = crate::types::Foo; + +pub type binary_5673 = ::std::vec::Vec<::std::primitive::u8>; + +pub type i32_5137 = ::std::primitive::i32; + +pub type map_string_ListWithElemAdapter_withAdapter_8454 = ::std::collections::BTreeMap<::std::string::String, crate::types::ListWithElemAdapter_withAdapter_2312>; + #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MyAnnotation { pub signature: ::std::string::String, @@ -119,12 +131,12 @@ pub enum Baz { #[derive(Clone, PartialEq)] pub struct Bar { - pub structField: crate::types::Foo, - pub optionalStructField: ::std::option::Option, + pub structField: crate::types::Foo_6868, + pub optionalStructField: ::std::option::Option, pub structListField: <::fbthrift::adapter::ListMapAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType, pub optionalStructListField: ::std::option::Option<<::fbthrift::adapter::ListMapAdapter as ::fbthrift::adapter::ThriftAdapter>::AdaptedType>, - pub unionField: crate::types::Baz, - pub optionalUnionField: ::std::option::Option, + pub unionField: crate::types::Baz_7352, + pub optionalUnionField: ::std::option::Option, pub adaptedStructField: crate::types::DirectlyAdapted, // This field forces `..Default::default()` when instantiating this // struct, to make code future-proof against new fields added later to diff --git a/thrift/compiler/test/fixtures/adapter/src/module.thrift b/thrift/compiler/test/fixtures/adapter/src/module.thrift index e7283086b7d..7ed6e75a961 100644 --- a/thrift/compiler/test/fixtures/adapter/src/module.thrift +++ b/thrift/compiler/test/fixtures/adapter/src/module.thrift @@ -75,33 +75,29 @@ struct Foo { @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} @rust.Adapter{name = "::my::Adapter1"} - 1: i32 (py.adapter = 'my.Adapter1') intField; + 1: i32_5137 intField; @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} @rust.Adapter{name = "::my::Adapter1"} - 2: optional i32 (py.adapter = 'my.Adapter1') optionalIntField; + 2: optional i32_5137 optionalIntField; @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} @rust.Adapter{name = "::my::Adapter1"} - 3: i32 (py.adapter = 'my.Adapter1') intFieldWithDefault = 13; + 3: i32_5137 intFieldWithDefault = 13; 4: SetWithAdapter setField; 5: optional SetWithAdapter optionalSetField; @hack.Adapter{name = '\\Adapter3'} @cpp.Adapter{name = '::my::Adapter3'} @rust.Adapter{name = "::my::Adapter3"} - 6: map ( - py.adapter = 'my.Adapter3', - ) mapField; + 6: map_string_ListWithElemAdapter_withAdapter_8454 mapField; @hack.Adapter{name = '\\Adapter3'} @cpp.Adapter{name = '::my::Adapter3'} @rust.Adapter{name = "::my::Adapter3"} - 7: optional map ( - py.adapter = 'my.Adapter3', - ) optionalMapField; + 7: optional map_string_ListWithElemAdapter_withAdapter_8454 optionalMapField; @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter3'} @rust.Adapter{name = "::my::Adapter3"} - 8: binary (py.adapter = 'my.Adapter1') binaryField; + 8: binary_5673 binaryField; 9: MyI64 longField; @cpp.Adapter{name = "::my::Adapter2"} @python.Adapter{name = "my.Adapter3", typeHint = "my.AdaptedType3[]"} @@ -116,18 +112,16 @@ union Baz { @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} @rust.Adapter{name = "::my::Adapter1"} - 1: i32 (py.adapter = 'my.Adapter1') intField; + 1: i32_5137 intField; 4: SetWithAdapter setField; @hack.Adapter{name = '\\Adapter3'} @cpp.Adapter{name = '::my::Adapter3'} @rust.Adapter{name = "::my::Adapter3"} - 6: map ( - py.adapter = 'my.Adapter3', - ) mapField; + 6: map_string_ListWithElemAdapter_withAdapter_8454 mapField; @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} @rust.Adapter{name = "::my::Adapter1"} - 8: binary (py.adapter = 'my.Adapter1') binaryField; + 8: binary_5673 binaryField; 9: MyI64 longField; } @@ -139,18 +133,18 @@ typedef Foo FooWithAdapter struct Bar { @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1', adaptedType = '::my::Cpp::Type1'} - 1: Foo (py.adapter = '::my.Adapter1') structField; + 1: Foo_6868 structField; @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} - 2: optional Foo (py.adapter = 'my.Adapter1') optionalStructField; + 2: optional Foo_3943 optionalStructField; 3: list structListField; 4: optional list optionalStructListField; @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} - 5: Baz (py.adapter = 'my.Adapter1') unionField; + 5: Baz_7352 unionField; @hack.Adapter{name = '\\Adapter1'} @cpp.Adapter{name = '::my::Adapter1'} - 6: optional Baz (py.adapter = 'my.Adapter1') optionalUnionField; + 6: optional Baz_7352 optionalUnionField; 7: DirectlyAdapted adaptedStructField; } @@ -504,3 +498,13 @@ typedef ListWithElemAdapter_withAdapter ( ) ListWithElemAdapter_withAdapter_2312 typedef MyI32 (py.adapter = "my.Adapter1") MyI32_4873 typedef StringWithAdapter (py.adapter = "my.Adapter2") StringWithAdapter_7208 + +// The following were automatically generated and may benefit from renaming. +typedef Baz (py.adapter = "my.Adapter1") Baz_7352 +typedef Foo (py.adapter = "my.Adapter1") Foo_3943 +typedef Foo (py.adapter = "::my.Adapter1") Foo_6868 +typedef binary (py.adapter = "my.Adapter1") binary_5673 +typedef i32 (py.adapter = "my.Adapter1") i32_5137 +typedef map ( + py.adapter = "my.Adapter3", +) map_string_ListWithElemAdapter_withAdapter_8454 diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_metadata.cpp b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_metadata.cpp index 8f25e1cf15f..cf2ea646034 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_metadata.cpp +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_metadata.cpp @@ -124,7 +124,7 @@ StructMetadata<::cpp2::detail::YourStruct>::gen(ThriftMetadata& metadata) { {5, "annotation_with_trailing_comma", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{}}, {6, "empty_annotations", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{}}, {7, "my_enum", false, std::make_unique>("module.MyEnum"), std::vector{}}, - {8, "cpp_type_annotation", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}}, + {8, "cpp_type_annotation", false, std::make_unique("module.list_string_6884", std::make_unique("module.list_string_6884", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}), std::vector{}), std::vector{}}, {9, "my_union", false, std::make_unique>("module.MyUnion"), std::vector{}}, }}; for (const auto& f : *module_MyStruct_fields) { diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.cpp index 6769bda2789..5ef1b7c097b 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.cpp @@ -398,7 +398,7 @@ YourStruct& YourStruct::operator=(FOLLY_MAYBE_UNUSED YourStruct&& other) noexcep } -YourStruct::YourStruct(apache::thrift::FragileConstructor, ::std::int64_t majorVer__arg, ::std::string package__arg, ::std::string annotation_with_quote__arg, ::std::string class___arg, ::std::string annotation_with_trailing_comma__arg, ::std::string empty_annotations__arg, ::cpp2::YourEnum my_enum__arg, std::deque cpp_type_annotation__arg, ::cpp2::YourUnion my_union__arg) : +YourStruct::YourStruct(apache::thrift::FragileConstructor, ::std::int64_t majorVer__arg, ::std::string package__arg, ::std::string annotation_with_quote__arg, ::std::string class___arg, ::std::string annotation_with_trailing_comma__arg, ::std::string empty_annotations__arg, ::cpp2::YourEnum my_enum__arg, ::cpp2::list_string_6884 cpp_type_annotation__arg, ::cpp2::YourUnion my_union__arg) : __fbthrift_field_majorVer(std::move(majorVer__arg)), __fbthrift_field_package(std::move(package__arg)), __fbthrift_field_annotation_with_quote(std::move(annotation_with_quote__arg)), @@ -449,11 +449,11 @@ bool YourStruct::operator<(FOLLY_MAYBE_UNUSED const YourStruct& rhs) const { return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs); } -const std::deque& YourStruct::get_cpp_type_annotation() const& { +const ::cpp2::list_string_6884& YourStruct::get_cpp_type_annotation() const& { return __fbthrift_field_cpp_type_annotation; } -std::deque YourStruct::get_cpp_type_annotation() && { +::cpp2::list_string_6884 YourStruct::get_cpp_type_annotation() && { return std::move(__fbthrift_field_cpp_type_annotation); } diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.h index 95f23bd25e3..f5c2a33169a 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.h @@ -321,6 +321,7 @@ unsigned long YourUnion::read(Protocol_* iprot) { using YourUnion = ::apache::thrift::adapt_detail::adapted_t<::StaticCast, ::cpp2::detail::YourUnion>; +typedef std::deque list_string_6884; namespace detail { class YourStruct final { @@ -392,7 +393,7 @@ class YourStruct final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - YourStruct(apache::thrift::FragileConstructor, ::std::int64_t majorVer__arg, ::std::string package__arg, ::std::string annotation_with_quote__arg, ::std::string class___arg, ::std::string annotation_with_trailing_comma__arg, ::std::string empty_annotations__arg, ::cpp2::YourEnum my_enum__arg, std::deque cpp_type_annotation__arg, ::cpp2::YourUnion my_union__arg); + YourStruct(apache::thrift::FragileConstructor, ::std::int64_t majorVer__arg, ::std::string package__arg, ::std::string annotation_with_quote__arg, ::std::string class___arg, ::std::string annotation_with_trailing_comma__arg, ::std::string empty_annotations__arg, ::cpp2::YourEnum my_enum__arg, ::cpp2::list_string_6884 cpp_type_annotation__arg, ::cpp2::YourUnion my_union__arg); YourStruct(YourStruct&&) noexcept; YourStruct(const YourStruct& src); @@ -418,7 +419,7 @@ class YourStruct final { private: ::cpp2::YourEnum __fbthrift_field_my_enum; private: - std::deque __fbthrift_field_cpp_type_annotation; + ::cpp2::list_string_6884 __fbthrift_field_cpp_type_annotation; private: ::cpp2::YourUnion __fbthrift_field_my_union; private: @@ -709,42 +710,42 @@ class YourStruct final { return {static_cast(this->__fbthrift_field_my_enum), __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation_ref() const& { return {this->__fbthrift_field_cpp_type_annotation, __isset.at(7), __isset.bit(7)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation_ref() const&& { return {static_cast(this->__fbthrift_field_cpp_type_annotation), __isset.at(7), __isset.bit(7)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation_ref() & { return {this->__fbthrift_field_cpp_type_annotation, __isset.at(7), __isset.bit(7)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation_ref() && { return {static_cast(this->__fbthrift_field_cpp_type_annotation), __isset.at(7), __isset.bit(7)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation() const& { return {this->__fbthrift_field_cpp_type_annotation, __isset.at(7), __isset.bit(7)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation() const&& { return {static_cast(this->__fbthrift_field_cpp_type_annotation), __isset.at(7), __isset.bit(7)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation() & { return {this->__fbthrift_field_cpp_type_annotation, __isset.at(7), __isset.bit(7)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref cpp_type_annotation() && { return {static_cast(this->__fbthrift_field_cpp_type_annotation), __isset.at(7), __isset.bit(7)}; } @@ -883,12 +884,12 @@ class YourStruct final { my_enum_ref() = my_enum_; return __fbthrift_field_my_enum; } - const std::deque& get_cpp_type_annotation() const&; - std::deque get_cpp_type_annotation() &&; + const ::cpp2::list_string_6884& get_cpp_type_annotation() const&; + ::cpp2::list_string_6884 get_cpp_type_annotation() &&; - template > + template [[deprecated("Use `FOO.cpp_type_annotation_ref() = BAR;` instead of `FOO.set_cpp_type_annotation(BAR);`")]] - std::deque& set_cpp_type_annotation(T_YourStruct_cpp_type_annotation_struct_setter&& cpp_type_annotation_) { + ::cpp2::list_string_6884& set_cpp_type_annotation(T_YourStruct_cpp_type_annotation_struct_setter&& cpp_type_annotation_) { cpp_type_annotation_ref() = std::forward(cpp_type_annotation_); return __fbthrift_field_cpp_type_annotation; } diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.tcc b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.tcc index db7c912e9d6..aad0947308f 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.tcc +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_types.tcc @@ -452,8 +452,8 @@ _readField_my_enum: _readField_cpp_type_annotation: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_cpp_type_annotation = std::deque(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, std::deque>::readWithContext(*iprot, this->__fbthrift_field_cpp_type_annotation, _readState); + this->__fbthrift_field_cpp_type_annotation = ::cpp2::list_string_6884(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, ::cpp2::list_string_6884>::readWithContext(*iprot, this->__fbthrift_field_cpp_type_annotation, _readState); _readState.afterSubobject(iprot); } @@ -615,7 +615,7 @@ uint32_t YourStruct::serializedSize(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("cpp_type_annotation", apache::thrift::protocol::T_LIST, 8); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, std::deque>::serializedSize(*prot_, this->__fbthrift_field_cpp_type_annotation); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, ::cpp2::list_string_6884>::serializedSize(*prot_, this->__fbthrift_field_cpp_type_annotation); } { xfer += prot_->serializedFieldSize("my_union", apache::thrift::protocol::T_STRUCT, 9); @@ -659,7 +659,7 @@ uint32_t YourStruct::serializedSizeZC(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("cpp_type_annotation", apache::thrift::protocol::T_LIST, 8); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, std::deque>::serializedSize(*prot_, this->__fbthrift_field_cpp_type_annotation); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, ::cpp2::list_string_6884>::serializedSize(*prot_, this->__fbthrift_field_cpp_type_annotation); } { xfer += prot_->serializedFieldSize("my_union", apache::thrift::protocol::T_STRUCT, 9); @@ -727,7 +727,7 @@ uint32_t YourStruct::write(Protocol_* prot_) const { constexpr int16_t kPrevFieldId = 7; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "cpp_type_annotation", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, std::deque>::write(*prot_, this->__fbthrift_field_cpp_type_annotation); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::string>, ::cpp2::list_string_6884>::write(*prot_, this->__fbthrift_field_cpp_type_annotation); xfer += prot_->writeFieldEnd(); } { diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-go/module/ttypes.go b/thrift/compiler/test/fixtures/basic-annotations/gen-go/module/ttypes.go index 90ff62c3872..a1734ef0179 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-go/module/ttypes.go +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-go/module/ttypes.go @@ -80,6 +80,10 @@ func FantasticStructPtr(v FantasticStruct) *FantasticStruct { return &v } func NewFantasticStruct() *FantasticStruct { return NewMyStruct() } +type ListString_6884 = []string + +func ListString_6884Ptr(v ListString_6884) *ListString_6884 { return &v } + // Attributes: // - Name type MyStructNestedAnnotation struct { diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/metadata.go b/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/metadata.go index 0d51fdfcaea..55a21c0c34a 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/metadata.go +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/metadata.go @@ -24,10 +24,11 @@ var ( metadata.NewThriftEnumType(). SetName("module.MyEnum"), ) - premadeThriftType_list_string = metadata.NewThriftType().SetTList( - metadata.NewThriftListType(). - SetValueType(premadeThriftType_string), - ) + premadeThriftType_module_list_string_6884 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.list_string_6884"). + SetUnderlyingType(premadeThriftType_list_string), + ) premadeThriftType_module_MyUnion = metadata.NewThriftType().SetTUnion( metadata.NewThriftUnionType(). SetName("module.MyUnion"), @@ -36,6 +37,10 @@ var ( metadata.NewThriftStructType(). SetName("module.MyStruct"), ) + premadeThriftType_list_string = metadata.NewThriftType().SetTList( + metadata.NewThriftListType(). + SetValueType(premadeThriftType_string), + ) premadeThriftType_void = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_VOID_TYPE.Ptr(), ) @@ -111,7 +116,7 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(8). SetName("cpp_type_annotation"). SetIsOptional(false). - SetType(premadeThriftType_list_string), + SetType(premadeThriftType_module_list_string_6884), metadata.NewThriftField(). SetId(9). SetName("my_union"). diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/types.go b/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/types.go index fc6a2955370..0a327301bf7 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/types.go +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-go_mstch/module/types.go @@ -70,6 +70,61 @@ if err != nil { return decodeResult, decodeErr } +type ListString_6884 = []string + +func NewListString_6884() ListString_6884 { + return make([]string, 0) +} + +func WriteListString_6884(item ListString_6884, p thrift.Protocol) error { + if err := p.WriteListBegin(thrift.STRING, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteString(item); err != nil { + return err +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + return nil +} + +func ReadListString_6884(p thrift.Protocol) (ListString_6884, error) { + var decodeResult ListString_6884 + decodeErr := func() error { + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([]string, 0, size) +for i := 0; i < size; i++ { + var elem string + { + result, err := p.ReadString() +if err != nil { + return err +} + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + type MyEnum int32 const ( @@ -498,7 +553,7 @@ type MyStruct struct { AnnotationWithTrailingComma string `thrift:"annotation_with_trailing_comma,5" json:"annotation_with_trailing_comma" db:"annotation_with_trailing_comma"` EmptyAnnotations string `thrift:"empty_annotations,6" json:"empty_annotations" db:"empty_annotations"` MyEnum MyEnum `thrift:"my_enum,7" json:"my_enum" db:"my_enum"` - CppTypeAnnotation []string `thrift:"cpp_type_annotation,8" json:"cpp_type_annotation" db:"cpp_type_annotation"` + CppTypeAnnotation ListString_6884 `thrift:"cpp_type_annotation,8" json:"cpp_type_annotation" db:"cpp_type_annotation"` MyUnion *MyUnion `thrift:"my_union,9" json:"my_union" db:"my_union"` } // Compile time interface enforcer @@ -513,7 +568,7 @@ func NewMyStruct() *MyStruct { SetAnnotationWithTrailingCommaNonCompat(""). SetEmptyAnnotationsNonCompat(""). SetMyEnumNonCompat(0). - SetCppTypeAnnotationNonCompat(make([]string, 0)). + SetCppTypeAnnotationNonCompat(NewListString_6884()). SetMyUnionNonCompat(*NewMyUnion()) } @@ -573,13 +628,13 @@ func (x *MyStruct) GetMyEnum() MyEnum { return x.MyEnum } -func (x *MyStruct) GetCppTypeAnnotationNonCompat() []string { +func (x *MyStruct) GetCppTypeAnnotationNonCompat() ListString_6884 { return x.CppTypeAnnotation } -func (x *MyStruct) GetCppTypeAnnotation() []string { +func (x *MyStruct) GetCppTypeAnnotation() ListString_6884 { if !x.IsSetCppTypeAnnotation() { - return make([]string, 0) + return NewListString_6884() } return x.CppTypeAnnotation @@ -667,12 +722,12 @@ func (x *MyStruct) SetMyEnum(value MyEnum) *MyStruct { return x } -func (x *MyStruct) SetCppTypeAnnotationNonCompat(value []string) *MyStruct { +func (x *MyStruct) SetCppTypeAnnotationNonCompat(value ListString_6884) *MyStruct { x.CppTypeAnnotation = value return x } -func (x *MyStruct) SetCppTypeAnnotation(value []string) *MyStruct { +func (x *MyStruct) SetCppTypeAnnotation(value ListString_6884) *MyStruct { x.CppTypeAnnotation = value return x } @@ -813,20 +868,10 @@ func (x *MyStruct) writeField8(p thrift.Protocol) error { // CppTypeAnnotation } item := x.GetCppTypeAnnotationNonCompat() - if err := p.WriteListBegin(thrift.STRING, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteString(item); err != nil { + err := WriteListString_6884(item, p) +if err != nil { return err } - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -926,28 +971,10 @@ result := MyEnum(enumResult) } func (x *MyStruct) readField8(p thrift.Protocol) error { // CppTypeAnnotation - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([]string, 0, size) -for i := 0; i < size; i++ { - var elem string - { - result, err := p.ReadString() + result, err := ReadListString_6884(p) if err != nil { return err } - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult x.SetCppTypeAnnotationNonCompat(result) return nil @@ -1074,7 +1101,7 @@ func (x *MyStructBuilder) MyEnum(value MyEnum) *MyStructBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewMyStruct().Set().Set() -func (x *MyStructBuilder) CppTypeAnnotation(value []string) *MyStructBuilder { +func (x *MyStructBuilder) CppTypeAnnotation(value ListString_6884) *MyStructBuilder { x.obj.CppTypeAnnotation = value return x } diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-hack/module_types.php b/thrift/compiler/test/fixtures/basic-annotations/gen-hack/module_types.php index 4de4899c00e..6705f885d65 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-hack/module_types.php +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-hack/module_types.php @@ -424,7 +424,7 @@ class MyStruct implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftSh ?'my_union' => ?MyUnion::TShape, ... ); - const int STRUCTURAL_ID = 8440300490729065437; + const int STRUCTURAL_ID = 8696670302801378076; /** * Original thrift field:- * 2: i64 major @@ -462,7 +462,7 @@ class MyStruct implements \IThriftSyncStruct, \IThriftStructMetadata, \IThriftSh public ?MyEnum $my_enum; /** * Original thrift field:- - * 8: list cpp_type_annotation + * 8: module.list_string_6884 cpp_type_annotation */ public Vector $cpp_type_annotation; /** @@ -599,11 +599,29 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 8, "type" => tmeta_ThriftType::fromShape( shape( - "t_list" => tmeta_ThriftListType::fromShape( + "t_typedef" => tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => tmeta_ThriftType::fromShape( + "name" => "module.list_string_6884", + "underlyingType" => tmeta_ThriftType::fromShape( shape( - "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + "t_typedef" => tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.list_string_6884", + "underlyingType" => tmeta_ThriftType::fromShape( + shape( + "t_list" => tmeta_ThriftListType::fromShape( + shape( + "valueType" => tmeta_ThriftType::fromShape( + shape( + "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-json/module.json b/thrift/compiler/test/fixtures/basic-annotations/gen-json/module.json index 25df6b6d651..021dd1b6c01 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-json/module.json +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-json/module.json @@ -110,6 +110,21 @@ "column" : 63 } } + }, + "list_string_6884" : { + "lineno" : 121, + "type_enum" : "LIST", + "spec_args" : { "type_enum" : "STRING", "spec_args" : null} , + "source_range" : { + "begin" : { + "line" : 121, + "column" : 1 + }, + "end" : { + "line" : 121, + "column" : 77 + } + } } }, "structs" : { @@ -477,7 +492,7 @@ }, "end" : { "line" : 54, - "column" : 78 + "column" : 43 } } }, diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/BadService.py b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/BadService.py index c4e387a389b..1789f77c821 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/BadService.py +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/BadService.py @@ -16,7 +16,7 @@ if sys.version_info[0] >= 3: long = int -from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct +from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct, list_string_6884 from thrift.Thrift import TProcessor import pprint import warnings diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/FooBarBazService.py b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/FooBarBazService.py index 7d1b652049c..06345e123df 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/FooBarBazService.py +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/FooBarBazService.py @@ -16,7 +16,7 @@ if sys.version_info[0] >= 3: long = int -from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct +from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct, list_string_6884 from thrift.Thrift import TProcessor import pprint import warnings diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyService.py b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyService.py index d49ad2bda17..34d2c72a0a6 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyService.py +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyService.py @@ -16,7 +16,7 @@ if sys.version_info[0] >= 3: long = int -from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct +from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct, list_string_6884 from thrift.Thrift import TProcessor import pprint import warnings diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioChild.py b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioChild.py index 7f3bc2fd8af..89ed7132825 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioChild.py +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioChild.py @@ -17,7 +17,7 @@ long = int import module.MyServicePrioParent -from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct +from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct, list_string_6884 from thrift.Thrift import TProcessor import pprint import warnings diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioParent.py b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioParent.py index e3d17afac30..bccb1213523 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioParent.py +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/MyServicePrioParent.py @@ -16,7 +16,7 @@ if sys.version_info[0] >= 3: long = int -from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct +from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct, list_string_6884 from thrift.Thrift import TProcessor import pprint import warnings diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/constants.py b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/constants.py index b6b1705117e..4e43649e853 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/constants.py +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/constants.py @@ -17,7 +17,7 @@ long = int -from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct +from .ttypes import UTF8STRINGS, MyEnum, MyStructNestedAnnotation, MyUnion, MyException, MyStruct, SecretStruct, AwesomeStruct, FantasticStruct, list_string_6884 myStruct = MyStruct(**{ "major" : 42, diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/ttypes.py b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/ttypes.py index cdf5b847942..75f164f61bf 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/ttypes.py +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py/module/ttypes.py @@ -44,7 +44,7 @@ def __EXPAND_THRIFT_SPEC(spec): all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 -__all__ = ['UTF8STRINGS', 'MyEnum', 'MyStructNestedAnnotation', 'MyUnion', 'MyException', 'MyStruct', 'SecretStruct', 'AwesomeStruct', 'FantasticStruct'] +__all__ = ['UTF8STRINGS', 'MyEnum', 'MyStructNestedAnnotation', 'MyUnion', 'MyException', 'MyStruct', 'SecretStruct', 'AwesomeStruct', 'FantasticStruct', 'list_string_6884'] class MyEnum: MyValue1 = 0 @@ -741,6 +741,7 @@ def _to_py_deprecated(self): AwesomeStruct = MyStruct FantasticStruct = MyStruct +list_string_6884 = UnimplementedTypedef() all_structs.append(MyStructNestedAnnotation) MyStructNestedAnnotation.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (1, TType.STRING, 'name', True, None, 2, ), # 1 diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pxd b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pxd index dcbec9034db..53175454286 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pxd +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pxd @@ -47,6 +47,43 @@ cimport module.types_fields as _fbthrift_types_fields cdef extern from "thrift/compiler/test/fixtures/basic-annotations/src/gen-py3/module/types.h": pass +cdef extern from * nogil: + cdef cppclass std_deque_std_string "std::deque": + ctypedef string value_type + ctypedef size_t size_type + + cppclass iterator: + string& operator*() + iterator operator++() + bint operator==(iterator) + bint operator!=(iterator) + cppclass reverse_iterator: + string& operator*() + iterator operator++() + bint operator==(reverse_iterator) + bint operator!=(reverse_iterator) + cppclass const_iterator(iterator): + pass + cppclass const_reverse_iterator(reverse_iterator): + pass + + std_deque_std_string() except + + std_deque_std_string(std_deque_std_string&) except + + + string& operator[](size_type) + void push_back(string&) except + + size_type size() + iterator begin() + const_iterator const_begin "begin"() + iterator end() + const_iterator const_end "end"() + reverse_iterator rbegin() + const_reverse_iterator const_rbegin "rbegin"() + reverse_iterator rend() + const_reverse_iterator const_rend "rend"() + void clear() + bint empty() + cdef extern from "thrift/compiler/test/fixtures/basic-annotations/src/gen-cpp2/module_metadata.h" namespace "apache::thrift::detail::md": cdef cppclass EnumMetadata[T]: @@ -120,6 +157,13 @@ cdef class SecretStruct(thrift.py3.types.Struct): cdef _fbthrift_create(shared_ptr[cSecretStruct]) +cdef class std_deque_std_string__List__string(thrift.py3.types.List): + cdef shared_ptr[std_deque_std_string] _cpp_obj + @staticmethod + cdef _fbthrift_create(shared_ptr[std_deque_std_string]) + @staticmethod + cdef shared_ptr[std_deque_std_string] _make_instance(object items) except * + cdef extern from "thrift/compiler/test/fixtures/basic-annotations/src/gen-cpp2/module_constants.h" namespace "::cpp2": cdef cMyStruct cmyStruct "::cpp2::module_constants::myStruct"() diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyi b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyi index 5323942a9b7..67e6f9ce12c 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyi +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyi @@ -93,4 +93,23 @@ class SecretStruct(thrift.py3.types.Struct, _typing.Hashable): def _to_py3(self) -> SecretStruct: ... def _to_py_deprecated(self) -> "module.ttypes.SecretStruct": ... # type: ignore +_std_deque_std_string__List__stringT = _typing.TypeVar('_std_deque_std_string__List__stringT', bound=_typing.Sequence[str]) + + +class std_deque_std_string__List__string(_typing.Sequence[str], _typing.Hashable): + def __init__(self, items: _typing.Optional[_typing.Sequence[str]]=None) -> None: ... + def __len__(self) -> int: ... + def __hash__(self) -> int: ... + def __copy__(self) -> _typing.Sequence[str]: ... + @_typing.overload + def __getitem__(self, i: int) -> str: ... + @_typing.overload + def __getitem__(self, s: slice) -> _typing.Sequence[str]: ... + def __add__(self, other: _typing.Sequence[str]) -> 'std_deque_std_string__List__string': ... + def __radd__(self, other: _std_deque_std_string__List__stringT) -> _std_deque_std_string__List__stringT: ... + def __reversed__(self) -> _typing.Iterator[str]: ... + def __iter__(self) -> _typing.Iterator[str]: ... + + myStruct: MyStruct = ... +list_string_6884 = std_deque_std_string__List__string diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyx b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyx index 56ce33ca9c1..a71cb80bdad 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyx +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types.pyx @@ -355,4 +355,84 @@ cdef class SecretStruct(thrift.py3.types.Struct): import thrift.util.converter py_deprecated_types = importlib.import_module("module.ttypes") return thrift.util.converter.to_py_struct(py_deprecated_types.SecretStruct, self) +@__cython.auto_pickle(False) +cdef class std_deque_std_string__List__string(thrift.py3.types.List): + def __init__(self, items=None): + if isinstance(items, std_deque_std_string__List__string): + self._cpp_obj = ( items)._cpp_obj + else: + self._cpp_obj = std_deque_std_string__List__string._make_instance(items) + + @staticmethod + cdef _fbthrift_create(shared_ptr[std_deque_std_string] c_items): + __fbthrift_inst = std_deque_std_string__List__string.__new__(std_deque_std_string__List__string) + __fbthrift_inst._cpp_obj = cmove(c_items) + return __fbthrift_inst + + def __copy__(std_deque_std_string__List__string self): + cdef shared_ptr[std_deque_std_string] cpp_obj = make_shared[std_deque_std_string]( + deref(self._cpp_obj) + ) + return std_deque_std_string__List__string._fbthrift_create(cmove(cpp_obj)) + + def __len__(self): + return deref(self._cpp_obj).size() + + @staticmethod + cdef shared_ptr[std_deque_std_string] _make_instance(object items) except *: + cdef shared_ptr[std_deque_std_string] c_inst = make_shared[std_deque_std_string]() + if items is not None: + if isinstance(items, str): + raise TypeError("If you really want to pass a string into a _typing.Sequence[str] field, explicitly convert it first.") + for item in items: + if not isinstance(item, str): + raise TypeError(f"{item!r} is not of type str") + deref(c_inst).push_back(item.encode('UTF-8')) + return c_inst + + cdef _get_slice(self, slice index_obj): + cdef int start, stop, step + start, stop, step = index_obj.indices(deref(self._cpp_obj).size()) + return std_deque_std_string__List__string._fbthrift_create( + __list_slice[std_deque_std_string](self._cpp_obj, start, stop, step) + ) + + cdef _get_single_item(self, size_t index): + cdef string citem + __list_getitem(self._cpp_obj, index, citem) + return bytes(citem).decode('UTF-8') + + cdef _check_item_type(self, item): + if not self or item is None: + return + if isinstance(item, str): + return item + + def index(self, item, start=0, stop=None): + err = ValueError(f'{item} is not in list') + item = self._check_item_type(item) + if item is None: + raise err + cdef (int, int, int) indices = slice(start, stop).indices(deref(self._cpp_obj).size()) + cdef string citem = item.encode('UTF-8') + cdef __optional[size_t] found = __list_index[std_deque_std_string](self._cpp_obj, indices[0], indices[1], citem) + if not found.has_value(): + raise err + return found.value() + + def count(self, item): + item = self._check_item_type(item) + if item is None: + return 0 + cdef string citem = item.encode('UTF-8') + return __list_count[std_deque_std_string](self._cpp_obj, citem) + + @staticmethod + def __get_reflection__(): + return _types_reflection.get_reflection__std_deque_std_string__List__string() + + +Sequence.register(std_deque_std_string__List__string) + myStruct = MyStruct._fbthrift_create(constant_shared_ptr(cmyStruct())) +list_string_6884 = std_deque_std_string__List__string diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pxd b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pxd index 5f475fc7127..946febcf0b3 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pxd +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pxd @@ -17,3 +17,5 @@ from thrift.py3.reflection cimport ( cdef __StructSpec get_reflection__MyStructNestedAnnotation() cdef __StructSpec get_reflection__SecretStruct() + +cdef __ListSpec get_reflection__std_deque_std_string__List__string() diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pyx b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pyx index c49ce970604..df67a2b6164 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pyx +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-py3/module/types_reflection.pyx @@ -88,3 +88,9 @@ cdef __StructSpec get_reflection__SecretStruct(): ), ) return spec +cdef __ListSpec get_reflection__std_deque_std_string__List__string(): + return __ListSpec._fbthrift_create( + value=str, + kind=__NumberType.NOT_A_NUMBER, + ) + diff --git a/thrift/compiler/test/fixtures/basic-annotations/gen-rust/types.rs b/thrift/compiler/test/fixtures/basic-annotations/gen-rust/types.rs index 65e6bbcaf16..d3c19c48d77 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/gen-rust/types.rs +++ b/thrift/compiler/test/fixtures/basic-annotations/gen-rust/types.rs @@ -14,6 +14,8 @@ pub type AwesomeStruct = crate::types::MyStruct; pub type FantasticStruct = crate::types::MyStruct; +pub type list_string_6884 = ::std::vec::Vec<::std::string::String>; + #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MyStructNestedAnnotation { pub name: ::std::string::String, @@ -66,7 +68,7 @@ pub struct MyStruct { pub annotation_with_trailing_comma: ::std::string::String, pub empty_annotations: ::std::string::String, pub my_enum: crate::types::MyEnum, - pub cpp_type_annotation: ::std::vec::Vec<::std::string::String>, + pub cpp_type_annotation: crate::types::list_string_6884, pub my_union: crate::types::MyUnion, // This field forces `..Default::default()` when instantiating this // struct, to make code future-proof against new fields added later to diff --git a/thrift/compiler/test/fixtures/basic-annotations/src/module.thrift b/thrift/compiler/test/fixtures/basic-annotations/src/module.thrift index 60c441824f7..511c403c435 100644 --- a/thrift/compiler/test/fixtures/basic-annotations/src/module.thrift +++ b/thrift/compiler/test/fixtures/basic-annotations/src/module.thrift @@ -51,7 +51,7 @@ struct MyStruct { 5: string annotation_with_trailing_comma (custom = 'test'); 6: string empty_annotations (); 7: MyEnum my_enum; - 8: list (cpp.type = "std::deque") cpp_type_annotation; + 8: list_string_6884 cpp_type_annotation; 9: MyUnion my_union; } ( cpp.name = "YourStruct", @@ -116,3 +116,6 @@ service FooBarBazService { void bar() (go.name = 'BarNonStructured'); void baz(); } + +// The following were automatically generated and may benefit from renaming. +typedef list (cpp.type = "std::deque") list_string_6884 diff --git a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_metadata.cpp b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_metadata.cpp index 0ee3d61930e..11b84c9d289 100644 --- a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_metadata.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_metadata.cpp @@ -196,7 +196,7 @@ StructMetadata<::cpp2::defaultStruct>::gen(ThriftMetadata& metadata) { {18, "myUnion", false, std::make_unique("module.MyUnion", std::make_unique>("module.MyUnion"), std::vector{}), std::vector{}}, {19, "listUnionDFset", false, std::make_unique(std::make_unique("module.MyUnion", std::make_unique>("module.MyUnion"), std::vector{})), std::vector{}}, {20, "mapNestlistStructDfSet", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(std::make_unique>("module.SimpleStruct"))), std::vector{}}, - {21, "mapJavaTypeDFset", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}}, + {21, "mapJavaTypeDFset", false, std::make_unique("module.map_i64_string_5732", std::make_unique("module.map_i64_string_5732", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}), std::vector{}), std::vector{}}, {22, "emptyMap", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{}}, {23, "enumMapDFset", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique>("module.MyEnum"))), std::vector{}}, }}; @@ -362,10 +362,10 @@ StructMetadata<::cpp2::TypeRemapped>::gen(ThriftMetadata& metadata) { module_TypeRemapped.is_union() = false; static const auto* const module_TypeRemapped_fields = new std::array{{ - {1, "lsMap", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}}, - {2, "ioMap", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique("module.FMap", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE)), std::vector{})), std::vector{}}, - {3, "BigInteger", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}}, - {4, "binaryTestBuffer", false, std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{}}, + {1, "lsMap", false, std::make_unique("module.map_i64_string_5732", std::make_unique("module.map_i64_string_5732", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}), std::vector{}), std::vector{}}, + {2, "ioMap", false, std::make_unique("module.map_i32_FMap_6797", std::make_unique("module.map_i32_FMap_6797", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique("module.FMap", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE)), std::vector{})), std::vector{}), std::vector{}), std::vector{}}, + {3, "BigInteger", false, std::make_unique("module.i32_1194", std::make_unique("module.i32_1194", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}), std::vector{}), std::vector{}}, + {4, "binaryTestBuffer", false, std::make_unique("module.binary_4918", std::make_unique("module.binary_4918", std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{}), std::vector{}), std::vector{}}, }}; for (const auto& f : *module_TypeRemapped_fields) { ::apache::thrift::metadata::ThriftField field; @@ -455,7 +455,7 @@ StructMetadata<::cpp2::complexException>::gen(ThriftMetadata& metadata) { {3, "errorEnum", false, std::make_unique>("module.MyEnum"), std::vector{}}, {4, "unionError", true, std::make_unique>("module.MyUnion"), std::vector{}}, {5, "structError", false, std::make_unique>("module.MyStruct"), std::vector{}}, - {6, "lsMap", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}}, + {6, "lsMap", false, std::make_unique("module.map_i64_string_5732", std::make_unique("module.map_i64_string_5732", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}), std::vector{}), std::vector{}}, }}; for (const auto& f : *module_complexException_fields) { ::apache::thrift::metadata::ThriftField field; @@ -533,7 +533,7 @@ void ExceptionMetadata<::cpp2::complexException>::gen(ThriftMetadata& metadata) {3, "errorEnum", false, std::make_unique>("module.MyEnum"), std::vector{}}, {4, "unionError", true, std::make_unique>("module.MyUnion"), std::vector{}}, {5, "structError", false, std::make_unique>("module.MyStruct"), std::vector{}}, - {6, "lsMap", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}}, + {6, "lsMap", false, std::make_unique("module.map_i64_string_5732", std::make_unique("module.map_i64_string_5732", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{}), std::vector{}), std::vector{}}, }}; for (const auto& f : *module_complexException_fields) { ::apache::thrift::metadata::ThriftField field; diff --git a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.cpp index 400d593bc2c..1ccd7012e4f 100644 --- a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.cpp @@ -861,7 +861,7 @@ defaultStruct::defaultStruct() : ::apache::thrift::detail::make_structured_constant<::cpp2::SimpleStruct>(::apache::thrift::detail::wrap_struct_argument<::apache::thrift::ident::age>(static_cast<::std::int64_t>(12)), ::apache::thrift::detail::wrap_struct_argument<::apache::thrift::ident::name>(apache::thrift::StringTraits::fromStringLiteral("Robin")))}}, {static_cast<::std::int32_t>(5), std::initializer_list<::cpp2::SimpleStruct>{::apache::thrift::detail::make_structured_constant<::cpp2::SimpleStruct>(::apache::thrift::detail::wrap_struct_argument<::apache::thrift::ident::age>(static_cast<::std::int64_t>(12)), ::apache::thrift::detail::wrap_struct_argument<::apache::thrift::ident::name>(apache::thrift::StringTraits::fromStringLiteral("RatMan"))), ::apache::thrift::detail::make_structured_constant<::cpp2::SimpleStruct>(::apache::thrift::detail::wrap_struct_argument<::apache::thrift::ident::age>(static_cast<::std::int64_t>(6)), ::apache::thrift::detail::wrap_struct_argument<::apache::thrift::ident::name>(apache::thrift::StringTraits::fromStringLiteral("Catman")))}}}), - __fbthrift_field_mapJavaTypeDFset(std::initializer_list<::std::map<::std::int64_t, ::std::string>::value_type>{{static_cast<::std::int64_t>(15), apache::thrift::StringTraits::fromStringLiteral("a_value")}, + __fbthrift_field_mapJavaTypeDFset(std::initializer_list<::cpp2::map_i64_string_5732::value_type>{{static_cast<::std::int64_t>(15), apache::thrift::StringTraits::fromStringLiteral("a_value")}, {static_cast<::std::int64_t>(2), apache::thrift::StringTraits::fromStringLiteral("b_value")}}), __fbthrift_field_enumMapDFset(std::initializer_list<::std::map<::std::string, ::std::map<::std::int32_t, ::cpp2::MyEnum>>::value_type>{{apache::thrift::StringTraits::fromStringLiteral("SANDY BRIDGE"), std::initializer_list<::std::map<::std::int32_t, ::cpp2::MyEnum>::value_type>{{static_cast<::std::int32_t>(16), ::cpp2::MyEnum::MyValue1}, {static_cast<::std::int32_t>(144), ::cpp2::MyEnum::MyValue1}}}, @@ -929,7 +929,7 @@ defaultStruct& defaultStruct::operator=(FOLLY_MAYBE_UNUSED defaultStruct&& other } -defaultStruct::defaultStruct(apache::thrift::FragileConstructor, ::std::int64_t myLongDFset__arg, ::std::int64_t myLongDF__arg, ::std::int32_t portDFset__arg, ::std::int32_t portNum__arg, ::std::string myBinaryDFset__arg, ::std::string myBinary__arg, ::std::int8_t myByteDFSet__arg, ::std::int8_t myByte__arg, double myDoubleDFset__arg, double myDoubleDFZero__arg, double myDouble__arg, ::std::map<::std::int32_t, ::std::string> field3__arg, ::std::vector<::cpp2::MyEnum> myList__arg, ::std::set<::std::string> mySet__arg, ::cpp2::SimpleStruct simpleStruct__arg, ::std::vector<::cpp2::SimpleStruct> listStructDFset__arg, ::cpp2::MyUnion myUnion__arg, ::std::vector<::cpp2::MyUnion> listUnionDFset__arg, ::std::map<::std::int32_t, ::std::vector<::cpp2::SimpleStruct>> mapNestlistStructDfSet__arg, ::std::map<::std::int64_t, ::std::string> mapJavaTypeDFset__arg, ::std::map<::std::int64_t, ::std::int32_t> emptyMap__arg, ::std::map<::std::string, ::std::map<::std::int32_t, ::cpp2::MyEnum>> enumMapDFset__arg) : +defaultStruct::defaultStruct(apache::thrift::FragileConstructor, ::std::int64_t myLongDFset__arg, ::std::int64_t myLongDF__arg, ::std::int32_t portDFset__arg, ::std::int32_t portNum__arg, ::std::string myBinaryDFset__arg, ::std::string myBinary__arg, ::std::int8_t myByteDFSet__arg, ::std::int8_t myByte__arg, double myDoubleDFset__arg, double myDoubleDFZero__arg, double myDouble__arg, ::std::map<::std::int32_t, ::std::string> field3__arg, ::std::vector<::cpp2::MyEnum> myList__arg, ::std::set<::std::string> mySet__arg, ::cpp2::SimpleStruct simpleStruct__arg, ::std::vector<::cpp2::SimpleStruct> listStructDFset__arg, ::cpp2::MyUnion myUnion__arg, ::std::vector<::cpp2::MyUnion> listUnionDFset__arg, ::std::map<::std::int32_t, ::std::vector<::cpp2::SimpleStruct>> mapNestlistStructDfSet__arg, ::cpp2::map_i64_string_5732 mapJavaTypeDFset__arg, ::std::map<::std::int64_t, ::std::int32_t> emptyMap__arg, ::std::map<::std::string, ::std::map<::std::int32_t, ::cpp2::MyEnum>> enumMapDFset__arg) : __fbthrift_field_myLongDFset(std::move(myLongDFset__arg)), __fbthrift_field_myLongDF(std::move(myLongDF__arg)), __fbthrift_field_portDFset(std::move(portDFset__arg)), @@ -1083,11 +1083,11 @@ ::std::map<::std::int32_t, ::std::vector<::cpp2::SimpleStruct>> defaultStruct::g return std::move(__fbthrift_field_mapNestlistStructDfSet); } -const ::std::map<::std::int64_t, ::std::string>& defaultStruct::get_mapJavaTypeDFset() const& { +const ::cpp2::map_i64_string_5732& defaultStruct::get_mapJavaTypeDFset() const& { return __fbthrift_field_mapJavaTypeDFset; } -::std::map<::std::int64_t, ::std::string> defaultStruct::get_mapJavaTypeDFset() && { +::cpp2::map_i64_string_5732 defaultStruct::get_mapJavaTypeDFset() && { return std::move(__fbthrift_field_mapJavaTypeDFset); } @@ -2096,7 +2096,7 @@ TypeRemapped& TypeRemapped::operator=(FOLLY_MAYBE_UNUSED TypeRemapped&& other) n } -TypeRemapped::TypeRemapped(apache::thrift::FragileConstructor, ::std::map<::std::int64_t, ::std::string> lsMap__arg, ::std::map<::std::int32_t, ::cpp2::FMap> ioMap__arg, ::std::int32_t BigInteger__arg, ::std::string binaryTestBuffer__arg) : +TypeRemapped::TypeRemapped(apache::thrift::FragileConstructor, ::cpp2::map_i64_string_5732 lsMap__arg, ::cpp2::map_i32_FMap_6797 ioMap__arg, ::cpp2::i32_1194 BigInteger__arg, ::cpp2::binary_4918 binaryTestBuffer__arg) : __fbthrift_field_lsMap(std::move(lsMap__arg)), __fbthrift_field_ioMap(std::move(ioMap__arg)), __fbthrift_field_BigInteger(std::move(BigInteger__arg)), @@ -2112,7 +2112,7 @@ void TypeRemapped::__fbthrift_clear() { // clear all fields this->__fbthrift_field_lsMap.clear(); this->__fbthrift_field_ioMap.clear(); - this->__fbthrift_field_BigInteger = ::std::int32_t(); + this->__fbthrift_field_BigInteger = ::cpp2::i32_1194(); this->__fbthrift_field_binaryTestBuffer = apache::thrift::StringTraits::fromStringLiteral(""); __isset = {}; } @@ -2132,19 +2132,19 @@ bool TypeRemapped::operator<(FOLLY_MAYBE_UNUSED const TypeRemapped& rhs) const { return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs); } -const ::std::map<::std::int64_t, ::std::string>& TypeRemapped::get_lsMap() const& { +const ::cpp2::map_i64_string_5732& TypeRemapped::get_lsMap() const& { return __fbthrift_field_lsMap; } -::std::map<::std::int64_t, ::std::string> TypeRemapped::get_lsMap() && { +::cpp2::map_i64_string_5732 TypeRemapped::get_lsMap() && { return std::move(__fbthrift_field_lsMap); } -const ::std::map<::std::int32_t, ::cpp2::FMap>& TypeRemapped::get_ioMap() const& { +const ::cpp2::map_i32_FMap_6797& TypeRemapped::get_ioMap() const& { return __fbthrift_field_ioMap; } -::std::map<::std::int32_t, ::cpp2::FMap> TypeRemapped::get_ioMap() && { +::cpp2::map_i32_FMap_6797 TypeRemapped::get_ioMap() && { return std::move(__fbthrift_field_ioMap); } @@ -2519,7 +2519,7 @@ complexException& complexException::operator=(FOLLY_MAYBE_UNUSED complexExceptio } -complexException::complexException(apache::thrift::FragileConstructor, ::std::string message__arg, ::std::vector<::std::string> listStrings__arg, ::cpp2::MyEnum errorEnum__arg, ::cpp2::MyUnion unionError__arg, ::cpp2::MyStruct structError__arg, ::std::map<::std::int64_t, ::std::string> lsMap__arg) : +complexException::complexException(apache::thrift::FragileConstructor, ::std::string message__arg, ::std::vector<::std::string> listStrings__arg, ::cpp2::MyEnum errorEnum__arg, ::cpp2::MyUnion unionError__arg, ::cpp2::MyStruct structError__arg, ::cpp2::map_i64_string_5732 lsMap__arg) : __fbthrift_field_message(std::move(message__arg)), __fbthrift_field_listStrings(std::move(listStrings__arg)), __fbthrift_field_errorEnum(std::move(errorEnum__arg)), @@ -2585,11 +2585,11 @@ ::cpp2::MyStruct complexException::get_structError() && { return std::move(__fbthrift_field_structError); } -const ::std::map<::std::int64_t, ::std::string>& complexException::get_lsMap() const& { +const ::cpp2::map_i64_string_5732& complexException::get_lsMap() const& { return __fbthrift_field_lsMap; } -::std::map<::std::int64_t, ::std::string> complexException::get_lsMap() && { +::cpp2::map_i64_string_5732 complexException::get_lsMap() && { return std::move(__fbthrift_field_lsMap); } diff --git a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.h index 102c373e67f..5165f2f0df3 100644 --- a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.h @@ -652,6 +652,10 @@ typedef ::std::map<::std::int16_t, ::std::string> mapTypedef; typedef ::std::vector listTypedef; typedef float floatTypedef; typedef ::std::map<::std::int32_t, ::std::int64_t> FMap; +typedef ::std::string binary_4918; +typedef ::std::int32_t i32_1194; +typedef ::std::map<::std::int32_t, ::cpp2::FMap> map_i32_FMap_6797; +typedef ::std::map<::std::int64_t, ::std::string> map_i64_string_5732; class MyStructFloatFieldThrowExp final { private: @@ -4843,7 +4847,7 @@ class defaultStruct final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - defaultStruct(apache::thrift::FragileConstructor, ::std::int64_t myLongDFset__arg, ::std::int64_t myLongDF__arg, ::std::int32_t portDFset__arg, ::std::int32_t portNum__arg, ::std::string myBinaryDFset__arg, ::std::string myBinary__arg, ::std::int8_t myByteDFSet__arg, ::std::int8_t myByte__arg, double myDoubleDFset__arg, double myDoubleDFZero__arg, double myDouble__arg, ::std::map<::std::int32_t, ::std::string> field3__arg, ::std::vector<::cpp2::MyEnum> myList__arg, ::std::set<::std::string> mySet__arg, ::cpp2::SimpleStruct simpleStruct__arg, ::std::vector<::cpp2::SimpleStruct> listStructDFset__arg, ::cpp2::MyUnion myUnion__arg, ::std::vector<::cpp2::MyUnion> listUnionDFset__arg, ::std::map<::std::int32_t, ::std::vector<::cpp2::SimpleStruct>> mapNestlistStructDfSet__arg, ::std::map<::std::int64_t, ::std::string> mapJavaTypeDFset__arg, ::std::map<::std::int64_t, ::std::int32_t> emptyMap__arg, ::std::map<::std::string, ::std::map<::std::int32_t, ::cpp2::MyEnum>> enumMapDFset__arg); + defaultStruct(apache::thrift::FragileConstructor, ::std::int64_t myLongDFset__arg, ::std::int64_t myLongDF__arg, ::std::int32_t portDFset__arg, ::std::int32_t portNum__arg, ::std::string myBinaryDFset__arg, ::std::string myBinary__arg, ::std::int8_t myByteDFSet__arg, ::std::int8_t myByte__arg, double myDoubleDFset__arg, double myDoubleDFZero__arg, double myDouble__arg, ::std::map<::std::int32_t, ::std::string> field3__arg, ::std::vector<::cpp2::MyEnum> myList__arg, ::std::set<::std::string> mySet__arg, ::cpp2::SimpleStruct simpleStruct__arg, ::std::vector<::cpp2::SimpleStruct> listStructDFset__arg, ::cpp2::MyUnion myUnion__arg, ::std::vector<::cpp2::MyUnion> listUnionDFset__arg, ::std::map<::std::int32_t, ::std::vector<::cpp2::SimpleStruct>> mapNestlistStructDfSet__arg, ::cpp2::map_i64_string_5732 mapJavaTypeDFset__arg, ::std::map<::std::int64_t, ::std::int32_t> emptyMap__arg, ::std::map<::std::string, ::std::map<::std::int32_t, ::cpp2::MyEnum>> enumMapDFset__arg); defaultStruct(defaultStruct&&) noexcept; @@ -4894,7 +4898,7 @@ class defaultStruct final { private: ::std::map<::std::int32_t, ::std::vector<::cpp2::SimpleStruct>> __fbthrift_field_mapNestlistStructDfSet; private: - ::std::map<::std::int64_t, ::std::string> __fbthrift_field_mapJavaTypeDFset; + ::cpp2::map_i64_string_5732 __fbthrift_field_mapJavaTypeDFset; private: ::std::map<::std::int64_t, ::std::int32_t> __fbthrift_field_emptyMap; private: @@ -5667,42 +5671,42 @@ class defaultStruct final { return {static_cast(this->__fbthrift_field_mapNestlistStructDfSet), __isset.at(18), __isset.bit(18)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset_ref() const& { return {this->__fbthrift_field_mapJavaTypeDFset, __isset.at(19), __isset.bit(19)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset_ref() const&& { return {static_cast(this->__fbthrift_field_mapJavaTypeDFset), __isset.at(19), __isset.bit(19)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset_ref() & { return {this->__fbthrift_field_mapJavaTypeDFset, __isset.at(19), __isset.bit(19)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset_ref() && { return {static_cast(this->__fbthrift_field_mapJavaTypeDFset), __isset.at(19), __isset.bit(19)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset() const& { return {this->__fbthrift_field_mapJavaTypeDFset, __isset.at(19), __isset.bit(19)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset() const&& { return {static_cast(this->__fbthrift_field_mapJavaTypeDFset), __isset.at(19), __isset.bit(19)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset() & { return {this->__fbthrift_field_mapJavaTypeDFset, __isset.at(19), __isset.bit(19)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref mapJavaTypeDFset() && { return {static_cast(this->__fbthrift_field_mapJavaTypeDFset), __isset.at(19), __isset.bit(19)}; } @@ -5978,12 +5982,12 @@ class defaultStruct final { mapNestlistStructDfSet_ref() = std::forward(mapNestlistStructDfSet_); return __fbthrift_field_mapNestlistStructDfSet; } - const ::std::map<::std::int64_t, ::std::string>& get_mapJavaTypeDFset() const&; - ::std::map<::std::int64_t, ::std::string> get_mapJavaTypeDFset() &&; + const ::cpp2::map_i64_string_5732& get_mapJavaTypeDFset() const&; + ::cpp2::map_i64_string_5732 get_mapJavaTypeDFset() &&; - template > + template [[deprecated("Use `FOO.mapJavaTypeDFset_ref() = BAR;` instead of `FOO.set_mapJavaTypeDFset(BAR);`")]] - ::std::map<::std::int64_t, ::std::string>& set_mapJavaTypeDFset(T_defaultStruct_mapJavaTypeDFset_struct_setter&& mapJavaTypeDFset_) { + ::cpp2::map_i64_string_5732& set_mapJavaTypeDFset(T_defaultStruct_mapJavaTypeDFset_struct_setter&& mapJavaTypeDFset_) { mapJavaTypeDFset_ref() = std::forward(mapJavaTypeDFset_); return __fbthrift_field_mapJavaTypeDFset; } @@ -7173,7 +7177,7 @@ class TypeRemapped final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - TypeRemapped(apache::thrift::FragileConstructor, ::std::map<::std::int64_t, ::std::string> lsMap__arg, ::std::map<::std::int32_t, ::cpp2::FMap> ioMap__arg, ::std::int32_t BigInteger__arg, ::std::string binaryTestBuffer__arg); + TypeRemapped(apache::thrift::FragileConstructor, ::cpp2::map_i64_string_5732 lsMap__arg, ::cpp2::map_i32_FMap_6797 ioMap__arg, ::cpp2::i32_1194 BigInteger__arg, ::cpp2::binary_4918 binaryTestBuffer__arg); TypeRemapped(TypeRemapped&&) noexcept; @@ -7186,13 +7190,13 @@ class TypeRemapped final { ~TypeRemapped(); private: - ::std::map<::std::int64_t, ::std::string> __fbthrift_field_lsMap; + ::cpp2::map_i64_string_5732 __fbthrift_field_lsMap; private: - ::std::map<::std::int32_t, ::cpp2::FMap> __fbthrift_field_ioMap; + ::cpp2::map_i32_FMap_6797 __fbthrift_field_ioMap; private: - ::std::int32_t __fbthrift_field_BigInteger; + ::cpp2::i32_1194 __fbthrift_field_BigInteger; private: - ::std::string __fbthrift_field_binaryTestBuffer; + ::cpp2::binary_4918 __fbthrift_field_binaryTestBuffer; private: apache::thrift::detail::isset_bitset<4, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset; @@ -7201,205 +7205,205 @@ class TypeRemapped final { bool operator==(const TypeRemapped&) const; bool operator<(const TypeRemapped&) const; - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() const& { return {this->__fbthrift_field_lsMap, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() const&& { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() & { return {this->__fbthrift_field_lsMap, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() && { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() const& { return {this->__fbthrift_field_lsMap, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() const&& { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() & { return {this->__fbthrift_field_lsMap, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() && { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap_ref() const& { return {this->__fbthrift_field_ioMap, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap_ref() const&& { return {static_cast(this->__fbthrift_field_ioMap), __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap_ref() & { return {this->__fbthrift_field_ioMap, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap_ref() && { return {static_cast(this->__fbthrift_field_ioMap), __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap() const& { return {this->__fbthrift_field_ioMap, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap() const&& { return {static_cast(this->__fbthrift_field_ioMap), __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap() & { return {this->__fbthrift_field_ioMap, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref ioMap() && { return {static_cast(this->__fbthrift_field_ioMap), __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger_ref() const& { return {this->__fbthrift_field_BigInteger, __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger_ref() const&& { return {static_cast(this->__fbthrift_field_BigInteger), __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger_ref() & { return {this->__fbthrift_field_BigInteger, __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger_ref() && { return {static_cast(this->__fbthrift_field_BigInteger), __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger() const& { return {this->__fbthrift_field_BigInteger, __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger() const&& { return {static_cast(this->__fbthrift_field_BigInteger), __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger() & { return {this->__fbthrift_field_BigInteger, __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref BigInteger() && { return {static_cast(this->__fbthrift_field_BigInteger), __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer_ref() const& { return {this->__fbthrift_field_binaryTestBuffer, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer_ref() const&& { return {static_cast(this->__fbthrift_field_binaryTestBuffer), __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer_ref() & { return {this->__fbthrift_field_binaryTestBuffer, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer_ref() && { return {static_cast(this->__fbthrift_field_binaryTestBuffer), __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer() const& { return {this->__fbthrift_field_binaryTestBuffer, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer() const&& { return {static_cast(this->__fbthrift_field_binaryTestBuffer), __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer() & { return {this->__fbthrift_field_binaryTestBuffer, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binaryTestBuffer() && { return {static_cast(this->__fbthrift_field_binaryTestBuffer), __isset.at(3), __isset.bit(3)}; } - const ::std::map<::std::int64_t, ::std::string>& get_lsMap() const&; - ::std::map<::std::int64_t, ::std::string> get_lsMap() &&; + const ::cpp2::map_i64_string_5732& get_lsMap() const&; + ::cpp2::map_i64_string_5732 get_lsMap() &&; - template > + template [[deprecated("Use `FOO.lsMap_ref() = BAR;` instead of `FOO.set_lsMap(BAR);`")]] - ::std::map<::std::int64_t, ::std::string>& set_lsMap(T_TypeRemapped_lsMap_struct_setter&& lsMap_) { + ::cpp2::map_i64_string_5732& set_lsMap(T_TypeRemapped_lsMap_struct_setter&& lsMap_) { lsMap_ref() = std::forward(lsMap_); return __fbthrift_field_lsMap; } - const ::std::map<::std::int32_t, ::cpp2::FMap>& get_ioMap() const&; - ::std::map<::std::int32_t, ::cpp2::FMap> get_ioMap() &&; + const ::cpp2::map_i32_FMap_6797& get_ioMap() const&; + ::cpp2::map_i32_FMap_6797 get_ioMap() &&; - template > + template [[deprecated("Use `FOO.ioMap_ref() = BAR;` instead of `FOO.set_ioMap(BAR);`")]] - ::std::map<::std::int32_t, ::cpp2::FMap>& set_ioMap(T_TypeRemapped_ioMap_struct_setter&& ioMap_) { + ::cpp2::map_i32_FMap_6797& set_ioMap(T_TypeRemapped_ioMap_struct_setter&& ioMap_) { ioMap_ref() = std::forward(ioMap_); return __fbthrift_field_ioMap; } - ::std::int32_t get_BigInteger() const { + ::cpp2::i32_1194 get_BigInteger() const { return __fbthrift_field_BigInteger; } [[deprecated("Use `FOO.BigInteger_ref() = BAR;` instead of `FOO.set_BigInteger(BAR);`")]] - ::std::int32_t& set_BigInteger(::std::int32_t BigInteger_) { + ::cpp2::i32_1194& set_BigInteger(::cpp2::i32_1194 BigInteger_) { BigInteger_ref() = BigInteger_; return __fbthrift_field_BigInteger; } - const ::std::string& get_binaryTestBuffer() const& { + const ::cpp2::binary_4918& get_binaryTestBuffer() const& { return __fbthrift_field_binaryTestBuffer; } - ::std::string get_binaryTestBuffer() && { + ::cpp2::binary_4918 get_binaryTestBuffer() && { return std::move(__fbthrift_field_binaryTestBuffer); } - template + template [[deprecated("Use `FOO.binaryTestBuffer_ref() = BAR;` instead of `FOO.set_binaryTestBuffer(BAR);`")]] - ::std::string& set_binaryTestBuffer(T_TypeRemapped_binaryTestBuffer_struct_setter&& binaryTestBuffer_) { + ::cpp2::binary_4918& set_binaryTestBuffer(T_TypeRemapped_binaryTestBuffer_struct_setter&& binaryTestBuffer_) { binaryTestBuffer_ref() = std::forward(binaryTestBuffer_); return __fbthrift_field_binaryTestBuffer; } @@ -8040,7 +8044,7 @@ class FOLLY_EXPORT complexException : public virtual apache::thrift::TException // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - complexException(apache::thrift::FragileConstructor, ::std::string message__arg, ::std::vector<::std::string> listStrings__arg, ::cpp2::MyEnum errorEnum__arg, ::cpp2::MyUnion unionError__arg, ::cpp2::MyStruct structError__arg, ::std::map<::std::int64_t, ::std::string> lsMap__arg); + complexException(apache::thrift::FragileConstructor, ::std::string message__arg, ::std::vector<::std::string> listStrings__arg, ::cpp2::MyEnum errorEnum__arg, ::cpp2::MyUnion unionError__arg, ::cpp2::MyStruct structError__arg, ::cpp2::map_i64_string_5732 lsMap__arg); complexException(complexException&&) noexcept; @@ -8063,7 +8067,7 @@ class FOLLY_EXPORT complexException : public virtual apache::thrift::TException private: ::cpp2::MyStruct __fbthrift_field_structError; private: - ::std::map<::std::int64_t, ::std::string> __fbthrift_field_lsMap; + ::cpp2::map_i64_string_5732 __fbthrift_field_lsMap; private: apache::thrift::detail::isset_bitset<6, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset; @@ -8272,42 +8276,42 @@ class FOLLY_EXPORT complexException : public virtual apache::thrift::TException return {static_cast(this->__fbthrift_field_structError), __isset.at(4), __isset.bit(4)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() const& { return {this->__fbthrift_field_lsMap, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() const&& { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() & { return {this->__fbthrift_field_lsMap, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap_ref() && { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() const& { return {this->__fbthrift_field_lsMap, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() const&& { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() & { return {this->__fbthrift_field_lsMap, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref lsMap() && { return {static_cast(this->__fbthrift_field_lsMap), __isset.at(5), __isset.bit(5)}; } @@ -8364,12 +8368,12 @@ class FOLLY_EXPORT complexException : public virtual apache::thrift::TException structError_ref() = std::forward(structError_); return __fbthrift_field_structError; } - const ::std::map<::std::int64_t, ::std::string>& get_lsMap() const&; - ::std::map<::std::int64_t, ::std::string> get_lsMap() &&; + const ::cpp2::map_i64_string_5732& get_lsMap() const&; + ::cpp2::map_i64_string_5732 get_lsMap() &&; - template > + template [[deprecated("Use `FOO.lsMap_ref() = BAR;` instead of `FOO.set_lsMap(BAR);`")]] - ::std::map<::std::int64_t, ::std::string>& set_lsMap(T_complexException_lsMap_struct_setter&& lsMap_) { + ::cpp2::map_i64_string_5732& set_lsMap(T_complexException_lsMap_struct_setter&& lsMap_) { lsMap_ref() = std::forward(lsMap_); return __fbthrift_field_lsMap; } diff --git a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.tcc b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.tcc index 5d945e232ba..ac8a9d02c8b 100644 --- a/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.tcc +++ b/thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.tcc @@ -2154,8 +2154,8 @@ _readField_mapNestlistStructDfSet: _readField_mapJavaTypeDFset: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_mapJavaTypeDFset = ::std::map<::std::int64_t, ::std::string>(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::readWithContext(*iprot, this->__fbthrift_field_mapJavaTypeDFset, _readState); + this->__fbthrift_field_mapJavaTypeDFset = ::cpp2::map_i64_string_5732(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::readWithContext(*iprot, this->__fbthrift_field_mapJavaTypeDFset, _readState); _readState.afterSubobject(iprot); } @@ -2487,7 +2487,7 @@ uint32_t defaultStruct::serializedSize(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("mapJavaTypeDFset", apache::thrift::protocol::T_MAP, 21); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_mapJavaTypeDFset); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::serializedSize(*prot_, this->__fbthrift_field_mapJavaTypeDFset); } { xfer += prot_->serializedFieldSize("emptyMap", apache::thrift::protocol::T_MAP, 22); @@ -2583,7 +2583,7 @@ uint32_t defaultStruct::serializedSizeZC(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("mapJavaTypeDFset", apache::thrift::protocol::T_MAP, 21); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_mapJavaTypeDFset); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::serializedSize(*prot_, this->__fbthrift_field_mapJavaTypeDFset); } { xfer += prot_->serializedFieldSize("emptyMap", apache::thrift::protocol::T_MAP, 22); @@ -2739,7 +2739,7 @@ uint32_t defaultStruct::write(Protocol_* prot_) const { constexpr int16_t kPrevFieldId = 20; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "mapJavaTypeDFset", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::write(*prot_, this->__fbthrift_field_mapJavaTypeDFset); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::write(*prot_, this->__fbthrift_field_mapJavaTypeDFset); xfer += prot_->writeFieldEnd(); } { @@ -4572,8 +4572,8 @@ void TypeRemapped::readNoXfer(Protocol_* iprot) { _readField_lsMap: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_lsMap = ::std::map<::std::int64_t, ::std::string>(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::readWithContext(*iprot, this->__fbthrift_field_lsMap, _readState); + this->__fbthrift_field_lsMap = ::cpp2::map_i64_string_5732(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::readWithContext(*iprot, this->__fbthrift_field_lsMap, _readState); _readState.afterSubobject(iprot); } @@ -4589,8 +4589,8 @@ _readField_lsMap: _readField_ioMap: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_ioMap = ::std::map<::std::int32_t, ::cpp2::FMap>(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::cpp2::FMap>>::readWithContext(*iprot, this->__fbthrift_field_ioMap, _readState); + this->__fbthrift_field_ioMap = ::cpp2::map_i32_FMap_6797(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::cpp2::map_i32_FMap_6797>::readWithContext(*iprot, this->__fbthrift_field_ioMap, _readState); _readState.afterSubobject(iprot); } @@ -4605,7 +4605,7 @@ _readField_ioMap: } _readField_BigInteger: { - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::readWithContext(*iprot, this->__fbthrift_field_BigInteger, _readState); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::cpp2::i32_1194>::readWithContext(*iprot, this->__fbthrift_field_BigInteger, _readState); } this->__isset.set(2, true); @@ -4619,7 +4619,7 @@ _readField_BigInteger: } _readField_binaryTestBuffer: { - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::std::string>::readWithContext(*iprot, this->__fbthrift_field_binaryTestBuffer, _readState); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::cpp2::binary_4918>::readWithContext(*iprot, this->__fbthrift_field_binaryTestBuffer, _readState); } this->__isset.set(3, true); @@ -4696,19 +4696,19 @@ uint32_t TypeRemapped::serializedSize(Protocol_ const* prot_) const { xfer += prot_->serializedStructSize("TypeRemapped"); { xfer += prot_->serializedFieldSize("lsMap", apache::thrift::protocol::T_MAP, 1); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_lsMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::serializedSize(*prot_, this->__fbthrift_field_lsMap); } { xfer += prot_->serializedFieldSize("ioMap", apache::thrift::protocol::T_MAP, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::cpp2::FMap>>::serializedSize(*prot_, this->__fbthrift_field_ioMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::cpp2::map_i32_FMap_6797>::serializedSize(*prot_, this->__fbthrift_field_ioMap); } { xfer += prot_->serializedFieldSize("BigInteger", apache::thrift::protocol::T_I32, 3); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, this->__fbthrift_field_BigInteger); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::cpp2::i32_1194>::serializedSize(*prot_, this->__fbthrift_field_BigInteger); } { xfer += prot_->serializedFieldSize("binaryTestBuffer", apache::thrift::protocol::T_STRING, 4); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::std::string>::serializedSize(*prot_, this->__fbthrift_field_binaryTestBuffer); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::cpp2::binary_4918>::serializedSize(*prot_, this->__fbthrift_field_binaryTestBuffer); } xfer += prot_->serializedSizeStop(); return xfer; @@ -4720,19 +4720,19 @@ uint32_t TypeRemapped::serializedSizeZC(Protocol_ const* prot_) const { xfer += prot_->serializedStructSize("TypeRemapped"); { xfer += prot_->serializedFieldSize("lsMap", apache::thrift::protocol::T_MAP, 1); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_lsMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::serializedSize(*prot_, this->__fbthrift_field_lsMap); } { xfer += prot_->serializedFieldSize("ioMap", apache::thrift::protocol::T_MAP, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::cpp2::FMap>>::serializedSize(*prot_, this->__fbthrift_field_ioMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::cpp2::map_i32_FMap_6797>::serializedSize(*prot_, this->__fbthrift_field_ioMap); } { xfer += prot_->serializedFieldSize("BigInteger", apache::thrift::protocol::T_I32, 3); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, this->__fbthrift_field_BigInteger); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::cpp2::i32_1194>::serializedSize(*prot_, this->__fbthrift_field_BigInteger); } { xfer += prot_->serializedFieldSize("binaryTestBuffer", apache::thrift::protocol::T_STRING, 4); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::std::string>::serializedSize(*prot_, this->__fbthrift_field_binaryTestBuffer); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::cpp2::binary_4918>::serializedSize(*prot_, this->__fbthrift_field_binaryTestBuffer); } xfer += prot_->serializedSizeStop(); return xfer; @@ -4747,28 +4747,28 @@ uint32_t TypeRemapped::write(Protocol_* prot_) const { constexpr int16_t kPrevFieldId = 0; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "lsMap", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::write(*prot_, this->__fbthrift_field_lsMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::write(*prot_, this->__fbthrift_field_lsMap); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 1; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "ioMap", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::cpp2::FMap>>::write(*prot_, this->__fbthrift_field_ioMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::cpp2::map_i32_FMap_6797>::write(*prot_, this->__fbthrift_field_ioMap); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 2; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "BigInteger", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::write(*prot_, this->__fbthrift_field_BigInteger); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::cpp2::i32_1194>::write(*prot_, this->__fbthrift_field_BigInteger); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 3; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "binaryTestBuffer", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::std::string>::write(*prot_, this->__fbthrift_field_binaryTestBuffer); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::cpp2::binary_4918>::write(*prot_, this->__fbthrift_field_binaryTestBuffer); xfer += prot_->writeFieldEnd(); } xfer += prot_->writeFieldStop(); @@ -5275,8 +5275,8 @@ _readField_structError: _readField_lsMap: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_lsMap = ::std::map<::std::int64_t, ::std::string>(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::readWithContext(*iprot, this->__fbthrift_field_lsMap, _readState); + this->__fbthrift_field_lsMap = ::cpp2::map_i64_string_5732(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::readWithContext(*iprot, this->__fbthrift_field_lsMap, _readState); _readState.afterSubobject(iprot); } @@ -5390,7 +5390,7 @@ uint32_t complexException::serializedSize(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("lsMap", apache::thrift::protocol::T_MAP, 6); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_lsMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::serializedSize(*prot_, this->__fbthrift_field_lsMap); } xfer += prot_->serializedSizeStop(); return xfer; @@ -5422,7 +5422,7 @@ uint32_t complexException::serializedSizeZC(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("lsMap", apache::thrift::protocol::T_MAP, 6); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_lsMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::serializedSize(*prot_, this->__fbthrift_field_lsMap); } xfer += prot_->serializedSizeStop(); return xfer; @@ -5474,7 +5474,7 @@ uint32_t complexException::write(Protocol_* prot_) const { constexpr int16_t kPrevFieldId = 5; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "lsMap", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::std::map<::std::int64_t, ::std::string>>::write(*prot_, this->__fbthrift_field_lsMap); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::cpp2::map_i64_string_5732>::write(*prot_, this->__fbthrift_field_lsMap); xfer += prot_->writeFieldEnd(); } xfer += prot_->writeFieldStop(); diff --git a/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.py b/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.py index c605d522009..913587c9c16 100644 --- a/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.py +++ b/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.py @@ -1570,3 +1570,7 @@ def _fbthrift_metadata__exception_complexException(): listTypedef = _fbthrift_python_types.ListTypeFactory(_fbthrift_python_types.typeinfo_double) floatTypedef = float FMap = _fbthrift_python_types.MapTypeFactory(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_i64) +binary_4918 = bytes +i32_1194 = int +map_i32_FMap_6797 = _fbthrift_python_types.MapTypeFactory(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_i64)) +map_i64_string_5732 = _fbthrift_python_types.MapTypeFactory(_fbthrift_python_types.typeinfo_i64, _fbthrift_python_types.typeinfo_string) diff --git a/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.pyi b/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.pyi index 4e435574374..1eec9f26b90 100644 --- a/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.pyi +++ b/thrift/compiler/test/fixtures/complex-struct/gen-python/module/thrift_types.pyi @@ -626,3 +626,7 @@ mapTypedef = _typing.Dict[int, str] listTypedef = _typing.List[float] floatTypedef = float FMap = _typing.Dict[int, int] +binary_4918 = bytes +i32_1194 = int +map_i32_FMap_6797 = _typing.Dict[int, _typing.Mapping[int, int]] +map_i64_string_5732 = _typing.Dict[int, str] diff --git a/thrift/compiler/test/fixtures/complex-struct/src/module.thrift b/thrift/compiler/test/fixtures/complex-struct/src/module.thrift index 2b8e262509f..06b6906edea 100644 --- a/thrift/compiler/test/fixtures/complex-struct/src/module.thrift +++ b/thrift/compiler/test/fixtures/complex-struct/src/module.thrift @@ -114,9 +114,7 @@ struct defaultStruct { 2: [{"age": 28, "name": "BatMan"}, {"age": 12, "name": "Robin"}], 5: [{"age": 12, "name": "RatMan"}, {"age": 6, "name": "Catman"}], }; - 21: map ( - java.swift.type = "it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap", - ) mapJavaTypeDFset = {15: 'a_value', 2: 'b_value'}; + 21: map_i64_string_5732 mapJavaTypeDFset = {15: 'a_value', 2: 'b_value'}; 22: map emptyMap = {}; 23: map> enumMapDFset = { "SANDY BRIDGE": {16: MyEnum.MyValue1, 144: MyEnum.MyValue1}, @@ -179,14 +177,10 @@ struct ComplexNestedStruct { } struct TypeRemapped { - 1: map ( - java.swift.type = "it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap", - ) lsMap; - 2: map ( - java.swift.type = "it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap", - ) ioMap; - 3: i32 (java.swift.type = "java.math.BigInteger") BigInteger; - 4: binary (java.swift.type = "java.nio.ByteBuffer") binaryTestBuffer; + 1: map_i64_string_5732 lsMap; + 2: map_i32_FMap_6797 ioMap; + 3: i32_1194 BigInteger; + 4: binary_4918 binaryTestBuffer; } exception emptyXcep {} @@ -207,7 +201,15 @@ exception complexException { 3: MyEnum errorEnum; 4: optional MyUnion unionError; 5: MyStruct structError; - 6: map ( - java.swift.type = "it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap", - ) lsMap; + 6: map_i64_string_5732 lsMap; } + +// The following were automatically generated and may benefit from renaming. +typedef binary (java.swift.type = "java.nio.ByteBuffer") binary_4918 +typedef i32 (java.swift.type = "java.math.BigInteger") i32_1194 +typedef map ( + java.swift.type = "it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap", +) map_i32_FMap_6797 +typedef map ( + java.swift.type = "it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap", +) map_i64_string_5732 diff --git a/thrift/compiler/test/fixtures/java-swift-annotation/src/module.thrift b/thrift/compiler/test/fixtures/java-swift-annotation/src/module.thrift index 7d5464dc0dc..e293a0616c5 100644 --- a/thrift/compiler/test/fixtures/java-swift-annotation/src/module.thrift +++ b/thrift/compiler/test/fixtures/java-swift-annotation/src/module.thrift @@ -46,10 +46,8 @@ struct MyMutableStruct { } struct MyMapping { - 1: map (java.swift.type = "com.foo.FastLongStringMap") lsMap; - 2: map ( - java.swift.type = "com.foo.FastIntObjectMap", - ) ioMap; + 1: map_i64_string_9739 lsMap; + 2: map_i32_FMap_5221 ioMap; 3: map binaryMap; 4: map regularBinary; } @@ -61,3 +59,11 @@ struct BinaryMapping { // The following were automatically generated and may benefit from renaming. typedef string (java.swift.binary_string = "1") string_6863 + +// The following were automatically generated and may benefit from renaming. +typedef map ( + java.swift.type = "com.foo.FastIntObjectMap", +) map_i32_FMap_5221 +typedef map ( + java.swift.type = "com.foo.FastLongStringMap", +) map_i64_string_9739 diff --git a/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/lib.rs b/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/lib.rs index e554ee33686..be9128297a8 100644 --- a/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/lib.rs +++ b/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/lib.rs @@ -66,36 +66,6 @@ pub(crate) mod r#impl { } } - impl

::fbthrift::Serialize

for LocalImpl<::smallvec::SmallVec<[u8; 32]>> - where - P: ::fbthrift::ProtocolWriter, - { - fn write(&self, p: &mut P) { - self.0.as_slice().write(p) - } - } - - impl

::fbthrift::Deserialize

for LocalImpl<::smallvec::SmallVec<[u8; 32]>> - where - P: ::fbthrift::ProtocolReader, - { - fn read(p: &mut P) -> ::anyhow::Result { - p.read_binary() - } - } - - impl ::fbthrift::binary_type::BinaryType for LocalImpl<::smallvec::SmallVec<[u8; 32]>> { - fn with_capacity(capacity: usize) -> Self { - LocalImpl(<::smallvec::SmallVec<[u8; 32]>>::with_capacity(capacity)) - } - fn extend_from_slice(&mut self, other: &[u8]) { - self.0.extend_from_slice(other) - } - fn from_vec(vec: ::std::vec::Vec) -> Self { - LocalImpl(::std::convert::Into::into(vec)) - } - } - impl

::fbthrift::Serialize

for LocalImpl<::sorted_vector_map::SortedVectorMap<::std::primitive::i32, ::std::primitive::i32>> where P: ::fbthrift::ProtocolWriter, diff --git a/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/types.rs b/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/types.rs index b577ec7159d..afb56ac183b 100644 --- a/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/types.rs +++ b/thrift/compiler/test/fixtures/rust-newtype-typedef/gen-rust/types.rs @@ -19,15 +19,21 @@ pub type Double = ::fbthrift::builtin_types::OrderedFloat; #[derive(Default, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct BytesType(pub ::fbthrift::builtin_types::Bytes); +pub type binary_8247 = ::smallvec::SmallVec<[u8; 32]>; + +pub type binary_9564 = ::fbthrift::builtin_types::Bytes; + +pub type double_8056 = ::fbthrift::builtin_types::OrderedFloat; + #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MyStruct { pub the_map: crate::types::MapType, pub the_bin: crate::types::BinType, - pub inline_bin: ::smallvec::SmallVec<[u8; 32]>, + pub inline_bin: crate::types::binary_8247, pub the_bytes: crate::types::BytesType, - pub inline_bytes: ::fbthrift::builtin_types::Bytes, + pub inline_bytes: crate::types::binary_9564, pub floaty: crate::types::Double, - pub doublefloaty: ::fbthrift::builtin_types::OrderedFloat, + pub doublefloaty: crate::types::double_8056, // This field forces `..Default::default()` when instantiating this // struct, to make code future-proof against new fields added later to // the definition in Thrift. If you don't want this, add the annotation @@ -152,7 +158,7 @@ where ::fbthrift::Serialize::write(&self.the_bin, p); p.write_field_end(); p.write_field_begin("inline_bin", ::fbthrift::TType::String, 3); - crate::r#impl::write(&self.inline_bin, p); + ::fbthrift::Serialize::write(&self.inline_bin, p); p.write_field_end(); p.write_field_begin("the_bytes", ::fbthrift::TType::String, 4); ::fbthrift::Serialize::write(&self.the_bytes, p); @@ -199,7 +205,7 @@ where (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::Map, 1) => field_the_map = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::String, 2) => field_the_bin = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), - (::fbthrift::TType::String, 3) => field_inline_bin = ::std::option::Option::Some(crate::r#impl::read(p)?), + (::fbthrift::TType::String, 3) => field_inline_bin = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::String, 4) => field_the_bytes = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::String, 5) => field_inline_bytes = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::Double, 6) => field_floaty = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), @@ -325,36 +331,6 @@ pub(crate) mod r#impl { } } - impl

::fbthrift::Serialize

for LocalImpl<::smallvec::SmallVec<[u8; 32]>> - where - P: ::fbthrift::ProtocolWriter, - { - fn write(&self, p: &mut P) { - self.0.as_slice().write(p) - } - } - - impl

::fbthrift::Deserialize

for LocalImpl<::smallvec::SmallVec<[u8; 32]>> - where - P: ::fbthrift::ProtocolReader, - { - fn read(p: &mut P) -> ::anyhow::Result { - p.read_binary() - } - } - - impl ::fbthrift::binary_type::BinaryType for LocalImpl<::smallvec::SmallVec<[u8; 32]>> { - fn with_capacity(capacity: usize) -> Self { - LocalImpl(<::smallvec::SmallVec<[u8; 32]>>::with_capacity(capacity)) - } - fn extend_from_slice(&mut self, other: &[u8]) { - self.0.extend_from_slice(other) - } - fn from_vec(vec: ::std::vec::Vec) -> Self { - LocalImpl(::std::convert::Into::into(vec)) - } - } - impl

::fbthrift::Serialize

for LocalImpl<::sorted_vector_map::SortedVectorMap<::std::primitive::i32, ::std::primitive::i32>> where P: ::fbthrift::ProtocolWriter, diff --git a/thrift/compiler/test/fixtures/rust-newtype-typedef/src/module.thrift b/thrift/compiler/test/fixtures/rust-newtype-typedef/src/module.thrift index 586c1414c25..afb9b3db9e1 100644 --- a/thrift/compiler/test/fixtures/rust-newtype-typedef/src/module.thrift +++ b/thrift/compiler/test/fixtures/rust-newtype-typedef/src/module.thrift @@ -31,9 +31,14 @@ typedef binary BytesType (rust.newtype, rust.type = "Bytes") struct MyStruct { 1: MapType the_map; 2: BinType the_bin; - 3: binary (rust.type = "smallvec::SmallVec<[u8; 32]>") inline_bin; + 3: binary_8247 inline_bin; 4: BytesType the_bytes; - 5: binary (rust.type = "Bytes") inline_bytes; + 5: binary_9564 inline_bytes; 6: Double floaty; - 7: double (rust.type = "OrderedFloat") doublefloaty; + 7: double_8056 doublefloaty; } (rust.ord) + +// The following were automatically generated and may benefit from renaming. +typedef binary (rust.type = "smallvec::SmallVec<[u8; 32]>") binary_8247 +typedef binary (rust.type = "Bytes") binary_9564 +typedef double (rust.type = "OrderedFloat") double_8056 diff --git a/thrift/compiler/test/fixtures/types/gen-cpp2/module_fatal_struct.h b/thrift/compiler/test/fixtures/types/gen-cpp2/module_fatal_struct.h index cf8a725c146..925ed32ca44 100644 --- a/thrift/compiler/test/fixtures/types/gen-cpp2/module_fatal_struct.h +++ b/thrift/compiler/test/fixtures/types/gen-cpp2/module_fatal_struct.h @@ -186,7 +186,7 @@ class ContainerStruct_struct_traits { struct __fbthrift_member_fieldF { using owner = ::apache::thrift::fixtures::types::ContainerStruct; using name = __fbthrift_strings_module::__fbthrift_hash_68f4d40289380c5c6536b552d834e0a1e0df88fddcd39d4a6d7f3a0b1cf22012; - using type = folly::sorted_vector_set<::std::int32_t>; + using type = ::apache::thrift::fixtures::types::set_i32_7194; using tag = ::apache::thrift::ident::fieldF; static constexpr ::apache::thrift::field_id_t id = 6; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -198,7 +198,7 @@ class ContainerStruct_struct_traits { struct __fbthrift_member_fieldG { using owner = ::apache::thrift::fixtures::types::ContainerStruct; using name = __fbthrift_strings_module::__fbthrift_hash_4c4f1be7384da0ab8e9483a59b7018f4671e228da38fa30ee8eabe777bc24cda; - using type = folly::sorted_vector_map<::std::int32_t, ::std::string>; + using type = ::apache::thrift::fixtures::types::map_i32_string_1261; using tag = ::apache::thrift::ident::fieldG; static constexpr ::apache::thrift::field_id_t id = 7; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1035,7 +1035,7 @@ class AnnotatedTypes_struct_traits { struct __fbthrift_member_binary_field { using owner = ::apache::thrift::fixtures::types::AnnotatedTypes; using name = __fbthrift_strings_module::__fbthrift_hash_a3d53ffeeecb838901452e3279a13dcce02e91865d83cb64d8f3e5ed8c18bf03; - using type = ::apache::thrift::fixtures::types::TBinary; + using type = ::apache::thrift::fixtures::types::TBinary_8623; using tag = ::apache::thrift::ident::binary_field; static constexpr ::apache::thrift::field_id_t id = 1; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1047,7 +1047,7 @@ class AnnotatedTypes_struct_traits { struct __fbthrift_member_list_field { using owner = ::apache::thrift::fixtures::types::AnnotatedTypes; using name = __fbthrift_strings_module::__fbthrift_hash_ea7bd83abd8b7b855031fc7f4e0e961fe4c408203a46f5126d609632ddf0c641; - using type = ::apache::thrift::fixtures::types::SomeListOfTypeMap; + using type = ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468; using tag = ::apache::thrift::ident::list_field; static constexpr ::apache::thrift::field_id_t id = 2; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1695,7 +1695,7 @@ class AllocatorAware_struct_traits { struct __fbthrift_member_aa_list { using owner = ::apache::thrift::fixtures::types::AllocatorAware; using name = __fbthrift_strings_module::__fbthrift_hash_880a35405ed995030f9d4b4939e636855aa93e6e6173fe61bd40adec636dec29; - using type = ::std::vector<::std::int32_t>; + using type = ::apache::thrift::fixtures::types::list_i32_9187; using tag = ::apache::thrift::ident::aa_list; static constexpr ::apache::thrift::field_id_t id = 1; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1707,7 +1707,7 @@ class AllocatorAware_struct_traits { struct __fbthrift_member_aa_set { using owner = ::apache::thrift::fixtures::types::AllocatorAware; using name = __fbthrift_strings_module::__fbthrift_hash_bfaf0acc93bb6b488b6a5a8d0bcc12a66bdac79da50021adc4da36e22a6af810; - using type = ::std::set<::std::int32_t>; + using type = ::apache::thrift::fixtures::types::set_i32_7070; using tag = ::apache::thrift::ident::aa_set; static constexpr ::apache::thrift::field_id_t id = 2; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1719,7 +1719,7 @@ class AllocatorAware_struct_traits { struct __fbthrift_member_aa_map { using owner = ::apache::thrift::fixtures::types::AllocatorAware; using name = __fbthrift_strings_module::__fbthrift_hash_4b52fb402e58543eb406111961ce4b6760c045edd3af4068b93a1ff7ac4ccfc1; - using type = ::std::map<::std::int32_t, ::std::int32_t>; + using type = ::apache::thrift::fixtures::types::map_i32_i32_9565; using tag = ::apache::thrift::ident::aa_map; static constexpr ::apache::thrift::field_id_t id = 3; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1731,7 +1731,7 @@ class AllocatorAware_struct_traits { struct __fbthrift_member_aa_string { using owner = ::apache::thrift::fixtures::types::AllocatorAware; using name = __fbthrift_strings_module::__fbthrift_hash_f119bbf23aedae2e52bbe52603d5596f495df52e77522ef10e4e47e6cef18e97; - using type = ::std::string; + using type = ::apache::thrift::fixtures::types::string_5252; using tag = ::apache::thrift::ident::aa_string; static constexpr ::apache::thrift::field_id_t id = 4; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1755,7 +1755,7 @@ class AllocatorAware_struct_traits { struct __fbthrift_member_aa_unique { using owner = ::apache::thrift::fixtures::types::AllocatorAware; using name = __fbthrift_strings_module::__fbthrift_hash_55c08bd2971fde106159fb69085c6e57b77b291d5ac214f1479c0b4f41107cf1; - using type = ::std::int32_t; + using type = ::apache::thrift::fixtures::types::i32_9314; using tag = ::apache::thrift::ident::aa_unique; static constexpr ::apache::thrift::field_id_t id = 6; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; @@ -1767,7 +1767,7 @@ class AllocatorAware_struct_traits { struct __fbthrift_member_aa_shared { using owner = ::apache::thrift::fixtures::types::AllocatorAware; using name = __fbthrift_strings_module::__fbthrift_hash_c9fa85c7498e0de702c747ccbfa86a6946006c87e0d3a64b9156945848027d08; - using type = ::std::int32_t; + using type = ::apache::thrift::fixtures::types::i32_9314; using tag = ::apache::thrift::ident::aa_shared; static constexpr ::apache::thrift::field_id_t id = 7; static constexpr auto optional = ::apache::thrift::optionality::required_of_writer; diff --git a/thrift/compiler/test/fixtures/types/gen-cpp2/module_metadata.cpp b/thrift/compiler/test/fixtures/types/gen-cpp2/module_metadata.cpp index 8d33ebba975..5ff051a3816 100644 --- a/thrift/compiler/test/fixtures/types/gen-cpp2/module_metadata.cpp +++ b/thrift/compiler/test/fixtures/types/gen-cpp2/module_metadata.cpp @@ -113,8 +113,8 @@ StructMetadata<::apache::thrift::fixtures::types::ContainerStruct>::gen(ThriftMe {3, "fieldC", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("std::deque")}}).cv_struct_ref(), }}, {4, "fieldD", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("folly::fbvector")}}).cv_struct_ref(), }}, {5, "fieldE", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("folly::small_vector")}}).cv_struct_ref(), }}, - {6, "fieldF", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("folly::sorted_vector_set")}}).cv_struct_ref(), }}, - {7, "fieldG", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("folly::sorted_vector_map")}}).cv_struct_ref(), }}, + {6, "fieldF", false, std::make_unique("module.set_i32_7194", std::make_unique("module.set_i32_7194", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("folly::sorted_vector_set")}}).cv_struct_ref(), }), std::vector{}), std::vector{}}, + {7, "fieldG", false, std::make_unique("module.map_i32_string_1261", std::make_unique("module.map_i32_string_1261", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("folly::sorted_vector_map")}}).cv_struct_ref(), }), std::vector{}), std::vector{}}, {8, "fieldH", false, std::make_unique("included.SomeMap", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("std::unordered_map")}}).cv_struct_ref(), }), std::vector{}}, }}; for (const auto& f : *module_ContainerStruct_fields) { @@ -434,8 +434,8 @@ StructMetadata<::apache::thrift::fixtures::types::AnnotatedTypes>::gen(ThriftMet module_AnnotatedTypes.is_union() = false; static const auto* const module_AnnotatedTypes_fields = new std::array{{ - {1, "binary_field", false, std::make_unique("module.TBinary", std::make_unique("module.TBinary", std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{}), std::vector{}), std::vector{}}, - {2, "list_field", false, std::make_unique("included.SomeListOfTypeMap", std::make_unique("included.SomeListOfTypeMap", std::make_unique(std::make_unique("included.SomeMap", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("std::unordered_map")}}).cv_struct_ref(), })), std::vector{}), std::vector{}), std::vector{}}, + {1, "binary_field", false, std::make_unique("module.TBinary_8623", std::make_unique("module.TBinary_8623", std::make_unique("module.TBinary", std::make_unique("module.TBinary", std::make_unique(ThriftPrimitiveType::THRIFT_BINARY_TYPE), std::vector{}), std::vector{}), std::vector{}), std::vector{}), std::vector{}}, + {2, "list_field", false, std::make_unique("module.SomeListOfTypeMap_2468", std::make_unique("module.SomeListOfTypeMap_2468", std::make_unique("included.SomeListOfTypeMap", std::make_unique("included.SomeListOfTypeMap", std::make_unique(std::make_unique("included.SomeMap", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE)), std::vector{*cvStruct("cpp.Type", {{"template", cvString("std::unordered_map")}}).cv_struct_ref(), })), std::vector{}), std::vector{}), std::vector{}), std::vector{}), std::vector{}}, }}; for (const auto& f : *module_AnnotatedTypes_fields) { ::apache::thrift::metadata::ThriftField field; @@ -770,13 +770,13 @@ StructMetadata<::apache::thrift::fixtures::types::AllocatorAware>::gen(ThriftMet module_AllocatorAware.is_union() = false; static const auto* const module_AllocatorAware_fields = new std::array{{ - {1, "aa_list", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{}}, - {2, "aa_set", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{}}, - {3, "aa_map", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{}}, - {4, "aa_string", false, std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{}}, + {1, "aa_list", false, std::make_unique("module.list_i32_9187", std::make_unique("module.list_i32_9187", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{}), std::vector{}), std::vector{}}, + {2, "aa_set", false, std::make_unique("module.set_i32_7070", std::make_unique("module.set_i32_7070", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{}), std::vector{}), std::vector{}}, + {3, "aa_map", false, std::make_unique("module.map_i32_i32_9565", std::make_unique("module.map_i32_i32_9565", std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{}), std::vector{}), std::vector{}}, + {4, "aa_string", false, std::make_unique("module.string_5252", std::make_unique("module.string_5252", std::make_unique(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector{}), std::vector{}), std::vector{}}, {5, "not_a_container", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}}, - {6, "aa_unique", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{*cvStruct("cpp.Ref", {{"type", cvInteger(0)}}).cv_struct_ref(), }}, - {7, "aa_shared", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{*cvStruct("cpp.Ref", {{"type", cvInteger(2)}}).cv_struct_ref(), }}, + {6, "aa_unique", false, std::make_unique("module.i32_9314", std::make_unique("module.i32_9314", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("cpp.Ref", {{"type", cvInteger(0)}}).cv_struct_ref(), }}, + {7, "aa_shared", false, std::make_unique("module.i32_9314", std::make_unique("module.i32_9314", std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{}), std::vector{}), std::vector{*cvStruct("cpp.Ref", {{"type", cvInteger(2)}}).cv_struct_ref(), }}, }}; for (const auto& f : *module_AllocatorAware_fields) { ::apache::thrift::metadata::ThriftField field; diff --git a/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.cpp index 92ae38ee56a..35e7f1c6fb5 100644 --- a/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.cpp @@ -314,7 +314,7 @@ ContainerStruct& ContainerStruct::operator=(FOLLY_MAYBE_UNUSED ContainerStruct&& } -ContainerStruct::ContainerStruct(apache::thrift::FragileConstructor, ::std::vector<::std::int32_t> fieldA__arg, std::list<::std::int32_t> fieldB__arg, std::deque<::std::int32_t> fieldC__arg, folly::fbvector<::std::int32_t> fieldD__arg, folly::small_vector<::std::int32_t> fieldE__arg, folly::sorted_vector_set<::std::int32_t> fieldF__arg, folly::sorted_vector_map<::std::int32_t, ::std::string> fieldG__arg, ::apache::thrift::fixtures::types::SomeMap fieldH__arg) : +ContainerStruct::ContainerStruct(apache::thrift::FragileConstructor, ::std::vector<::std::int32_t> fieldA__arg, std::list<::std::int32_t> fieldB__arg, std::deque<::std::int32_t> fieldC__arg, folly::fbvector<::std::int32_t> fieldD__arg, folly::small_vector<::std::int32_t> fieldE__arg, ::apache::thrift::fixtures::types::set_i32_7194 fieldF__arg, ::apache::thrift::fixtures::types::map_i32_string_1261 fieldG__arg, ::apache::thrift::fixtures::types::SomeMap fieldH__arg) : __fbthrift_field_fieldA(std::move(fieldA__arg)), __fbthrift_field_fieldB(std::move(fieldB__arg)), __fbthrift_field_fieldC(std::move(fieldC__arg)), @@ -402,19 +402,19 @@ folly::small_vector<::std::int32_t> ContainerStruct::get_fieldE() && { return std::move(__fbthrift_field_fieldE); } -const folly::sorted_vector_set<::std::int32_t>& ContainerStruct::get_fieldF() const& { +const ::apache::thrift::fixtures::types::set_i32_7194& ContainerStruct::get_fieldF() const& { return __fbthrift_field_fieldF; } -folly::sorted_vector_set<::std::int32_t> ContainerStruct::get_fieldF() && { +::apache::thrift::fixtures::types::set_i32_7194 ContainerStruct::get_fieldF() && { return std::move(__fbthrift_field_fieldF); } -const folly::sorted_vector_map<::std::int32_t, ::std::string>& ContainerStruct::get_fieldG() const& { +const ::apache::thrift::fixtures::types::map_i32_string_1261& ContainerStruct::get_fieldG() const& { return __fbthrift_field_fieldG; } -folly::sorted_vector_map<::std::int32_t, ::std::string> ContainerStruct::get_fieldG() && { +::apache::thrift::fixtures::types::map_i32_string_1261 ContainerStruct::get_fieldG() && { return std::move(__fbthrift_field_fieldG); } @@ -1761,7 +1761,7 @@ AnnotatedTypes& AnnotatedTypes::operator=(FOLLY_MAYBE_UNUSED AnnotatedTypes&& ot } -AnnotatedTypes::AnnotatedTypes(apache::thrift::FragileConstructor, ::apache::thrift::fixtures::types::TBinary binary_field__arg, ::apache::thrift::fixtures::types::SomeListOfTypeMap list_field__arg) : +AnnotatedTypes::AnnotatedTypes(apache::thrift::FragileConstructor, ::apache::thrift::fixtures::types::TBinary_8623 binary_field__arg, ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468 list_field__arg) : __fbthrift_field_binary_field(std::move(binary_field__arg)), __fbthrift_field_list_field(std::move(list_field__arg)) { __isset.set(folly::index_constant<0>(), true); @@ -1791,11 +1791,11 @@ bool AnnotatedTypes::operator<(FOLLY_MAYBE_UNUSED const AnnotatedTypes& rhs) con return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs); } -const ::apache::thrift::fixtures::types::SomeListOfTypeMap& AnnotatedTypes::get_list_field() const& { +const ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468& AnnotatedTypes::get_list_field() const& { return __fbthrift_field_list_field; } -::apache::thrift::fixtures::types::SomeListOfTypeMap AnnotatedTypes::get_list_field() && { +::apache::thrift::fixtures::types::SomeListOfTypeMap_2468 AnnotatedTypes::get_list_field() && { return std::move(__fbthrift_field_list_field); } @@ -3404,8 +3404,8 @@ AllocatorAware::AllocatorAware() : __fbthrift_field_aa_map(__fbthrift_alloc), __fbthrift_field_aa_string(__fbthrift_alloc), __fbthrift_field_not_a_container(), - __fbthrift_field_aa_unique(folly::allocate_unique<::std::int32_t>(__fbthrift_alloc)), - __fbthrift_field_aa_shared(std::allocate_shared<::std::int32_t>(__fbthrift_alloc)) { + __fbthrift_field_aa_unique(folly::allocate_unique<::apache::thrift::fixtures::types::i32_9314>(__fbthrift_alloc)), + __fbthrift_field_aa_shared(std::allocate_shared<::apache::thrift::fixtures::types::i32_9314>(__fbthrift_alloc)) { } @@ -3437,7 +3437,7 @@ AllocatorAware& AllocatorAware::operator=(FOLLY_MAYBE_UNUSED AllocatorAware&& ot } -AllocatorAware::AllocatorAware(apache::thrift::FragileConstructor, ::std::vector<::std::int32_t> aa_list__arg, ::std::set<::std::int32_t> aa_set__arg, ::std::map<::std::int32_t, ::std::int32_t> aa_map__arg, ::std::string aa_string__arg, ::std::int32_t not_a_container__arg, ::std::unique_ptr<::std::int32_t> aa_unique__arg, ::std::shared_ptr<::std::int32_t> aa_shared__arg) : +AllocatorAware::AllocatorAware(apache::thrift::FragileConstructor, ::apache::thrift::fixtures::types::list_i32_9187 aa_list__arg, ::apache::thrift::fixtures::types::set_i32_7070 aa_set__arg, ::apache::thrift::fixtures::types::map_i32_i32_9565 aa_map__arg, ::apache::thrift::fixtures::types::string_5252 aa_string__arg, ::std::int32_t not_a_container__arg, ::std::unique_ptr<::apache::thrift::fixtures::types::i32_9314> aa_unique__arg, ::std::shared_ptr<::apache::thrift::fixtures::types::i32_9314> aa_shared__arg) : __fbthrift_field_aa_list(std::move(aa_list__arg)), __fbthrift_field_aa_set(std::move(aa_set__arg)), __fbthrift_field_aa_map(std::move(aa_map__arg)), @@ -3460,8 +3460,8 @@ void AllocatorAware::__fbthrift_clear() { this->__fbthrift_field_aa_map.clear(); this->__fbthrift_field_aa_string = apache::thrift::StringTraits::fromStringLiteral(""); this->__fbthrift_field_not_a_container = ::std::int32_t(); - this->__fbthrift_field_aa_unique = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::std::int32_t>>(this->get_allocator()); - this->__fbthrift_field_aa_shared = ::apache::thrift::detail::make_mutable_smart_ptr<::std::shared_ptr<::std::int32_t>>(this->get_allocator()); + this->__fbthrift_field_aa_unique = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::fixtures::types::i32_9314>>(this->get_allocator()); + this->__fbthrift_field_aa_shared = ::apache::thrift::detail::make_mutable_smart_ptr<::std::shared_ptr<::apache::thrift::fixtures::types::i32_9314>>(this->get_allocator()); __isset = {}; } @@ -3480,27 +3480,27 @@ bool AllocatorAware::operator<(FOLLY_MAYBE_UNUSED const AllocatorAware& rhs) con return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs); } -const ::std::vector<::std::int32_t>& AllocatorAware::get_aa_list() const& { +const ::apache::thrift::fixtures::types::list_i32_9187& AllocatorAware::get_aa_list() const& { return __fbthrift_field_aa_list; } -::std::vector<::std::int32_t> AllocatorAware::get_aa_list() && { +::apache::thrift::fixtures::types::list_i32_9187 AllocatorAware::get_aa_list() && { return std::move(__fbthrift_field_aa_list); } -const ::std::set<::std::int32_t>& AllocatorAware::get_aa_set() const& { +const ::apache::thrift::fixtures::types::set_i32_7070& AllocatorAware::get_aa_set() const& { return __fbthrift_field_aa_set; } -::std::set<::std::int32_t> AllocatorAware::get_aa_set() && { +::apache::thrift::fixtures::types::set_i32_7070 AllocatorAware::get_aa_set() && { return std::move(__fbthrift_field_aa_set); } -const ::std::map<::std::int32_t, ::std::int32_t>& AllocatorAware::get_aa_map() const& { +const ::apache::thrift::fixtures::types::map_i32_i32_9565& AllocatorAware::get_aa_map() const& { return __fbthrift_field_aa_map; } -::std::map<::std::int32_t, ::std::int32_t> AllocatorAware::get_aa_map() && { +::apache::thrift::fixtures::types::map_i32_i32_9565 AllocatorAware::get_aa_map() && { return std::move(__fbthrift_field_aa_map); } diff --git a/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.h index 34851676fe4..3f605e6f258 100644 --- a/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.h @@ -560,6 +560,15 @@ using ::apache::thrift::detail::operator>=; typedef ::std::string TBinary; typedef ::std::int32_t IntTypedef; typedef std::uint32_t UintTypedef; +typedef ::apache::thrift::fixtures::types::SomeListOfTypeMap SomeListOfTypeMap_2468; +typedef ::apache::thrift::fixtures::types::TBinary TBinary_8623; +typedef ::std::int32_t i32_9314; +typedef ::std::vector<::std::int32_t> list_i32_9187; +typedef ::std::map<::std::int32_t, ::std::int32_t> map_i32_i32_9565; +typedef folly::sorted_vector_map<::std::int32_t, ::std::string> map_i32_string_1261; +typedef ::std::set<::std::int32_t> set_i32_7070; +typedef folly::sorted_vector_set<::std::int32_t> set_i32_7194; +typedef ::std::string string_5252; class empty_struct final { private: @@ -875,7 +884,7 @@ class ContainerStruct final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - ContainerStruct(apache::thrift::FragileConstructor, ::std::vector<::std::int32_t> fieldA__arg, std::list<::std::int32_t> fieldB__arg, std::deque<::std::int32_t> fieldC__arg, folly::fbvector<::std::int32_t> fieldD__arg, folly::small_vector<::std::int32_t> fieldE__arg, folly::sorted_vector_set<::std::int32_t> fieldF__arg, folly::sorted_vector_map<::std::int32_t, ::std::string> fieldG__arg, ::apache::thrift::fixtures::types::SomeMap fieldH__arg); + ContainerStruct(apache::thrift::FragileConstructor, ::std::vector<::std::int32_t> fieldA__arg, std::list<::std::int32_t> fieldB__arg, std::deque<::std::int32_t> fieldC__arg, folly::fbvector<::std::int32_t> fieldD__arg, folly::small_vector<::std::int32_t> fieldE__arg, ::apache::thrift::fixtures::types::set_i32_7194 fieldF__arg, ::apache::thrift::fixtures::types::map_i32_string_1261 fieldG__arg, ::apache::thrift::fixtures::types::SomeMap fieldH__arg); ContainerStruct(ContainerStruct&&) noexcept; @@ -898,9 +907,9 @@ class ContainerStruct final { private: folly::small_vector<::std::int32_t> __fbthrift_field_fieldE; private: - folly::sorted_vector_set<::std::int32_t> __fbthrift_field_fieldF; + ::apache::thrift::fixtures::types::set_i32_7194 __fbthrift_field_fieldF; private: - folly::sorted_vector_map<::std::int32_t, ::std::string> __fbthrift_field_fieldG; + ::apache::thrift::fixtures::types::map_i32_string_1261 __fbthrift_field_fieldG; private: ::apache::thrift::fixtures::types::SomeMap __fbthrift_field_fieldH; private: @@ -1111,82 +1120,82 @@ class ContainerStruct final { return {static_cast(this->__fbthrift_field_fieldE), __isset.at(4), __isset.bit(4)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF_ref() const& { return {this->__fbthrift_field_fieldF, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF_ref() const&& { return {static_cast(this->__fbthrift_field_fieldF), __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF_ref() & { return {this->__fbthrift_field_fieldF, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF_ref() && { return {static_cast(this->__fbthrift_field_fieldF), __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF() const& { return {this->__fbthrift_field_fieldF, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF() const&& { return {static_cast(this->__fbthrift_field_fieldF), __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF() & { return {this->__fbthrift_field_fieldF, __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldF() && { return {static_cast(this->__fbthrift_field_fieldF), __isset.at(5), __isset.bit(5)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG_ref() const& { return {this->__fbthrift_field_fieldG, __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG_ref() const&& { return {static_cast(this->__fbthrift_field_fieldG), __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG_ref() & { return {this->__fbthrift_field_fieldG, __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG_ref() && { return {static_cast(this->__fbthrift_field_fieldG), __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG() const& { return {this->__fbthrift_field_fieldG, __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG() const&& { return {static_cast(this->__fbthrift_field_fieldG), __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG() & { return {this->__fbthrift_field_fieldG, __isset.at(6), __isset.bit(6)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref fieldG() && { return {static_cast(this->__fbthrift_field_fieldG), __isset.at(6), __isset.bit(6)}; } @@ -1275,21 +1284,21 @@ class ContainerStruct final { fieldE_ref() = std::forward(fieldE_); return __fbthrift_field_fieldE; } - const folly::sorted_vector_set<::std::int32_t>& get_fieldF() const&; - folly::sorted_vector_set<::std::int32_t> get_fieldF() &&; + const ::apache::thrift::fixtures::types::set_i32_7194& get_fieldF() const&; + ::apache::thrift::fixtures::types::set_i32_7194 get_fieldF() &&; - template > + template [[deprecated("Use `FOO.fieldF_ref() = BAR;` instead of `FOO.set_fieldF(BAR);`")]] - folly::sorted_vector_set<::std::int32_t>& set_fieldF(T_ContainerStruct_fieldF_struct_setter&& fieldF_) { + ::apache::thrift::fixtures::types::set_i32_7194& set_fieldF(T_ContainerStruct_fieldF_struct_setter&& fieldF_) { fieldF_ref() = std::forward(fieldF_); return __fbthrift_field_fieldF; } - const folly::sorted_vector_map<::std::int32_t, ::std::string>& get_fieldG() const&; - folly::sorted_vector_map<::std::int32_t, ::std::string> get_fieldG() &&; + const ::apache::thrift::fixtures::types::map_i32_string_1261& get_fieldG() const&; + ::apache::thrift::fixtures::types::map_i32_string_1261 get_fieldG() &&; - template > + template [[deprecated("Use `FOO.fieldG_ref() = BAR;` instead of `FOO.set_fieldG(BAR);`")]] - folly::sorted_vector_map<::std::int32_t, ::std::string>& set_fieldG(T_ContainerStruct_fieldG_struct_setter&& fieldG_) { + ::apache::thrift::fixtures::types::map_i32_string_1261& set_fieldG(T_ContainerStruct_fieldG_struct_setter&& fieldG_) { fieldG_ref() = std::forward(fieldG_); return __fbthrift_field_fieldG; } @@ -3982,7 +3991,7 @@ class AnnotatedTypes final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - AnnotatedTypes(apache::thrift::FragileConstructor, ::apache::thrift::fixtures::types::TBinary binary_field__arg, ::apache::thrift::fixtures::types::SomeListOfTypeMap list_field__arg); + AnnotatedTypes(apache::thrift::FragileConstructor, ::apache::thrift::fixtures::types::TBinary_8623 binary_field__arg, ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468 list_field__arg); AnnotatedTypes(AnnotatedTypes&&) noexcept; @@ -3995,9 +4004,9 @@ class AnnotatedTypes final { ~AnnotatedTypes(); private: - ::apache::thrift::fixtures::types::TBinary __fbthrift_field_binary_field; + ::apache::thrift::fixtures::types::TBinary_8623 __fbthrift_field_binary_field; private: - ::apache::thrift::fixtures::types::SomeListOfTypeMap __fbthrift_field_list_field; + ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468 __fbthrift_field_list_field; private: apache::thrift::detail::isset_bitset<2, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset; @@ -4006,106 +4015,106 @@ class AnnotatedTypes final { bool operator==(const AnnotatedTypes&) const; bool operator<(const AnnotatedTypes&) const; - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field_ref() const& { return {this->__fbthrift_field_binary_field, __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field_ref() const&& { return {static_cast(this->__fbthrift_field_binary_field), __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field_ref() & { return {this->__fbthrift_field_binary_field, __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field_ref() && { return {static_cast(this->__fbthrift_field_binary_field), __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field() const& { return {this->__fbthrift_field_binary_field, __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field() const&& { return {static_cast(this->__fbthrift_field_binary_field), __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field() & { return {this->__fbthrift_field_binary_field, __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref binary_field() && { return {static_cast(this->__fbthrift_field_binary_field), __isset.at(0), __isset.bit(0)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field_ref() const& { return {this->__fbthrift_field_list_field, __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field_ref() const&& { return {static_cast(this->__fbthrift_field_list_field), __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field_ref() & { return {this->__fbthrift_field_list_field, __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field_ref() && { return {static_cast(this->__fbthrift_field_list_field), __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field() const& { return {this->__fbthrift_field_list_field, __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field() const&& { return {static_cast(this->__fbthrift_field_list_field), __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field() & { return {this->__fbthrift_field_list_field, __isset.at(1), __isset.bit(1)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref list_field() && { return {static_cast(this->__fbthrift_field_list_field), __isset.at(1), __isset.bit(1)}; } - const ::apache::thrift::fixtures::types::TBinary& get_binary_field() const& { + const ::apache::thrift::fixtures::types::TBinary_8623& get_binary_field() const& { return __fbthrift_field_binary_field; } - ::apache::thrift::fixtures::types::TBinary get_binary_field() && { + ::apache::thrift::fixtures::types::TBinary_8623 get_binary_field() && { return std::move(__fbthrift_field_binary_field); } - template + template [[deprecated("Use `FOO.binary_field_ref() = BAR;` instead of `FOO.set_binary_field(BAR);`")]] - ::apache::thrift::fixtures::types::TBinary& set_binary_field(T_AnnotatedTypes_binary_field_struct_setter&& binary_field_) { + ::apache::thrift::fixtures::types::TBinary_8623& set_binary_field(T_AnnotatedTypes_binary_field_struct_setter&& binary_field_) { binary_field_ref() = std::forward(binary_field_); return __fbthrift_field_binary_field; } - const ::apache::thrift::fixtures::types::SomeListOfTypeMap& get_list_field() const&; - ::apache::thrift::fixtures::types::SomeListOfTypeMap get_list_field() &&; + const ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468& get_list_field() const&; + ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468 get_list_field() &&; - template + template [[deprecated("Use `FOO.list_field_ref() = BAR;` instead of `FOO.set_list_field(BAR);`")]] - ::apache::thrift::fixtures::types::SomeListOfTypeMap& set_list_field(T_AnnotatedTypes_list_field_struct_setter&& list_field_) { + ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468& set_list_field(T_AnnotatedTypes_list_field_struct_setter&& list_field_) { list_field_ref() = std::forward(list_field_); return __fbthrift_field_list_field; } @@ -6229,7 +6238,7 @@ class AllocatorAware final { // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - AllocatorAware(apache::thrift::FragileConstructor, ::std::vector<::std::int32_t> aa_list__arg, ::std::set<::std::int32_t> aa_set__arg, ::std::map<::std::int32_t, ::std::int32_t> aa_map__arg, ::std::string aa_string__arg, ::std::int32_t not_a_container__arg, ::std::unique_ptr<::std::int32_t> aa_unique__arg, ::std::shared_ptr<::std::int32_t> aa_shared__arg); + AllocatorAware(apache::thrift::FragileConstructor, ::apache::thrift::fixtures::types::list_i32_9187 aa_list__arg, ::apache::thrift::fixtures::types::set_i32_7070 aa_set__arg, ::apache::thrift::fixtures::types::map_i32_i32_9565 aa_map__arg, ::apache::thrift::fixtures::types::string_5252 aa_string__arg, ::std::int32_t not_a_container__arg, ::std::unique_ptr<::apache::thrift::fixtures::types::i32_9314> aa_unique__arg, ::std::shared_ptr<::apache::thrift::fixtures::types::i32_9314> aa_shared__arg); AllocatorAware(AllocatorAware&&) noexcept; AllocatorAware(const AllocatorAware& src); @@ -6241,8 +6250,8 @@ class AllocatorAware final { __fbthrift_field_aa_map(alloc), __fbthrift_field_aa_string(alloc), __fbthrift_field_not_a_container(), - __fbthrift_field_aa_unique(folly::allocate_unique<::std::int32_t>(alloc)), - __fbthrift_field_aa_shared(std::allocate_shared<::std::int32_t>(alloc)) {} + __fbthrift_field_aa_unique(folly::allocate_unique<::apache::thrift::fixtures::types::i32_9314>(alloc)), + __fbthrift_field_aa_shared(std::allocate_shared<::apache::thrift::fixtures::types::i32_9314>(alloc)) {} explicit AllocatorAware(const AllocatorAware& other, const allocator_type& alloc) : __fbthrift_alloc(alloc), @@ -6251,8 +6260,8 @@ class AllocatorAware final { __fbthrift_field_aa_map(other.__fbthrift_field_aa_map, alloc), __fbthrift_field_aa_string(other.__fbthrift_field_aa_string, alloc), __fbthrift_field_not_a_container(other.__fbthrift_field_not_a_container), - __fbthrift_field_aa_unique(folly::allocate_unique<::std::int32_t>(alloc, *other.__fbthrift_field_aa_unique)), - __fbthrift_field_aa_shared(std::allocate_shared<::std::int32_t>(alloc, *other.__fbthrift_field_aa_shared)), + __fbthrift_field_aa_unique(folly::allocate_unique<::apache::thrift::fixtures::types::i32_9314>(alloc, *other.__fbthrift_field_aa_unique)), + __fbthrift_field_aa_shared(std::allocate_shared<::apache::thrift::fixtures::types::i32_9314>(alloc, *other.__fbthrift_field_aa_shared)), __isset(other.__isset) {} explicit AllocatorAware(AllocatorAware&& other, const allocator_type& alloc) : @@ -6262,8 +6271,8 @@ class AllocatorAware final { __fbthrift_field_aa_map(std::move(other.__fbthrift_field_aa_map), alloc), __fbthrift_field_aa_string(std::move(other.__fbthrift_field_aa_string), alloc), __fbthrift_field_not_a_container(std::move(other.__fbthrift_field_not_a_container)), - __fbthrift_field_aa_unique(folly::allocate_unique<::std::int32_t>(alloc, std::move(*other.__fbthrift_field_aa_unique))), - __fbthrift_field_aa_shared(std::allocate_shared<::std::int32_t>(alloc, std::move(*other.__fbthrift_field_aa_shared))), + __fbthrift_field_aa_unique(folly::allocate_unique<::apache::thrift::fixtures::types::i32_9314>(alloc, std::move(*other.__fbthrift_field_aa_unique))), + __fbthrift_field_aa_shared(std::allocate_shared<::apache::thrift::fixtures::types::i32_9314>(alloc, std::move(*other.__fbthrift_field_aa_shared))), __isset(other.__isset) {} AllocatorAware& operator=(AllocatorAware&&) noexcept; @@ -6272,19 +6281,19 @@ class AllocatorAware final { ~AllocatorAware(); private: - ::std::vector<::std::int32_t> __fbthrift_field_aa_list; + ::apache::thrift::fixtures::types::list_i32_9187 __fbthrift_field_aa_list; private: - ::std::set<::std::int32_t> __fbthrift_field_aa_set; + ::apache::thrift::fixtures::types::set_i32_7070 __fbthrift_field_aa_set; private: - ::std::map<::std::int32_t, ::std::int32_t> __fbthrift_field_aa_map; + ::apache::thrift::fixtures::types::map_i32_i32_9565 __fbthrift_field_aa_map; private: - ::std::string __fbthrift_field_aa_string; + ::apache::thrift::fixtures::types::string_5252 __fbthrift_field_aa_string; private: ::std::int32_t __fbthrift_field_not_a_container; private: - ::std::unique_ptr<::std::int32_t> __fbthrift_field_aa_unique; + ::std::unique_ptr<::apache::thrift::fixtures::types::i32_9314> __fbthrift_field_aa_unique; private: - ::std::shared_ptr<::std::int32_t> __fbthrift_field_aa_shared; + ::std::shared_ptr<::apache::thrift::fixtures::types::i32_9314> __fbthrift_field_aa_shared; private: apache::thrift::detail::isset_bitset<5, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset; @@ -6293,162 +6302,162 @@ class AllocatorAware final { bool operator==(const AllocatorAware&) const; bool operator<(const AllocatorAware&) const; - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list_ref() const& { return {this->__fbthrift_field_aa_list, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list_ref() const&& { return {static_cast(this->__fbthrift_field_aa_list), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list_ref() & { return {this->__fbthrift_field_aa_list, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list_ref() && { return {static_cast(this->__fbthrift_field_aa_list), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list() const& { return {this->__fbthrift_field_aa_list, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list() const&& { return {static_cast(this->__fbthrift_field_aa_list), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list() & { return {this->__fbthrift_field_aa_list, __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_list() && { return {static_cast(this->__fbthrift_field_aa_list), __isset.at(0), __isset.bit(0)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set_ref() const& { return {this->__fbthrift_field_aa_set, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set_ref() const&& { return {static_cast(this->__fbthrift_field_aa_set), __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set_ref() & { return {this->__fbthrift_field_aa_set, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set_ref() && { return {static_cast(this->__fbthrift_field_aa_set), __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set() const& { return {this->__fbthrift_field_aa_set, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set() const&& { return {static_cast(this->__fbthrift_field_aa_set), __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set() & { return {this->__fbthrift_field_aa_set, __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_set() && { return {static_cast(this->__fbthrift_field_aa_set), __isset.at(1), __isset.bit(1)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map_ref() const& { return {this->__fbthrift_field_aa_map, __isset.at(2), __isset.bit(2)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map_ref() const&& { return {static_cast(this->__fbthrift_field_aa_map), __isset.at(2), __isset.bit(2)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map_ref() & { return {this->__fbthrift_field_aa_map, __isset.at(2), __isset.bit(2)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map_ref() && { return {static_cast(this->__fbthrift_field_aa_map), __isset.at(2), __isset.bit(2)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map() const& { return {this->__fbthrift_field_aa_map, __isset.at(2), __isset.bit(2)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map() const&& { return {static_cast(this->__fbthrift_field_aa_map), __isset.at(2), __isset.bit(2)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map() & { return {this->__fbthrift_field_aa_map, __isset.at(2), __isset.bit(2)}; } - template > + template FOLLY_ERASE ::apache::thrift::field_ref aa_map() && { return {static_cast(this->__fbthrift_field_aa_map), __isset.at(2), __isset.bit(2)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string_ref() const& { return {this->__fbthrift_field_aa_string, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string_ref() const&& { return {static_cast(this->__fbthrift_field_aa_string), __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string_ref() & { return {this->__fbthrift_field_aa_string, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string_ref() && { return {static_cast(this->__fbthrift_field_aa_string), __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string() const& { return {this->__fbthrift_field_aa_string, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string() const&& { return {static_cast(this->__fbthrift_field_aa_string), __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string() & { return {this->__fbthrift_field_aa_string, __isset.at(3), __isset.bit(3)}; } - template + template FOLLY_ERASE ::apache::thrift::field_ref aa_string() && { return {static_cast(this->__fbthrift_field_aa_string), __isset.at(3), __isset.bit(3)}; } @@ -6492,123 +6501,123 @@ class AllocatorAware final { FOLLY_ERASE ::apache::thrift::field_ref not_a_container() && { return {static_cast(this->__fbthrift_field_not_a_container), __isset.at(4), __isset.bit(4)}; } - template > + template > FOLLY_ERASE T& aa_unique_ref() & { return __fbthrift_field_aa_unique; } - template > + template > FOLLY_ERASE const T& aa_unique_ref() const& { return __fbthrift_field_aa_unique; } - template > + template > FOLLY_ERASE T&& aa_unique_ref() && { return static_cast(__fbthrift_field_aa_unique); } - template > + template > FOLLY_ERASE const T&& aa_unique_ref() const&& { return static_cast(__fbthrift_field_aa_unique); } - template > + template > FOLLY_ERASE T& aa_unique() & { return __fbthrift_field_aa_unique; } - template > + template > FOLLY_ERASE const T& aa_unique() const& { return __fbthrift_field_aa_unique; } - template > + template > FOLLY_ERASE T&& aa_unique() && { return static_cast(__fbthrift_field_aa_unique); } - template > + template > FOLLY_ERASE const T&& aa_unique() const&& { return static_cast(__fbthrift_field_aa_unique); } - template > + template > FOLLY_ERASE T& aa_shared_ref() & { return __fbthrift_field_aa_shared; } - template > + template > FOLLY_ERASE const T& aa_shared_ref() const& { return __fbthrift_field_aa_shared; } - template > + template > FOLLY_ERASE T&& aa_shared_ref() && { return static_cast(__fbthrift_field_aa_shared); } - template > + template > FOLLY_ERASE const T&& aa_shared_ref() const&& { return static_cast(__fbthrift_field_aa_shared); } - template > + template > FOLLY_ERASE T& aa_shared() & { return __fbthrift_field_aa_shared; } - template > + template > FOLLY_ERASE const T& aa_shared() const& { return __fbthrift_field_aa_shared; } - template > + template > FOLLY_ERASE T&& aa_shared() && { return static_cast(__fbthrift_field_aa_shared); } - template > + template > FOLLY_ERASE const T&& aa_shared() const&& { return static_cast(__fbthrift_field_aa_shared); } - const ::std::vector<::std::int32_t>& get_aa_list() const&; - ::std::vector<::std::int32_t> get_aa_list() &&; + const ::apache::thrift::fixtures::types::list_i32_9187& get_aa_list() const&; + ::apache::thrift::fixtures::types::list_i32_9187 get_aa_list() &&; - template > + template [[deprecated("Use `FOO.aa_list_ref() = BAR;` instead of `FOO.set_aa_list(BAR);`")]] - ::std::vector<::std::int32_t>& set_aa_list(T_AllocatorAware_aa_list_struct_setter&& aa_list_) { + ::apache::thrift::fixtures::types::list_i32_9187& set_aa_list(T_AllocatorAware_aa_list_struct_setter&& aa_list_) { aa_list_ref() = std::forward(aa_list_); return __fbthrift_field_aa_list; } - const ::std::set<::std::int32_t>& get_aa_set() const&; - ::std::set<::std::int32_t> get_aa_set() &&; + const ::apache::thrift::fixtures::types::set_i32_7070& get_aa_set() const&; + ::apache::thrift::fixtures::types::set_i32_7070 get_aa_set() &&; - template > + template [[deprecated("Use `FOO.aa_set_ref() = BAR;` instead of `FOO.set_aa_set(BAR);`")]] - ::std::set<::std::int32_t>& set_aa_set(T_AllocatorAware_aa_set_struct_setter&& aa_set_) { + ::apache::thrift::fixtures::types::set_i32_7070& set_aa_set(T_AllocatorAware_aa_set_struct_setter&& aa_set_) { aa_set_ref() = std::forward(aa_set_); return __fbthrift_field_aa_set; } - const ::std::map<::std::int32_t, ::std::int32_t>& get_aa_map() const&; - ::std::map<::std::int32_t, ::std::int32_t> get_aa_map() &&; + const ::apache::thrift::fixtures::types::map_i32_i32_9565& get_aa_map() const&; + ::apache::thrift::fixtures::types::map_i32_i32_9565 get_aa_map() &&; - template > + template [[deprecated("Use `FOO.aa_map_ref() = BAR;` instead of `FOO.set_aa_map(BAR);`")]] - ::std::map<::std::int32_t, ::std::int32_t>& set_aa_map(T_AllocatorAware_aa_map_struct_setter&& aa_map_) { + ::apache::thrift::fixtures::types::map_i32_i32_9565& set_aa_map(T_AllocatorAware_aa_map_struct_setter&& aa_map_) { aa_map_ref() = std::forward(aa_map_); return __fbthrift_field_aa_map; } - const ::std::string& get_aa_string() const& { + const ::apache::thrift::fixtures::types::string_5252& get_aa_string() const& { return __fbthrift_field_aa_string; } - ::std::string get_aa_string() && { + ::apache::thrift::fixtures::types::string_5252 get_aa_string() && { return std::move(__fbthrift_field_aa_string); } - template + template [[deprecated("Use `FOO.aa_string_ref() = BAR;` instead of `FOO.set_aa_string(BAR);`")]] - ::std::string& set_aa_string(T_AllocatorAware_aa_string_struct_setter&& aa_string_) { + ::apache::thrift::fixtures::types::string_5252& set_aa_string(T_AllocatorAware_aa_string_struct_setter&& aa_string_) { aa_string_ref() = std::forward(aa_string_); return __fbthrift_field_aa_string; } diff --git a/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.tcc b/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.tcc index 23f43f3874a..50d6249c638 100644 --- a/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.tcc +++ b/thrift/compiler/test/fixtures/types/gen-cpp2/module_types.tcc @@ -570,8 +570,8 @@ _readField_fieldE: _readField_fieldF: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_fieldF = folly::sorted_vector_set<::std::int32_t>(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, folly::sorted_vector_set<::std::int32_t>>::readWithContext(*iprot, this->__fbthrift_field_fieldF, _readState); + this->__fbthrift_field_fieldF = ::apache::thrift::fixtures::types::set_i32_7194(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7194>::readWithContext(*iprot, this->__fbthrift_field_fieldF, _readState); _readState.afterSubobject(iprot); } @@ -587,8 +587,8 @@ _readField_fieldF: _readField_fieldG: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_fieldG = folly::sorted_vector_map<::std::int32_t, ::std::string>(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, folly::sorted_vector_map<::std::int32_t, ::std::string>>::readWithContext(*iprot, this->__fbthrift_field_fieldG, _readState); + this->__fbthrift_field_fieldG = ::apache::thrift::fixtures::types::map_i32_string_1261(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::apache::thrift::fixtures::types::map_i32_string_1261>::readWithContext(*iprot, this->__fbthrift_field_fieldG, _readState); _readState.afterSubobject(iprot); } @@ -735,11 +735,11 @@ uint32_t ContainerStruct::serializedSize(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("fieldF", apache::thrift::protocol::T_SET, 6); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, folly::sorted_vector_set<::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_fieldF); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7194>::serializedSize(*prot_, this->__fbthrift_field_fieldF); } { xfer += prot_->serializedFieldSize("fieldG", apache::thrift::protocol::T_MAP, 7); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, folly::sorted_vector_map<::std::int32_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_fieldG); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::apache::thrift::fixtures::types::map_i32_string_1261>::serializedSize(*prot_, this->__fbthrift_field_fieldG); } { xfer += prot_->serializedFieldSize("fieldH", apache::thrift::protocol::T_MAP, 8); @@ -775,11 +775,11 @@ uint32_t ContainerStruct::serializedSizeZC(Protocol_ const* prot_) const { } { xfer += prot_->serializedFieldSize("fieldF", apache::thrift::protocol::T_SET, 6); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, folly::sorted_vector_set<::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_fieldF); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7194>::serializedSize(*prot_, this->__fbthrift_field_fieldF); } { xfer += prot_->serializedFieldSize("fieldG", apache::thrift::protocol::T_MAP, 7); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, folly::sorted_vector_map<::std::int32_t, ::std::string>>::serializedSize(*prot_, this->__fbthrift_field_fieldG); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::apache::thrift::fixtures::types::map_i32_string_1261>::serializedSize(*prot_, this->__fbthrift_field_fieldG); } { xfer += prot_->serializedFieldSize("fieldH", apache::thrift::protocol::T_MAP, 8); @@ -833,14 +833,14 @@ uint32_t ContainerStruct::write(Protocol_* prot_) const { constexpr int16_t kPrevFieldId = 5; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "fieldF", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, folly::sorted_vector_set<::std::int32_t>>::write(*prot_, this->__fbthrift_field_fieldF); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7194>::write(*prot_, this->__fbthrift_field_fieldF); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 6; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "fieldG", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, folly::sorted_vector_map<::std::int32_t, ::std::string>>::write(*prot_, this->__fbthrift_field_fieldG); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>, ::apache::thrift::fixtures::types::map_i32_string_1261>::write(*prot_, this->__fbthrift_field_fieldG); xfer += prot_->writeFieldEnd(); } { @@ -2866,7 +2866,7 @@ void AnnotatedTypes::readNoXfer(Protocol_* iprot) { } _readField_binary_field: { - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary>::readWithContext(*iprot, this->__fbthrift_field_binary_field, _readState); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary_8623>::readWithContext(*iprot, this->__fbthrift_field_binary_field, _readState); } this->__isset.set(0, true); @@ -2881,8 +2881,8 @@ _readField_binary_field: _readField_list_field: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_list_field = ::apache::thrift::fixtures::types::SomeListOfTypeMap(); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap>::readWithContext(*iprot, this->__fbthrift_field_list_field, _readState); + this->__fbthrift_field_list_field = ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468>::readWithContext(*iprot, this->__fbthrift_field_list_field, _readState); _readState.afterSubobject(iprot); } @@ -2944,11 +2944,11 @@ uint32_t AnnotatedTypes::serializedSize(Protocol_ const* prot_) const { xfer += prot_->serializedStructSize("AnnotatedTypes"); { xfer += prot_->serializedFieldSize("binary_field", apache::thrift::protocol::T_STRING, 1); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary>::serializedSize(*prot_, this->__fbthrift_field_binary_field); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary_8623>::serializedSize(*prot_, this->__fbthrift_field_binary_field); } { xfer += prot_->serializedFieldSize("list_field", apache::thrift::protocol::T_LIST, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap>::serializedSize(*prot_, this->__fbthrift_field_list_field); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468>::serializedSize(*prot_, this->__fbthrift_field_list_field); } xfer += prot_->serializedSizeStop(); return xfer; @@ -2960,11 +2960,11 @@ uint32_t AnnotatedTypes::serializedSizeZC(Protocol_ const* prot_) const { xfer += prot_->serializedStructSize("AnnotatedTypes"); { xfer += prot_->serializedFieldSize("binary_field", apache::thrift::protocol::T_STRING, 1); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary>::serializedSize(*prot_, this->__fbthrift_field_binary_field); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary_8623>::serializedSize(*prot_, this->__fbthrift_field_binary_field); } { xfer += prot_->serializedFieldSize("list_field", apache::thrift::protocol::T_LIST, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap>::serializedSize(*prot_, this->__fbthrift_field_list_field); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468>::serializedSize(*prot_, this->__fbthrift_field_list_field); } xfer += prot_->serializedSizeStop(); return xfer; @@ -2979,14 +2979,14 @@ uint32_t AnnotatedTypes::write(Protocol_* prot_) const { constexpr int16_t kPrevFieldId = 0; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "binary_field", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary>::write(*prot_, this->__fbthrift_field_binary_field); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::binary, ::apache::thrift::fixtures::types::TBinary_8623>::write(*prot_, this->__fbthrift_field_binary_field); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 1; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "list_field", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap>::write(*prot_, this->__fbthrift_field_list_field); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::string>>, ::apache::thrift::fixtures::types::SomeListOfTypeMap_2468>::write(*prot_, this->__fbthrift_field_list_field); xfer += prot_->writeFieldEnd(); } xfer += prot_->writeFieldStop(); @@ -4732,8 +4732,8 @@ void AllocatorAware::readNoXfer(Protocol_* iprot) { _readField_aa_list: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_aa_list = ::std::vector<::std::int32_t>(this->get_allocator()); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::std::vector<::std::int32_t>>::readWithContext(*iprot, this->__fbthrift_field_aa_list, _readState); + this->__fbthrift_field_aa_list = ::apache::thrift::fixtures::types::list_i32_9187(this->get_allocator()); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::list_i32_9187>::readWithContext(*iprot, this->__fbthrift_field_aa_list, _readState); _readState.afterSubobject(iprot); } @@ -4749,8 +4749,8 @@ _readField_aa_list: _readField_aa_set: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_aa_set = ::std::set<::std::int32_t>(this->get_allocator()); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::std::set<::std::int32_t>>::readWithContext(*iprot, this->__fbthrift_field_aa_set, _readState); + this->__fbthrift_field_aa_set = ::apache::thrift::fixtures::types::set_i32_7070(this->get_allocator()); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7070>::readWithContext(*iprot, this->__fbthrift_field_aa_set, _readState); _readState.afterSubobject(iprot); } @@ -4766,8 +4766,8 @@ _readField_aa_set: _readField_aa_map: { _readState.beforeSubobject(iprot); - this->__fbthrift_field_aa_map = ::std::map<::std::int32_t, ::std::int32_t>(this->get_allocator()); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::std::map<::std::int32_t, ::std::int32_t>>::readWithContext(*iprot, this->__fbthrift_field_aa_map, _readState); + this->__fbthrift_field_aa_map = ::apache::thrift::fixtures::types::map_i32_i32_9565(this->get_allocator()); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::map_i32_i32_9565>::readWithContext(*iprot, this->__fbthrift_field_aa_map, _readState); _readState.afterSubobject(iprot); } @@ -4782,7 +4782,7 @@ _readField_aa_map: } _readField_aa_string: { - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::readWithContext(*iprot, this->__fbthrift_field_aa_string, _readState); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::apache::thrift::fixtures::types::string_5252>::readWithContext(*iprot, this->__fbthrift_field_aa_string, _readState); } this->__isset.set(3, true); @@ -4810,8 +4810,8 @@ _readField_not_a_container: } _readField_aa_unique: { - auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::std::int32_t>>(this->get_allocator()); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::readWithContext(*iprot, *ptr, _readState); + auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::fixtures::types::i32_9314>>(this->get_allocator()); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::readWithContext(*iprot, *ptr, _readState); this->__fbthrift_field_aa_unique = std::move(ptr); } @@ -4825,8 +4825,8 @@ _readField_aa_unique: } _readField_aa_shared: { - auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::shared_ptr<::std::int32_t>>(this->get_allocator()); - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::readWithContext(*iprot, *ptr, _readState); + auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::shared_ptr<::apache::thrift::fixtures::types::i32_9314>>(this->get_allocator()); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::readWithContext(*iprot, *ptr, _readState); this->__fbthrift_field_aa_shared = std::move(ptr); } @@ -4927,19 +4927,19 @@ uint32_t AllocatorAware::serializedSize(Protocol_ const* prot_) const { xfer += prot_->serializedStructSize("AllocatorAware"); { xfer += prot_->serializedFieldSize("aa_list", apache::thrift::protocol::T_LIST, 1); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::std::vector<::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_aa_list); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::list_i32_9187>::serializedSize(*prot_, this->__fbthrift_field_aa_list); } { xfer += prot_->serializedFieldSize("aa_set", apache::thrift::protocol::T_SET, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::std::set<::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_aa_set); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7070>::serializedSize(*prot_, this->__fbthrift_field_aa_set); } { xfer += prot_->serializedFieldSize("aa_map", apache::thrift::protocol::T_MAP, 3); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::std::map<::std::int32_t, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_aa_map); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::map_i32_i32_9565>::serializedSize(*prot_, this->__fbthrift_field_aa_map); } { xfer += prot_->serializedFieldSize("aa_string", apache::thrift::protocol::T_STRING, 4); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::serializedSize(*prot_, this->__fbthrift_field_aa_string); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::apache::thrift::fixtures::types::string_5252>::serializedSize(*prot_, this->__fbthrift_field_aa_string); } { xfer += prot_->serializedFieldSize("not_a_container", apache::thrift::protocol::T_I32, 5); @@ -4948,13 +4948,13 @@ uint32_t AllocatorAware::serializedSize(Protocol_ const* prot_) const { { xfer += prot_->serializedFieldSize("aa_unique", apache::thrift::protocol::T_I32, 6); if (this->__fbthrift_field_aa_unique) { - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, *this->__fbthrift_field_aa_unique); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::serializedSize(*prot_, *this->__fbthrift_field_aa_unique); } } { xfer += prot_->serializedFieldSize("aa_shared", apache::thrift::protocol::T_I32, 7); if (this->__fbthrift_field_aa_shared) { - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, *this->__fbthrift_field_aa_shared); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::serializedSize(*prot_, *this->__fbthrift_field_aa_shared); } } xfer += prot_->serializedSizeStop(); @@ -4967,19 +4967,19 @@ uint32_t AllocatorAware::serializedSizeZC(Protocol_ const* prot_) const { xfer += prot_->serializedStructSize("AllocatorAware"); { xfer += prot_->serializedFieldSize("aa_list", apache::thrift::protocol::T_LIST, 1); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::std::vector<::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_aa_list); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::list_i32_9187>::serializedSize(*prot_, this->__fbthrift_field_aa_list); } { xfer += prot_->serializedFieldSize("aa_set", apache::thrift::protocol::T_SET, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::std::set<::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_aa_set); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7070>::serializedSize(*prot_, this->__fbthrift_field_aa_set); } { xfer += prot_->serializedFieldSize("aa_map", apache::thrift::protocol::T_MAP, 3); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::std::map<::std::int32_t, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_aa_map); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::map_i32_i32_9565>::serializedSize(*prot_, this->__fbthrift_field_aa_map); } { xfer += prot_->serializedFieldSize("aa_string", apache::thrift::protocol::T_STRING, 4); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::serializedSize(*prot_, this->__fbthrift_field_aa_string); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::apache::thrift::fixtures::types::string_5252>::serializedSize(*prot_, this->__fbthrift_field_aa_string); } { xfer += prot_->serializedFieldSize("not_a_container", apache::thrift::protocol::T_I32, 5); @@ -4988,13 +4988,13 @@ uint32_t AllocatorAware::serializedSizeZC(Protocol_ const* prot_) const { { xfer += prot_->serializedFieldSize("aa_unique", apache::thrift::protocol::T_I32, 6); if (this->__fbthrift_field_aa_unique) { - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, *this->__fbthrift_field_aa_unique); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::serializedSize(*prot_, *this->__fbthrift_field_aa_unique); } } { xfer += prot_->serializedFieldSize("aa_shared", apache::thrift::protocol::T_I32, 7); if (this->__fbthrift_field_aa_shared) { - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, *this->__fbthrift_field_aa_shared); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::serializedSize(*prot_, *this->__fbthrift_field_aa_shared); } } xfer += prot_->serializedSizeStop(); @@ -5010,28 +5010,28 @@ uint32_t AllocatorAware::write(Protocol_* prot_) const { constexpr int16_t kPrevFieldId = 0; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "aa_list", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::std::vector<::std::int32_t>>::write(*prot_, this->__fbthrift_field_aa_list); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::list_i32_9187>::write(*prot_, this->__fbthrift_field_aa_list); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 1; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "aa_set", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::std::set<::std::int32_t>>::write(*prot_, this->__fbthrift_field_aa_set); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::set_i32_7070>::write(*prot_, this->__fbthrift_field_aa_set); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 2; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "aa_map", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::std::map<::std::int32_t, ::std::int32_t>>::write(*prot_, this->__fbthrift_field_aa_map); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::fixtures::types::map_i32_i32_9565>::write(*prot_, this->__fbthrift_field_aa_map); xfer += prot_->writeFieldEnd(); } { constexpr int16_t kPrevFieldId = 3; xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "aa_string", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::write(*prot_, this->__fbthrift_field_aa_string); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::apache::thrift::fixtures::types::string_5252>::write(*prot_, this->__fbthrift_field_aa_string); xfer += prot_->writeFieldEnd(); } { @@ -5046,7 +5046,7 @@ uint32_t AllocatorAware::write(Protocol_* prot_) const { xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "aa_unique", previousFieldHasValue); previousFieldHasValue = true; if (this->__fbthrift_field_aa_unique) { - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::write(*prot_, *this->__fbthrift_field_aa_unique); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::write(*prot_, *this->__fbthrift_field_aa_unique); } xfer += prot_->writeFieldEnd(); } @@ -5055,7 +5055,7 @@ uint32_t AllocatorAware::write(Protocol_* prot_) const { xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "aa_shared", previousFieldHasValue); previousFieldHasValue = true; if (this->__fbthrift_field_aa_shared) { - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::write(*prot_, *this->__fbthrift_field_aa_shared); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::apache::thrift::fixtures::types::i32_9314>::write(*prot_, *this->__fbthrift_field_aa_shared); } xfer += prot_->writeFieldEnd(); } diff --git a/thrift/compiler/test/fixtures/types/gen-go/module/ttypes.go b/thrift/compiler/test/fixtures/types/gen-go/module/ttypes.go index 750b6d6b6ca..a650ecf5480 100644 --- a/thrift/compiler/test/fixtures/types/gen-go/module/ttypes.go +++ b/thrift/compiler/test/fixtures/types/gen-go/module/ttypes.go @@ -177,6 +177,42 @@ type UintTypedef = IntTypedef func UintTypedefPtr(v UintTypedef) *UintTypedef { return &v } +type SomeListOfTypeMap_2468 = included0.SomeListOfTypeMap + +func SomeListOfTypeMap_2468Ptr(v SomeListOfTypeMap_2468) *SomeListOfTypeMap_2468 { return &v } + +type TBinary_8623 = TBinary + +func TBinary_8623Ptr(v TBinary_8623) *TBinary_8623 { return &v } + +type I32_9314 = int32 + +func I32_9314Ptr(v I32_9314) *I32_9314 { return &v } + +type ListI32_9187 = []int32 + +func ListI32_9187Ptr(v ListI32_9187) *ListI32_9187 { return &v } + +type MapI32I32_9565 = map[int32]int32 + +func MapI32I32_9565Ptr(v MapI32I32_9565) *MapI32I32_9565 { return &v } + +type MapI32String_1261 = map[int32]string + +func MapI32String_1261Ptr(v MapI32String_1261) *MapI32String_1261 { return &v } + +type SetI32_7070 = []int32 + +func SetI32_7070Ptr(v SetI32_7070) *SetI32_7070 { return &v } + +type SetI32_7194 = []int32 + +func SetI32_7194Ptr(v SetI32_7194) *SetI32_7194 { return &v } + +type String_5252 = string + +func String_5252Ptr(v String_5252) *String_5252 { return &v } + type EmptyStruct struct { } @@ -3061,8 +3097,8 @@ func (p *Renaming) String() string { // - BinaryField // - ListField type AnnotatedTypes struct { - BinaryField TBinary `thrift:"binary_field,1" db:"binary_field" json:"binary_field"` - ListField included0.SomeListOfTypeMap `thrift:"list_field,2" db:"list_field" json:"list_field"` + BinaryField []byte `thrift:"binary_field,1" db:"binary_field" json:"binary_field"` + ListField []included0.SomeMap `thrift:"list_field,2" db:"list_field" json:"list_field"` } func NewAnnotatedTypes() *AnnotatedTypes { @@ -3070,11 +3106,11 @@ func NewAnnotatedTypes() *AnnotatedTypes { } -func (p *AnnotatedTypes) GetBinaryField() TBinary { +func (p *AnnotatedTypes) GetBinaryField() []byte { return p.BinaryField } -func (p *AnnotatedTypes) GetListField() included0.SomeListOfTypeMap { +func (p *AnnotatedTypes) GetListField() []included0.SomeMap { return p.ListField } type AnnotatedTypesBuilder struct { @@ -3094,22 +3130,22 @@ func (p AnnotatedTypesBuilder) Emit() *AnnotatedTypes{ } } -func (a *AnnotatedTypesBuilder) BinaryField(binaryField TBinary) *AnnotatedTypesBuilder { +func (a *AnnotatedTypesBuilder) BinaryField(binaryField []byte) *AnnotatedTypesBuilder { a.obj.BinaryField = binaryField return a } -func (a *AnnotatedTypesBuilder) ListField(listField included0.SomeListOfTypeMap) *AnnotatedTypesBuilder { +func (a *AnnotatedTypesBuilder) ListField(listField []included0.SomeMap) *AnnotatedTypesBuilder { a.obj.ListField = listField return a } -func (a *AnnotatedTypes) SetBinaryField(binaryField TBinary) *AnnotatedTypes { +func (a *AnnotatedTypes) SetBinaryField(binaryField []byte) *AnnotatedTypes { a.BinaryField = binaryField return a } -func (a *AnnotatedTypes) SetListField(listField included0.SomeListOfTypeMap) *AnnotatedTypes { +func (a *AnnotatedTypes) SetListField(listField []included0.SomeMap) *AnnotatedTypes { a.ListField = listField return a } @@ -3154,7 +3190,7 @@ func (p *AnnotatedTypes) ReadField1(iprot thrift.Protocol) error { if v, err := iprot.ReadBinary(); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { - temp := TBinary(v) + temp := TBinary_8623(v) p.BinaryField = temp } return nil @@ -3165,7 +3201,7 @@ func (p *AnnotatedTypes) ReadField2(iprot thrift.Protocol) error { if err != nil { return thrift.PrependError("error reading list begin: ", err) } - tSlice := make(included0.SomeListOfTypeMap, 0, size) + tSlice := make([]included0.SomeMap, 0, size) p.ListField = tSlice for i := 0; i < size; i ++ { _, _, size, err := iprot.ReadMapBegin() @@ -5351,7 +5387,8 @@ func (p *AllocatorAware) ReadField4(iprot thrift.Protocol) error { if v, err := iprot.ReadString(); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { - p.AaString = v + temp := String_5252(v) + p.AaString = temp } return nil } @@ -5369,7 +5406,8 @@ func (p *AllocatorAware) ReadField6(iprot thrift.Protocol) error { if v, err := iprot.ReadI32(); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { - p.AaUnique = &v + temp := I32_9314(v) + p.AaUnique = &temp } return nil } @@ -5378,7 +5416,8 @@ func (p *AllocatorAware) ReadField7(iprot thrift.Protocol) error { if v, err := iprot.ReadI32(); err != nil { return thrift.PrependError("error reading field 7: ", err) } else { - p.AaShared = &v + temp := I32_9314(v) + p.AaShared = &temp } return nil } diff --git a/thrift/compiler/test/fixtures/types/gen-go_mstch/module/metadata.go b/thrift/compiler/test/fixtures/types/gen-go_mstch/module/metadata.go index 899410b2d5e..b38fac394d6 100644 --- a/thrift/compiler/test/fixtures/types/gen-go_mstch/module/metadata.go +++ b/thrift/compiler/test/fixtures/types/gen-go_mstch/module/metadata.go @@ -26,10 +26,16 @@ var ( metadata.NewThriftListType(). SetValueType(premadeThriftType_i32), ) - premadeThriftType_set_i32 = metadata.NewThriftType().SetTSet( - metadata.NewThriftSetType(). - SetValueType(premadeThriftType_i32), - ) + premadeThriftType_module_set_i32_7194 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.set_i32_7194"). + SetUnderlyingType(premadeThriftType_set_i32), + ) + premadeThriftType_module_map_i32_string_1261 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.map_i32_string_1261"). + SetUnderlyingType(premadeThriftType_map_i32_string), + ) premadeThriftType_map_i32_string = metadata.NewThriftType().SetTMap( metadata.NewThriftMapType(). SetKeyType(premadeThriftType_i32). @@ -73,15 +79,15 @@ var ( metadata.NewThriftStructType(). SetName("module.MyDataItem"), ) - premadeThriftType_module_TBinary = metadata.NewThriftType().SetTTypedef( + premadeThriftType_module_TBinary_8623 = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). - SetName("module.TBinary"). - SetUnderlyingType(premadeThriftType_binary), + SetName("module.TBinary_8623"). + SetUnderlyingType(premadeThriftType_module_TBinary), ) - premadeThriftType_included_SomeListOfTypeMap = metadata.NewThriftType().SetTTypedef( + premadeThriftType_module_SomeListOfTypeMap_2468 = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). - SetName("included.SomeListOfTypeMap"). - SetUnderlyingType(premadeThriftType_list_included_SomeMap), + SetName("module.SomeListOfTypeMap_2468"). + SetUnderlyingType(premadeThriftType_included_SomeListOfTypeMap), ) premadeThriftType_module_ForwardUsageStruct = metadata.NewThriftType().SetTStruct( metadata.NewThriftStructType(). @@ -149,11 +155,31 @@ var ( metadata.NewThriftListType(). SetValueType(premadeThriftType_module_DependentAdaptedListDep), ) - premadeThriftType_map_i32_i32 = metadata.NewThriftType().SetTMap( - metadata.NewThriftMapType(). - SetKeyType(premadeThriftType_i32). - SetValueType(premadeThriftType_i32), - ) + premadeThriftType_module_list_i32_9187 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.list_i32_9187"). + SetUnderlyingType(premadeThriftType_list_i32), + ) + premadeThriftType_module_set_i32_7070 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.set_i32_7070"). + SetUnderlyingType(premadeThriftType_set_i32), + ) + premadeThriftType_module_map_i32_i32_9565 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.map_i32_i32_9565"). + SetUnderlyingType(premadeThriftType_map_i32_i32), + ) + premadeThriftType_module_string_5252 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.string_5252"). + SetUnderlyingType(premadeThriftType_string), + ) + premadeThriftType_module_i32_9314 = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.i32_9314"). + SetUnderlyingType(premadeThriftType_i32), + ) premadeThriftType_module_IntTypedef = metadata.NewThriftType().SetTTypedef( metadata.NewThriftTypedefType(). SetName("module.IntTypedef"). @@ -167,6 +193,25 @@ var ( premadeThriftType_binary = metadata.NewThriftType().SetTPrimitive( metadata.ThriftPrimitiveType_THRIFT_BINARY_TYPE.Ptr(), ) + premadeThriftType_included_SomeListOfTypeMap = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("included.SomeListOfTypeMap"). + SetUnderlyingType(premadeThriftType_list_included_SomeMap), + ) + premadeThriftType_module_TBinary = metadata.NewThriftType().SetTTypedef( + metadata.NewThriftTypedefType(). + SetName("module.TBinary"). + SetUnderlyingType(premadeThriftType_binary), + ) + premadeThriftType_map_i32_i32 = metadata.NewThriftType().SetTMap( + metadata.NewThriftMapType(). + SetKeyType(premadeThriftType_i32). + SetValueType(premadeThriftType_i32), + ) + premadeThriftType_set_i32 = metadata.NewThriftType().SetTSet( + metadata.NewThriftSetType(). + SetValueType(premadeThriftType_i32), + ) premadeThriftType_map_module_TBinary_i64 = metadata.NewThriftType().SetTMap( metadata.NewThriftMapType(). SetKeyType(premadeThriftType_module_TBinary). @@ -223,12 +268,12 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(6). SetName("fieldF"). SetIsOptional(false). - SetType(premadeThriftType_set_i32), + SetType(premadeThriftType_module_set_i32_7194), metadata.NewThriftField(). SetId(7). SetName("fieldG"). SetIsOptional(false). - SetType(premadeThriftType_map_i32_string), + SetType(premadeThriftType_module_map_i32_string_1261), metadata.NewThriftField(). SetId(8). SetName("fieldH"). @@ -465,12 +510,12 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(1). SetName("binary_field"). SetIsOptional(false). - SetType(premadeThriftType_module_TBinary), + SetType(premadeThriftType_module_TBinary_8623), metadata.NewThriftField(). SetId(2). SetName("list_field"). SetIsOptional(false). - SetType(premadeThriftType_included_SomeListOfTypeMap), + SetType(premadeThriftType_module_SomeListOfTypeMap_2468), }, ), metadata.NewThriftStruct(). @@ -631,22 +676,22 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(1). SetName("aa_list"). SetIsOptional(false). - SetType(premadeThriftType_list_i32), + SetType(premadeThriftType_module_list_i32_9187), metadata.NewThriftField(). SetId(2). SetName("aa_set"). SetIsOptional(false). - SetType(premadeThriftType_set_i32), + SetType(premadeThriftType_module_set_i32_7070), metadata.NewThriftField(). SetId(3). SetName("aa_map"). SetIsOptional(false). - SetType(premadeThriftType_map_i32_i32), + SetType(premadeThriftType_module_map_i32_i32_9565), metadata.NewThriftField(). SetId(4). SetName("aa_string"). SetIsOptional(false). - SetType(premadeThriftType_string), + SetType(premadeThriftType_module_string_5252), metadata.NewThriftField(). SetId(5). SetName("not_a_container"). @@ -656,12 +701,12 @@ var structMetadatas = []*metadata.ThriftStruct{ SetId(6). SetName("aa_unique"). SetIsOptional(false). - SetType(premadeThriftType_i32), + SetType(premadeThriftType_module_i32_9314), metadata.NewThriftField(). SetId(7). SetName("aa_shared"). SetIsOptional(false). - SetType(premadeThriftType_i32), + SetType(premadeThriftType_module_i32_9314), }, ), metadata.NewThriftStruct(). diff --git a/thrift/compiler/test/fixtures/types/gen-go_mstch/module/types.go b/thrift/compiler/test/fixtures/types/gen-go_mstch/module/types.go index 4ffe5711903..b42e0b186e4 100644 --- a/thrift/compiler/test/fixtures/types/gen-go_mstch/module/types.go +++ b/thrift/compiler/test/fixtures/types/gen-go_mstch/module/types.go @@ -97,6 +97,421 @@ if err != nil { return decodeResult, decodeErr } +type SomeListOfTypeMap_2468 = included.SomeListOfTypeMap + +func NewSomeListOfTypeMap_2468() SomeListOfTypeMap_2468 { + return included.NewSomeListOfTypeMap() +} + +func WriteSomeListOfTypeMap_2468(item SomeListOfTypeMap_2468, p thrift.Protocol) error { + err := included.WriteSomeListOfTypeMap(item, p) +if err != nil { + return err +} + return nil +} + +func ReadSomeListOfTypeMap_2468(p thrift.Protocol) (SomeListOfTypeMap_2468, error) { + var decodeResult SomeListOfTypeMap_2468 + decodeErr := func() error { + result, err := included.ReadSomeListOfTypeMap(p) +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type TBinary_8623 = TBinary + +func NewTBinary_8623() TBinary_8623 { + return NewTBinary() +} + +func WriteTBinary_8623(item TBinary_8623, p thrift.Protocol) error { + err := WriteTBinary(item, p) +if err != nil { + return err +} + return nil +} + +func ReadTBinary_8623(p thrift.Protocol) (TBinary_8623, error) { + var decodeResult TBinary_8623 + decodeErr := func() error { + result, err := ReadTBinary(p) +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type I32_9314 = int32 + +func NewI32_9314() I32_9314 { + return 0 +} + +func WriteI32_9314(item I32_9314, p thrift.Protocol) error { + if err := p.WriteI32(item); err != nil { + return err +} + return nil +} + +func ReadI32_9314(p thrift.Protocol) (I32_9314, error) { + var decodeResult I32_9314 + decodeErr := func() error { + result, err := p.ReadI32() +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type ListI32_9187 = []int32 + +func NewListI32_9187() ListI32_9187 { + return make([]int32, 0) +} + +func WriteListI32_9187(item ListI32_9187, p thrift.Protocol) error { + if err := p.WriteListBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing list begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteListEnd(); err != nil { + return thrift.PrependError("error writing list end: ", err) +} + return nil +} + +func ReadListI32_9187(p thrift.Protocol) (ListI32_9187, error) { + var decodeResult ListI32_9187 + decodeErr := func() error { + _ /* elemType */, size, err := p.ReadListBegin() +if err != nil { + return thrift.PrependError("error reading list begin: ", err) +} + +listResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + listResult = append(listResult, elem) +} + +if err := p.ReadListEnd(); err != nil { + return thrift.PrependError("error reading list end: ", err) +} +result := listResult + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type MapI32I32_9565 = map[int32]int32 + +func NewMapI32I32_9565() MapI32I32_9565 { + return make(map[int32]int32) +} + +func WriteMapI32I32_9565(item MapI32I32_9565, p thrift.Protocol) error { + if err := p.WriteMapBegin(thrift.I32, thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteI32(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + return nil +} + +func ReadMapI32I32_9565(p thrift.Protocol) (MapI32I32_9565, error) { + var decodeResult MapI32I32_9565 + decodeErr := func() error { + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[int32]int32, size) +for i := 0; i < size; i++ { + var key int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + key = result + } + + var value int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type MapI32String_1261 = map[int32]string + +func NewMapI32String_1261() MapI32String_1261 { + return make(map[int32]string) +} + +func WriteMapI32String_1261(item MapI32String_1261, p thrift.Protocol) error { + if err := p.WriteMapBegin(thrift.I32, thrift.STRING, len(item)); err != nil { + return thrift.PrependError("error writing map begin: ", err) +} +for k, v := range item { + { + item := k + if err := p.WriteI32(item); err != nil { + return err +} + } + + { + item := v + if err := p.WriteString(item); err != nil { + return err +} + } +} +if err := p.WriteMapEnd(); err != nil { + return thrift.PrependError("error writing map end: ", err) +} + return nil +} + +func ReadMapI32String_1261(p thrift.Protocol) (MapI32String_1261, error) { + var decodeResult MapI32String_1261 + decodeErr := func() error { + _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() +if err != nil { + return thrift.PrependError("error reading map begin: ", err) +} + +mapResult := make(map[int32]string, size) +for i := 0; i < size; i++ { + var key int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + key = result + } + + var value string + { + result, err := p.ReadString() +if err != nil { + return err +} + value = result + } + + mapResult[key] = value +} + +if err := p.ReadMapEnd(); err != nil { + return thrift.PrependError("error reading map end: ", err) +} +result := mapResult + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type SetI32_7070 = []int32 + +func NewSetI32_7070() SetI32_7070 { + return make([]int32, 0) +} + +func WriteSetI32_7070(item SetI32_7070, p thrift.Protocol) error { + if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + return nil +} + +func ReadSetI32_7070(p thrift.Protocol) (SetI32_7070, error) { + var decodeResult SetI32_7070 + decodeErr := func() error { + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type SetI32_7194 = []int32 + +func NewSetI32_7194() SetI32_7194 { + return make([]int32, 0) +} + +func WriteSetI32_7194(item SetI32_7194, p thrift.Protocol) error { + if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { + return thrift.PrependError("error writing set begin: ", err) +} +for _, v := range item { + { + item := v + if err := p.WriteI32(item); err != nil { + return err +} + } +} +if err := p.WriteSetEnd(); err != nil { + return thrift.PrependError("error writing set end: ", err) +} + return nil +} + +func ReadSetI32_7194(p thrift.Protocol) (SetI32_7194, error) { + var decodeResult SetI32_7194 + decodeErr := func() error { + _ /* elemType */, size, err := p.ReadSetBegin() +if err != nil { + return thrift.PrependError("error reading set begin: ", err) +} + +setResult := make([]int32, 0, size) +for i := 0; i < size; i++ { + var elem int32 + { + result, err := p.ReadI32() +if err != nil { + return err +} + elem = result + } + setResult = append(setResult, elem) +} + +if err := p.ReadSetEnd(); err != nil { + return thrift.PrependError("error reading set end: ", err) +} +result := setResult + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + +type String_5252 = string + +func NewString_5252() String_5252 { + return "" +} + +func WriteString_5252(item String_5252, p thrift.Protocol) error { + if err := p.WriteString(item); err != nil { + return err +} + return nil +} + +func ReadString_5252(p thrift.Protocol) (String_5252, error) { + var decodeResult String_5252 + decodeErr := func() error { + result, err := p.ReadString() +if err != nil { + return err +} + decodeResult = result + return nil + }() + return decodeResult, decodeErr +} + type HasBitwiseOps int32 const ( @@ -534,8 +949,8 @@ type ContainerStruct struct { FieldC []int32 `thrift:"fieldC,3" json:"fieldC" db:"fieldC"` FieldD []int32 `thrift:"fieldD,4" json:"fieldD" db:"fieldD"` FieldE []int32 `thrift:"fieldE,5" json:"fieldE" db:"fieldE"` - FieldF []int32 `thrift:"fieldF,6" json:"fieldF" db:"fieldF"` - FieldG map[int32]string `thrift:"fieldG,7" json:"fieldG" db:"fieldG"` + FieldF SetI32_7194 `thrift:"fieldF,6" json:"fieldF" db:"fieldF"` + FieldG MapI32String_1261 `thrift:"fieldG,7" json:"fieldG" db:"fieldG"` FieldH included.SomeMap `thrift:"fieldH,8" json:"fieldH" db:"fieldH"` FieldA []int32 `thrift:"fieldA,12" json:"fieldA" db:"fieldA"` } @@ -548,8 +963,8 @@ func NewContainerStruct() *ContainerStruct { SetFieldCNonCompat(make([]int32, 0)). SetFieldDNonCompat(make([]int32, 0)). SetFieldENonCompat(make([]int32, 0)). - SetFieldFNonCompat(make([]int32, 0)). - SetFieldGNonCompat(make(map[int32]string)). + SetFieldFNonCompat(NewSetI32_7194()). + SetFieldGNonCompat(NewMapI32String_1261()). SetFieldHNonCompat(included.NewSomeMap()). SetFieldANonCompat(make([]int32, 0)) } @@ -602,25 +1017,25 @@ func (x *ContainerStruct) GetFieldE() []int32 { return x.FieldE } -func (x *ContainerStruct) GetFieldFNonCompat() []int32 { +func (x *ContainerStruct) GetFieldFNonCompat() SetI32_7194 { return x.FieldF } -func (x *ContainerStruct) GetFieldF() []int32 { +func (x *ContainerStruct) GetFieldF() SetI32_7194 { if !x.IsSetFieldF() { - return make([]int32, 0) + return NewSetI32_7194() } return x.FieldF } -func (x *ContainerStruct) GetFieldGNonCompat() map[int32]string { +func (x *ContainerStruct) GetFieldGNonCompat() MapI32String_1261 { return x.FieldG } -func (x *ContainerStruct) GetFieldG() map[int32]string { +func (x *ContainerStruct) GetFieldG() MapI32String_1261 { if !x.IsSetFieldG() { - return make(map[int32]string) + return NewMapI32String_1261() } return x.FieldG @@ -690,22 +1105,22 @@ func (x *ContainerStruct) SetFieldE(value []int32) *ContainerStruct { return x } -func (x *ContainerStruct) SetFieldFNonCompat(value []int32) *ContainerStruct { +func (x *ContainerStruct) SetFieldFNonCompat(value SetI32_7194) *ContainerStruct { x.FieldF = value return x } -func (x *ContainerStruct) SetFieldF(value []int32) *ContainerStruct { +func (x *ContainerStruct) SetFieldF(value SetI32_7194) *ContainerStruct { x.FieldF = value return x } -func (x *ContainerStruct) SetFieldGNonCompat(value map[int32]string) *ContainerStruct { +func (x *ContainerStruct) SetFieldGNonCompat(value MapI32String_1261) *ContainerStruct { x.FieldG = value return x } -func (x *ContainerStruct) SetFieldG(value map[int32]string) *ContainerStruct { +func (x *ContainerStruct) SetFieldG(value MapI32String_1261) *ContainerStruct { x.FieldG = value return x } @@ -876,20 +1291,10 @@ func (x *ContainerStruct) writeField6(p thrift.Protocol) error { // FieldF } item := x.GetFieldFNonCompat() - if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { + err := WriteSetI32_7194(item, p) +if err != nil { return err } - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -903,27 +1308,10 @@ func (x *ContainerStruct) writeField7(p thrift.Protocol) error { // FieldG } item := x.GetFieldGNonCompat() - if err := p.WriteMapBegin(thrift.I32, thrift.STRING, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteI32(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteString(item); err != nil { + err := WriteMapI32String_1261(item, p) +if err != nil { return err } - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -1088,66 +1476,20 @@ result := listResult } func (x *ContainerStruct) readField6(p thrift.Protocol) error { // FieldF - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() + result, err := ReadSetI32_7194(p) if err != nil { return err } - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult x.SetFieldFNonCompat(result) return nil } func (x *ContainerStruct) readField7(p thrift.Protocol) error { // FieldG - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[int32]string, size) -for i := 0; i < size; i++ { - var key int32 - { - result, err := p.ReadI32() + result, err := ReadMapI32String_1261(p) if err != nil { return err } - key = result - } - - var value string - { - result, err := p.ReadString() -if err != nil { - return err -} - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult x.SetFieldGNonCompat(result) return nil @@ -1268,14 +1610,14 @@ func (x *ContainerStructBuilder) FieldE(value []int32) *ContainerStructBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewContainerStruct().Set().Set() -func (x *ContainerStructBuilder) FieldF(value []int32) *ContainerStructBuilder { +func (x *ContainerStructBuilder) FieldF(value SetI32_7194) *ContainerStructBuilder { x.obj.FieldF = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewContainerStruct().Set().Set() -func (x *ContainerStructBuilder) FieldG(value map[int32]string) *ContainerStructBuilder { +func (x *ContainerStructBuilder) FieldG(value MapI32String_1261) *ContainerStructBuilder { x.obj.FieldG = value return x } @@ -4510,58 +4852,58 @@ func (x *Renaming) String() string { } type AnnotatedTypes struct { - BinaryField TBinary `thrift:"binary_field,1" json:"binary_field" db:"binary_field"` - ListField included.SomeListOfTypeMap `thrift:"list_field,2" json:"list_field" db:"list_field"` + BinaryField TBinary_8623 `thrift:"binary_field,1" json:"binary_field" db:"binary_field"` + ListField SomeListOfTypeMap_2468 `thrift:"list_field,2" json:"list_field" db:"list_field"` } // Compile time interface enforcer var _ thrift.Struct = &AnnotatedTypes{} func NewAnnotatedTypes() *AnnotatedTypes { return (&AnnotatedTypes{}). - SetBinaryFieldNonCompat(NewTBinary()). - SetListFieldNonCompat(included.NewSomeListOfTypeMap()) + SetBinaryFieldNonCompat(NewTBinary_8623()). + SetListFieldNonCompat(NewSomeListOfTypeMap_2468()) } -func (x *AnnotatedTypes) GetBinaryFieldNonCompat() TBinary { +func (x *AnnotatedTypes) GetBinaryFieldNonCompat() TBinary_8623 { return x.BinaryField } -func (x *AnnotatedTypes) GetBinaryField() TBinary { +func (x *AnnotatedTypes) GetBinaryField() TBinary_8623 { if !x.IsSetBinaryField() { - return NewTBinary() + return NewTBinary_8623() } return x.BinaryField } -func (x *AnnotatedTypes) GetListFieldNonCompat() included.SomeListOfTypeMap { +func (x *AnnotatedTypes) GetListFieldNonCompat() SomeListOfTypeMap_2468 { return x.ListField } -func (x *AnnotatedTypes) GetListField() included.SomeListOfTypeMap { +func (x *AnnotatedTypes) GetListField() SomeListOfTypeMap_2468 { if !x.IsSetListField() { - return included.NewSomeListOfTypeMap() + return NewSomeListOfTypeMap_2468() } return x.ListField } -func (x *AnnotatedTypes) SetBinaryFieldNonCompat(value TBinary) *AnnotatedTypes { +func (x *AnnotatedTypes) SetBinaryFieldNonCompat(value TBinary_8623) *AnnotatedTypes { x.BinaryField = value return x } -func (x *AnnotatedTypes) SetBinaryField(value TBinary) *AnnotatedTypes { +func (x *AnnotatedTypes) SetBinaryField(value TBinary_8623) *AnnotatedTypes { x.BinaryField = value return x } -func (x *AnnotatedTypes) SetListFieldNonCompat(value included.SomeListOfTypeMap) *AnnotatedTypes { +func (x *AnnotatedTypes) SetListFieldNonCompat(value SomeListOfTypeMap_2468) *AnnotatedTypes { x.ListField = value return x } -func (x *AnnotatedTypes) SetListField(value included.SomeListOfTypeMap) *AnnotatedTypes { +func (x *AnnotatedTypes) SetListField(value SomeListOfTypeMap_2468) *AnnotatedTypes { x.ListField = value return x } @@ -4580,7 +4922,7 @@ func (x *AnnotatedTypes) writeField1(p thrift.Protocol) error { // BinaryField } item := x.GetBinaryFieldNonCompat() - err := WriteTBinary(item, p) + err := WriteTBinary_8623(item, p) if err != nil { return err } @@ -4597,7 +4939,7 @@ func (x *AnnotatedTypes) writeField2(p thrift.Protocol) error { // ListField } item := x.GetListFieldNonCompat() - err := included.WriteSomeListOfTypeMap(item, p) + err := WriteSomeListOfTypeMap_2468(item, p) if err != nil { return err } @@ -4609,7 +4951,7 @@ if err != nil { } func (x *AnnotatedTypes) readField1(p thrift.Protocol) error { // BinaryField - result, err := ReadTBinary(p) + result, err := ReadTBinary_8623(p) if err != nil { return err } @@ -4619,7 +4961,7 @@ if err != nil { } func (x *AnnotatedTypes) readField2(p thrift.Protocol) error { // ListField - result, err := included.ReadSomeListOfTypeMap(p) + result, err := ReadSomeListOfTypeMap_2468(p) if err != nil { return err } @@ -4653,14 +4995,14 @@ func NewAnnotatedTypesBuilder() *AnnotatedTypesBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAnnotatedTypes().Set().Set() -func (x *AnnotatedTypesBuilder) BinaryField(value TBinary) *AnnotatedTypesBuilder { +func (x *AnnotatedTypesBuilder) BinaryField(value TBinary_8623) *AnnotatedTypesBuilder { x.obj.BinaryField = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAnnotatedTypes().Set().Set() -func (x *AnnotatedTypesBuilder) ListField(value included.SomeListOfTypeMap) *AnnotatedTypesBuilder { +func (x *AnnotatedTypesBuilder) ListField(value SomeListOfTypeMap_2468) *AnnotatedTypesBuilder { x.obj.ListField = value return x } @@ -7336,69 +7678,69 @@ func (x *DependentAdaptedListDep) String() string { } type AllocatorAware struct { - AaList []int32 `thrift:"aa_list,1" json:"aa_list" db:"aa_list"` - AaSet []int32 `thrift:"aa_set,2" json:"aa_set" db:"aa_set"` - AaMap map[int32]int32 `thrift:"aa_map,3" json:"aa_map" db:"aa_map"` - AaString string `thrift:"aa_string,4" json:"aa_string" db:"aa_string"` + AaList ListI32_9187 `thrift:"aa_list,1" json:"aa_list" db:"aa_list"` + AaSet SetI32_7070 `thrift:"aa_set,2" json:"aa_set" db:"aa_set"` + AaMap MapI32I32_9565 `thrift:"aa_map,3" json:"aa_map" db:"aa_map"` + AaString String_5252 `thrift:"aa_string,4" json:"aa_string" db:"aa_string"` NotAContainer int32 `thrift:"not_a_container,5" json:"not_a_container" db:"not_a_container"` - AaUnique int32 `thrift:"aa_unique,6" json:"aa_unique" db:"aa_unique"` - AaShared int32 `thrift:"aa_shared,7" json:"aa_shared" db:"aa_shared"` + AaUnique I32_9314 `thrift:"aa_unique,6" json:"aa_unique" db:"aa_unique"` + AaShared I32_9314 `thrift:"aa_shared,7" json:"aa_shared" db:"aa_shared"` } // Compile time interface enforcer var _ thrift.Struct = &AllocatorAware{} func NewAllocatorAware() *AllocatorAware { return (&AllocatorAware{}). - SetAaListNonCompat(make([]int32, 0)). - SetAaSetNonCompat(make([]int32, 0)). - SetAaMapNonCompat(make(map[int32]int32)). - SetAaStringNonCompat(""). + SetAaListNonCompat(NewListI32_9187()). + SetAaSetNonCompat(NewSetI32_7070()). + SetAaMapNonCompat(NewMapI32I32_9565()). + SetAaStringNonCompat(NewString_5252()). SetNotAContainerNonCompat(0). - SetAaUniqueNonCompat(0). - SetAaSharedNonCompat(0) + SetAaUniqueNonCompat(NewI32_9314()). + SetAaSharedNonCompat(NewI32_9314()) } -func (x *AllocatorAware) GetAaListNonCompat() []int32 { +func (x *AllocatorAware) GetAaListNonCompat() ListI32_9187 { return x.AaList } -func (x *AllocatorAware) GetAaList() []int32 { +func (x *AllocatorAware) GetAaList() ListI32_9187 { if !x.IsSetAaList() { - return make([]int32, 0) + return NewListI32_9187() } return x.AaList } -func (x *AllocatorAware) GetAaSetNonCompat() []int32 { +func (x *AllocatorAware) GetAaSetNonCompat() SetI32_7070 { return x.AaSet } -func (x *AllocatorAware) GetAaSet() []int32 { +func (x *AllocatorAware) GetAaSet() SetI32_7070 { if !x.IsSetAaSet() { - return make([]int32, 0) + return NewSetI32_7070() } return x.AaSet } -func (x *AllocatorAware) GetAaMapNonCompat() map[int32]int32 { +func (x *AllocatorAware) GetAaMapNonCompat() MapI32I32_9565 { return x.AaMap } -func (x *AllocatorAware) GetAaMap() map[int32]int32 { +func (x *AllocatorAware) GetAaMap() MapI32I32_9565 { if !x.IsSetAaMap() { - return make(map[int32]int32) + return NewMapI32I32_9565() } return x.AaMap } -func (x *AllocatorAware) GetAaStringNonCompat() string { +func (x *AllocatorAware) GetAaStringNonCompat() String_5252 { return x.AaString } -func (x *AllocatorAware) GetAaString() string { +func (x *AllocatorAware) GetAaString() String_5252 { return x.AaString } @@ -7410,58 +7752,58 @@ func (x *AllocatorAware) GetNotAContainer() int32 { return x.NotAContainer } -func (x *AllocatorAware) GetAaUniqueNonCompat() int32 { +func (x *AllocatorAware) GetAaUniqueNonCompat() I32_9314 { return x.AaUnique } -func (x *AllocatorAware) GetAaUnique() int32 { +func (x *AllocatorAware) GetAaUnique() I32_9314 { return x.AaUnique } -func (x *AllocatorAware) GetAaSharedNonCompat() int32 { +func (x *AllocatorAware) GetAaSharedNonCompat() I32_9314 { return x.AaShared } -func (x *AllocatorAware) GetAaShared() int32 { +func (x *AllocatorAware) GetAaShared() I32_9314 { return x.AaShared } -func (x *AllocatorAware) SetAaListNonCompat(value []int32) *AllocatorAware { +func (x *AllocatorAware) SetAaListNonCompat(value ListI32_9187) *AllocatorAware { x.AaList = value return x } -func (x *AllocatorAware) SetAaList(value []int32) *AllocatorAware { +func (x *AllocatorAware) SetAaList(value ListI32_9187) *AllocatorAware { x.AaList = value return x } -func (x *AllocatorAware) SetAaSetNonCompat(value []int32) *AllocatorAware { +func (x *AllocatorAware) SetAaSetNonCompat(value SetI32_7070) *AllocatorAware { x.AaSet = value return x } -func (x *AllocatorAware) SetAaSet(value []int32) *AllocatorAware { +func (x *AllocatorAware) SetAaSet(value SetI32_7070) *AllocatorAware { x.AaSet = value return x } -func (x *AllocatorAware) SetAaMapNonCompat(value map[int32]int32) *AllocatorAware { +func (x *AllocatorAware) SetAaMapNonCompat(value MapI32I32_9565) *AllocatorAware { x.AaMap = value return x } -func (x *AllocatorAware) SetAaMap(value map[int32]int32) *AllocatorAware { +func (x *AllocatorAware) SetAaMap(value MapI32I32_9565) *AllocatorAware { x.AaMap = value return x } -func (x *AllocatorAware) SetAaStringNonCompat(value string) *AllocatorAware { +func (x *AllocatorAware) SetAaStringNonCompat(value String_5252) *AllocatorAware { x.AaString = value return x } -func (x *AllocatorAware) SetAaString(value string) *AllocatorAware { +func (x *AllocatorAware) SetAaString(value String_5252) *AllocatorAware { x.AaString = value return x } @@ -7476,22 +7818,22 @@ func (x *AllocatorAware) SetNotAContainer(value int32) *AllocatorAware { return x } -func (x *AllocatorAware) SetAaUniqueNonCompat(value int32) *AllocatorAware { +func (x *AllocatorAware) SetAaUniqueNonCompat(value I32_9314) *AllocatorAware { x.AaUnique = value return x } -func (x *AllocatorAware) SetAaUnique(value int32) *AllocatorAware { +func (x *AllocatorAware) SetAaUnique(value I32_9314) *AllocatorAware { x.AaUnique = value return x } -func (x *AllocatorAware) SetAaSharedNonCompat(value int32) *AllocatorAware { +func (x *AllocatorAware) SetAaSharedNonCompat(value I32_9314) *AllocatorAware { x.AaShared = value return x } -func (x *AllocatorAware) SetAaShared(value int32) *AllocatorAware { +func (x *AllocatorAware) SetAaShared(value I32_9314) *AllocatorAware { x.AaShared = value return x } @@ -7514,20 +7856,10 @@ func (x *AllocatorAware) writeField1(p thrift.Protocol) error { // AaList } item := x.GetAaListNonCompat() - if err := p.WriteListBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing list begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { + err := WriteListI32_9187(item, p) +if err != nil { return err } - } -} -if err := p.WriteListEnd(); err != nil { - return thrift.PrependError("error writing list end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -7541,20 +7873,10 @@ func (x *AllocatorAware) writeField2(p thrift.Protocol) error { // AaSet } item := x.GetAaSetNonCompat() - if err := p.WriteSetBegin(thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing set begin: ", err) -} -for _, v := range item { - { - item := v - if err := p.WriteI32(item); err != nil { + err := WriteSetI32_7070(item, p) +if err != nil { return err } - } -} -if err := p.WriteSetEnd(); err != nil { - return thrift.PrependError("error writing set end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -7568,27 +7890,10 @@ func (x *AllocatorAware) writeField3(p thrift.Protocol) error { // AaMap } item := x.GetAaMapNonCompat() - if err := p.WriteMapBegin(thrift.I32, thrift.I32, len(item)); err != nil { - return thrift.PrependError("error writing map begin: ", err) -} -for k, v := range item { - { - item := k - if err := p.WriteI32(item); err != nil { - return err -} - } - - { - item := v - if err := p.WriteI32(item); err != nil { + err := WriteMapI32I32_9565(item, p) +if err != nil { return err } - } -} -if err := p.WriteMapEnd(); err != nil { - return thrift.PrependError("error writing map end: ", err) -} if err := p.WriteFieldEnd(); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err) @@ -7602,7 +7907,8 @@ func (x *AllocatorAware) writeField4(p thrift.Protocol) error { // AaString } item := x.GetAaStringNonCompat() - if err := p.WriteString(item); err != nil { + err := WriteString_5252(item, p) +if err != nil { return err } @@ -7634,7 +7940,8 @@ func (x *AllocatorAware) writeField6(p thrift.Protocol) error { // AaUnique } item := x.GetAaUniqueNonCompat() - if err := p.WriteI32(item); err != nil { + err := WriteI32_9314(item, p) +if err != nil { return err } @@ -7650,7 +7957,8 @@ func (x *AllocatorAware) writeField7(p thrift.Protocol) error { // AaShared } item := x.GetAaSharedNonCompat() - if err := p.WriteI32(item); err != nil { + err := WriteI32_9314(item, p) +if err != nil { return err } @@ -7661,101 +7969,37 @@ func (x *AllocatorAware) writeField7(p thrift.Protocol) error { // AaShared } func (x *AllocatorAware) readField1(p thrift.Protocol) error { // AaList - _ /* elemType */, size, err := p.ReadListBegin() -if err != nil { - return thrift.PrependError("error reading list begin: ", err) -} - -listResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() + result, err := ReadListI32_9187(p) if err != nil { return err } - elem = result - } - listResult = append(listResult, elem) -} - -if err := p.ReadListEnd(); err != nil { - return thrift.PrependError("error reading list end: ", err) -} -result := listResult x.SetAaListNonCompat(result) return nil } func (x *AllocatorAware) readField2(p thrift.Protocol) error { // AaSet - _ /* elemType */, size, err := p.ReadSetBegin() -if err != nil { - return thrift.PrependError("error reading set begin: ", err) -} - -setResult := make([]int32, 0, size) -for i := 0; i < size; i++ { - var elem int32 - { - result, err := p.ReadI32() + result, err := ReadSetI32_7070(p) if err != nil { return err } - elem = result - } - setResult = append(setResult, elem) -} - -if err := p.ReadSetEnd(); err != nil { - return thrift.PrependError("error reading set end: ", err) -} -result := setResult x.SetAaSetNonCompat(result) return nil } func (x *AllocatorAware) readField3(p thrift.Protocol) error { // AaMap - _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin() -if err != nil { - return thrift.PrependError("error reading map begin: ", err) -} - -mapResult := make(map[int32]int32, size) -for i := 0; i < size; i++ { - var key int32 - { - result, err := p.ReadI32() -if err != nil { - return err -} - key = result - } - - var value int32 - { - result, err := p.ReadI32() + result, err := ReadMapI32I32_9565(p) if err != nil { return err } - value = result - } - - mapResult[key] = value -} - -if err := p.ReadMapEnd(); err != nil { - return thrift.PrependError("error reading map end: ", err) -} -result := mapResult x.SetAaMapNonCompat(result) return nil } func (x *AllocatorAware) readField4(p thrift.Protocol) error { // AaString - result, err := p.ReadString() + result, err := ReadString_5252(p) if err != nil { return err } @@ -7775,7 +8019,7 @@ if err != nil { } func (x *AllocatorAware) readField6(p thrift.Protocol) error { // AaUnique - result, err := p.ReadI32() + result, err := ReadI32_9314(p) if err != nil { return err } @@ -7785,7 +8029,7 @@ if err != nil { } func (x *AllocatorAware) readField7(p thrift.Protocol) error { // AaShared - result, err := p.ReadI32() + result, err := ReadI32_9314(p) if err != nil { return err } @@ -7839,28 +8083,28 @@ func NewAllocatorAwareBuilder() *AllocatorAwareBuilder { // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAllocatorAware().Set().Set() -func (x *AllocatorAwareBuilder) AaList(value []int32) *AllocatorAwareBuilder { +func (x *AllocatorAwareBuilder) AaList(value ListI32_9187) *AllocatorAwareBuilder { x.obj.AaList = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAllocatorAware().Set().Set() -func (x *AllocatorAwareBuilder) AaSet(value []int32) *AllocatorAwareBuilder { +func (x *AllocatorAwareBuilder) AaSet(value SetI32_7070) *AllocatorAwareBuilder { x.obj.AaSet = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAllocatorAware().Set().Set() -func (x *AllocatorAwareBuilder) AaMap(value map[int32]int32) *AllocatorAwareBuilder { +func (x *AllocatorAwareBuilder) AaMap(value MapI32I32_9565) *AllocatorAwareBuilder { x.obj.AaMap = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAllocatorAware().Set().Set() -func (x *AllocatorAwareBuilder) AaString(value string) *AllocatorAwareBuilder { +func (x *AllocatorAwareBuilder) AaString(value String_5252) *AllocatorAwareBuilder { x.obj.AaString = value return x } @@ -7874,14 +8118,14 @@ func (x *AllocatorAwareBuilder) NotAContainer(value int32) *AllocatorAwareBuilde // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAllocatorAware().Set().Set() -func (x *AllocatorAwareBuilder) AaUnique(value int32) *AllocatorAwareBuilder { +func (x *AllocatorAwareBuilder) AaUnique(value I32_9314) *AllocatorAwareBuilder { x.obj.AaUnique = value return x } // Deprecated: Use "New" constructor and setters to build your structs. // e.g NewAllocatorAware().Set().Set() -func (x *AllocatorAwareBuilder) AaShared(value int32) *AllocatorAwareBuilder { +func (x *AllocatorAwareBuilder) AaShared(value I32_9314) *AllocatorAwareBuilder { x.obj.AaShared = value return x } diff --git a/thrift/compiler/test/fixtures/types/gen-hack/module_types.php b/thrift/compiler/test/fixtures/types/gen-hack/module_types.php index 1cd8cd6f9d6..cf345409dbf 100644 --- a/thrift/compiler/test/fixtures/types/gen-hack/module_types.php +++ b/thrift/compiler/test/fixtures/types/gen-hack/module_types.php @@ -389,7 +389,7 @@ class ContainerStruct implements \IThriftSyncStruct, \IThriftStructMetadata { ?'fieldH' => ?Map, ); - const int STRUCTURAL_ID = 2901459969892394021; + const int STRUCTURAL_ID = 7915479604049708983; /** * Original thrift field:- * 12: list fieldA @@ -417,12 +417,12 @@ class ContainerStruct implements \IThriftSyncStruct, \IThriftStructMetadata { public Vector $fieldE; /** * Original thrift field:- - * 6: set fieldF + * 6: module.set_i32_7194 fieldF */ public Set $fieldF; /** * Original thrift field:- - * 7: map fieldG + * 7: module.map_i32_string_1261 fieldG */ public Map $fieldG; /** @@ -571,11 +571,29 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 6, "type" => \tmeta_ThriftType::fromShape( shape( - "t_set" => \tmeta_ThriftSetType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.set_i32_7194", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.set_i32_7194", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_set" => \tmeta_ThriftSetType::fromShape( + shape( + "valueType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -590,16 +608,34 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 7, "type" => \tmeta_ThriftType::fromShape( shape( - "t_map" => \tmeta_ThriftMapType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "keyType" => \tmeta_ThriftType::fromShape( - shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, - ) - ), - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.map_i32_string_1261", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.map_i32_string_1261", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_map" => \tmeta_ThriftMapType::fromShape( + shape( + "keyType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + "valueType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -693,24 +729,24 @@ public static function getAllStructuredAnnotations()[write_props]: \TStructAnnot 'type' => dict[], ), 'fieldF' => shape( - 'field' => dict[ + 'field' => dict[], + 'type' => dict[ '\facebook\thrift\annotation\cpp\Type' => \facebook\thrift\annotation\cpp\Type::fromShape( shape( "template" => "folly::sorted_vector_set", ) ), ], - 'type' => dict[], ), 'fieldG' => shape( - 'field' => dict[ + 'field' => dict[], + 'type' => dict[ '\facebook\thrift\annotation\cpp\Type' => \facebook\thrift\annotation\cpp\Type::fromShape( shape( "template" => "folly::sorted_vector_map", ) ), ], - 'type' => dict[], ), 'fieldH' => shape( 'field' => dict[], @@ -2701,15 +2737,15 @@ class AnnotatedTypes implements \IThriftSyncStruct, \IThriftStructMetadata { ?'list_field' => ?Vector>, ); - const int STRUCTURAL_ID = 7799859984459418183; + const int STRUCTURAL_ID = 1512355088623263223; /** * Original thrift field:- - * 1: module.TBinary binary_field + * 1: module.TBinary_8623 binary_field */ public string $binary_field; /** * Original thrift field:- - * 2: included.SomeListOfTypeMap list_field + * 2: module.SomeListOfTypeMap_2468 list_field */ public Vector> $list_field; @@ -2748,15 +2784,33 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.TBinary", + "name" => "module.TBinary_8623", "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "module.TBinary", + "name" => "module.TBinary_8623", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.TBinary", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.TBinary", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -2777,33 +2831,51 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "included.SomeListOfTypeMap", + "name" => "module.SomeListOfTypeMap_2468", "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "included.SomeListOfTypeMap", + "name" => "module.SomeListOfTypeMap_2468", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_list" => \tmeta_ThriftListType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "included.SomeListOfTypeMap", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "name" => "included.SomeMap", + "name" => "included.SomeListOfTypeMap", "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_map" => \tmeta_ThriftMapType::fromShape( + "t_list" => \tmeta_ThriftListType::fromShape( shape( - "keyType" => \tmeta_ThriftType::fromShape( - shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, - ) - ), "valueType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "included.SomeMap", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_map" => \tmeta_ThriftMapType::fromShape( + shape( + "keyType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + "valueType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -4732,25 +4804,25 @@ class AllocatorAware implements \IThriftSyncStruct, \IThriftStructMetadata { ?'aa_shared' => ?int, ); - const int STRUCTURAL_ID = 6797195997786481852; + const int STRUCTURAL_ID = 6091982818879931050; /** * Original thrift field:- - * 1: list aa_list + * 1: module.list_i32_9187 aa_list */ public Vector $aa_list; /** * Original thrift field:- - * 2: set aa_set + * 2: module.set_i32_7070 aa_set */ public Set $aa_set; /** * Original thrift field:- - * 3: map aa_map + * 3: module.map_i32_i32_9565 aa_map */ public Map $aa_map; /** * Original thrift field:- - * 4: string aa_string + * 4: module.string_5252 aa_string */ public string $aa_string; /** @@ -4760,12 +4832,12 @@ class AllocatorAware implements \IThriftSyncStruct, \IThriftStructMetadata { public int $not_a_container; /** * Original thrift field:- - * 6: i32 aa_unique + * 6: module.i32_9314 aa_unique */ public int $aa_unique; /** * Original thrift field:- - * 7: i32 aa_shared + * 7: module.i32_9314 aa_shared */ public int $aa_shared; @@ -4812,11 +4884,29 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 1, "type" => \tmeta_ThriftType::fromShape( shape( - "t_list" => \tmeta_ThriftListType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.list_i32_9187", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.list_i32_9187", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_list" => \tmeta_ThriftListType::fromShape( + shape( + "valueType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -4831,11 +4921,29 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 2, "type" => \tmeta_ThriftType::fromShape( shape( - "t_set" => \tmeta_ThriftSetType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.set_i32_7070", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.set_i32_7070", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_set" => \tmeta_ThriftSetType::fromShape( + shape( + "valueType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -4850,16 +4958,34 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 3, "type" => \tmeta_ThriftType::fromShape( shape( - "t_map" => \tmeta_ThriftMapType::fromShape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( shape( - "keyType" => \tmeta_ThriftType::fromShape( - shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, - ) - ), - "valueType" => \tmeta_ThriftType::fromShape( + "name" => "module.map_i32_i32_9565", + "underlyingType" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.map_i32_i32_9565", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_map" => \tmeta_ThriftMapType::fromShape( + shape( + "keyType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + "valueType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), ) @@ -4874,7 +5000,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 4, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.string_5252", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.string_5252", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "aa_string", @@ -4896,7 +5040,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 6, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_9314", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_9314", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "aa_unique", @@ -4907,7 +5069,25 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 7, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_9314", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_typedef" => \tmeta_ThriftTypedefType::fromShape( + shape( + "name" => "module.i32_9314", + "underlyingType" => \tmeta_ThriftType::fromShape( + shape( + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + ) + ), + ) + ), + ) + ), + ) + ), ) ), "name" => "aa_shared", diff --git a/thrift/compiler/test/fixtures/types/gen-py/module/SomeService.py b/thrift/compiler/test/fixtures/types/gen-py/module/SomeService.py index 8a128a08287..980b76d17f4 100644 --- a/thrift/compiler/test/fixtures/types/gen-py/module/SomeService.py +++ b/thrift/compiler/test/fixtures/types/gen-py/module/SomeService.py @@ -12,7 +12,7 @@ from thrift.protocol.TProtocol import TProtocolException -from .ttypes import UTF8STRINGS, has_bitwise_ops, is_unscoped, MyForwardRefEnum, empty_struct, decorated_struct, ContainerStruct, CppTypeStruct, VirtualStruct, MyStructWithForwardRefEnum, TrivialNumeric, TrivialNestedWithDefault, ComplexString, ComplexNestedWithDefault, MinPadding, MinPaddingWithCustomType, MyStruct, MyDataItem, Renaming, AnnotatedTypes, ForwardUsageRoot, ForwardUsageStruct, ForwardUsageByRef, IncompleteMap, IncompleteMapDep, CompleteMap, CompleteMapDep, IncompleteList, IncompleteListDep, CompleteList, CompleteListDep, AdaptedList, AdaptedListDep, DependentAdaptedList, DependentAdaptedListDep, AllocatorAware, AllocatorAware2, TypedefStruct, StructWithDoubleUnderscores, TBinary, IntTypedef, UintTypedef +from .ttypes import UTF8STRINGS, has_bitwise_ops, is_unscoped, MyForwardRefEnum, empty_struct, decorated_struct, ContainerStruct, CppTypeStruct, VirtualStruct, MyStructWithForwardRefEnum, TrivialNumeric, TrivialNestedWithDefault, ComplexString, ComplexNestedWithDefault, MinPadding, MinPaddingWithCustomType, MyStruct, MyDataItem, Renaming, AnnotatedTypes, ForwardUsageRoot, ForwardUsageStruct, ForwardUsageByRef, IncompleteMap, IncompleteMapDep, CompleteMap, CompleteMapDep, IncompleteList, IncompleteListDep, CompleteList, CompleteListDep, AdaptedList, AdaptedListDep, DependentAdaptedList, DependentAdaptedListDep, AllocatorAware, AllocatorAware2, TypedefStruct, StructWithDoubleUnderscores, TBinary, IntTypedef, UintTypedef, SomeListOfTypeMap_2468, TBinary_8623, i32_9314, list_i32_9187, map_i32_i32_9565, map_i32_string_1261, set_i32_7070, set_i32_7194, string_5252 import included.ttypes from thrift.Thrift import TProcessor diff --git a/thrift/compiler/test/fixtures/types/gen-py/module/constants.py b/thrift/compiler/test/fixtures/types/gen-py/module/constants.py index 98bd881bc6b..7d9c031ab19 100644 --- a/thrift/compiler/test/fixtures/types/gen-py/module/constants.py +++ b/thrift/compiler/test/fixtures/types/gen-py/module/constants.py @@ -15,5 +15,5 @@ import included.ttypes -from .ttypes import UTF8STRINGS, has_bitwise_ops, is_unscoped, MyForwardRefEnum, empty_struct, decorated_struct, ContainerStruct, CppTypeStruct, VirtualStruct, MyStructWithForwardRefEnum, TrivialNumeric, TrivialNestedWithDefault, ComplexString, ComplexNestedWithDefault, MinPadding, MinPaddingWithCustomType, MyStruct, MyDataItem, Renaming, AnnotatedTypes, ForwardUsageRoot, ForwardUsageStruct, ForwardUsageByRef, IncompleteMap, IncompleteMapDep, CompleteMap, CompleteMapDep, IncompleteList, IncompleteListDep, CompleteList, CompleteListDep, AdaptedList, AdaptedListDep, DependentAdaptedList, DependentAdaptedListDep, AllocatorAware, AllocatorAware2, TypedefStruct, StructWithDoubleUnderscores, TBinary, IntTypedef, UintTypedef +from .ttypes import UTF8STRINGS, has_bitwise_ops, is_unscoped, MyForwardRefEnum, empty_struct, decorated_struct, ContainerStruct, CppTypeStruct, VirtualStruct, MyStructWithForwardRefEnum, TrivialNumeric, TrivialNestedWithDefault, ComplexString, ComplexNestedWithDefault, MinPadding, MinPaddingWithCustomType, MyStruct, MyDataItem, Renaming, AnnotatedTypes, ForwardUsageRoot, ForwardUsageStruct, ForwardUsageByRef, IncompleteMap, IncompleteMapDep, CompleteMap, CompleteMapDep, IncompleteList, IncompleteListDep, CompleteList, CompleteListDep, AdaptedList, AdaptedListDep, DependentAdaptedList, DependentAdaptedListDep, AllocatorAware, AllocatorAware2, TypedefStruct, StructWithDoubleUnderscores, TBinary, IntTypedef, UintTypedef, SomeListOfTypeMap_2468, TBinary_8623, i32_9314, list_i32_9187, map_i32_i32_9565, map_i32_string_1261, set_i32_7070, set_i32_7194, string_5252 diff --git a/thrift/compiler/test/fixtures/types/gen-py/module/ttypes.py b/thrift/compiler/test/fixtures/types/gen-py/module/ttypes.py index e5e11ea0a5d..8f8ca20a800 100644 --- a/thrift/compiler/test/fixtures/types/gen-py/module/ttypes.py +++ b/thrift/compiler/test/fixtures/types/gen-py/module/ttypes.py @@ -42,7 +42,7 @@ def __EXPAND_THRIFT_SPEC(spec): all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 -__all__ = ['UTF8STRINGS', 'has_bitwise_ops', 'is_unscoped', 'MyForwardRefEnum', 'empty_struct', 'decorated_struct', 'ContainerStruct', 'CppTypeStruct', 'VirtualStruct', 'MyStructWithForwardRefEnum', 'TrivialNumeric', 'TrivialNestedWithDefault', 'ComplexString', 'ComplexNestedWithDefault', 'MinPadding', 'MinPaddingWithCustomType', 'MyStruct', 'MyDataItem', 'Renaming', 'AnnotatedTypes', 'ForwardUsageRoot', 'ForwardUsageStruct', 'ForwardUsageByRef', 'IncompleteMap', 'IncompleteMapDep', 'CompleteMap', 'CompleteMapDep', 'IncompleteList', 'IncompleteListDep', 'CompleteList', 'CompleteListDep', 'AdaptedList', 'AdaptedListDep', 'DependentAdaptedList', 'DependentAdaptedListDep', 'AllocatorAware', 'AllocatorAware2', 'TypedefStruct', 'StructWithDoubleUnderscores', 'TBinary', 'IntTypedef', 'UintTypedef'] +__all__ = ['UTF8STRINGS', 'has_bitwise_ops', 'is_unscoped', 'MyForwardRefEnum', 'empty_struct', 'decorated_struct', 'ContainerStruct', 'CppTypeStruct', 'VirtualStruct', 'MyStructWithForwardRefEnum', 'TrivialNumeric', 'TrivialNestedWithDefault', 'ComplexString', 'ComplexNestedWithDefault', 'MinPadding', 'MinPaddingWithCustomType', 'MyStruct', 'MyDataItem', 'Renaming', 'AnnotatedTypes', 'ForwardUsageRoot', 'ForwardUsageStruct', 'ForwardUsageByRef', 'IncompleteMap', 'IncompleteMapDep', 'CompleteMap', 'CompleteMapDep', 'IncompleteList', 'IncompleteListDep', 'CompleteList', 'CompleteListDep', 'AdaptedList', 'AdaptedListDep', 'DependentAdaptedList', 'DependentAdaptedListDep', 'AllocatorAware', 'AllocatorAware2', 'TypedefStruct', 'StructWithDoubleUnderscores', 'TBinary', 'IntTypedef', 'UintTypedef', 'SomeListOfTypeMap_2468', 'TBinary_8623', 'i32_9314', 'list_i32_9187', 'map_i32_i32_9565', 'map_i32_string_1261', 'set_i32_7070', 'set_i32_7194', 'string_5252'] class has_bitwise_ops: none = 0 @@ -4005,6 +4005,15 @@ def _to_py_deprecated(self): TBinary = UnimplementedTypedef() IntTypedef = UnimplementedTypedef() UintTypedef = IntTypedef +SomeListOfTypeMap_2468 = included.ttypes.SomeListOfTypeMap +TBinary_8623 = TBinary +i32_9314 = UnimplementedTypedef() +list_i32_9187 = UnimplementedTypedef() +map_i32_i32_9565 = UnimplementedTypedef() +map_i32_string_1261 = UnimplementedTypedef() +set_i32_7070 = UnimplementedTypedef() +set_i32_7194 = UnimplementedTypedef() +string_5252 = UnimplementedTypedef() all_structs.append(empty_struct) empty_struct.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( ))) diff --git a/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyi b/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyi index 6728ee93257..f88ed9f714d 100644 --- a/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyi +++ b/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyi @@ -1479,3 +1479,12 @@ class Map__i32_i32(_typing.Mapping[int, int], _typing.Hashable): TBinary = bytes IntTypedef = int UintTypedef = int +SomeListOfTypeMap_2468 = List__std_unordered_map__Map__i32_string +TBinary_8623 = bytes +i32_9314 = int +list_i32_9187 = List__i32 +map_i32_i32_9565 = Map__i32_i32 +map_i32_string_1261 = folly_sorted_vector_map__Map__i32_string +set_i32_7070 = Set__i32 +set_i32_7194 = folly_sorted_vector_set__Set__i32 +string_5252 = str diff --git a/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyx b/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyx index 43a5610e6f3..141f20bfe77 100644 --- a/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyx +++ b/thrift/compiler/test/fixtures/types/gen-py3/apache/thrift/fixtures/types/module/types.pyx @@ -6107,3 +6107,12 @@ Mapping.register(Map__i32_i32) TBinary = bytes IntTypedef = int UintTypedef = int +SomeListOfTypeMap_2468 = List__std_unordered_map__Map__i32_string +TBinary_8623 = bytes +i32_9314 = int +list_i32_9187 = List__i32 +map_i32_i32_9565 = Map__i32_i32 +map_i32_string_1261 = folly_sorted_vector_map__Map__i32_string +set_i32_7070 = Set__i32 +set_i32_7194 = folly_sorted_vector_set__Set__i32 +string_5252 = str diff --git a/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py b/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py index 8c1a9896b70..0f66fac3cd2 100644 --- a/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py +++ b/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py @@ -78,10 +78,8 @@ def _fbthrift_gen_metadata_struct_ContainerStruct(metadata_struct: _fbthrift_met _fbthrift_metadata.ThriftConstStruct(type=_fbthrift_metadata.ThriftStructType(name="cpp.Type"), fields= { "template": _fbthrift_metadata.ThriftConstValue(cv_string="folly::small_vector"), }), ]), _fbthrift_metadata.ThriftField(id=6, type=_fbthrift_metadata.ThriftType(t_set=_fbthrift_metadata.ThriftSetType(valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))), name="fieldF", is_optional=False, structured_annotations=[ - _fbthrift_metadata.ThriftConstStruct(type=_fbthrift_metadata.ThriftStructType(name="cpp.Type"), fields= { "template": _fbthrift_metadata.ThriftConstValue(cv_string="folly::sorted_vector_set"), }), ]), _fbthrift_metadata.ThriftField(id=7, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_STRING_TYPE))), name="fieldG", is_optional=False, structured_annotations=[ - _fbthrift_metadata.ThriftConstStruct(type=_fbthrift_metadata.ThriftStructType(name="cpp.Type"), fields= { "template": _fbthrift_metadata.ThriftConstValue(cv_string="folly::sorted_vector_map"), }), ]), _fbthrift_metadata.ThriftField(id=8, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_STRING_TYPE))), name="fieldH", is_optional=False, structured_annotations=[ ]), diff --git a/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.py b/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.py index 99c0bd504ca..c4bfdf83443 100644 --- a/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.py +++ b/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.py @@ -1902,6 +1902,15 @@ def _fbthrift_metadata__struct_StructWithDoubleUnderscores(): TBinary = bytes IntTypedef = int UintTypedef = int +SomeListOfTypeMap_2468 = _fbthrift_python_types.ListTypeFactory(_fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_string)) +TBinary_8623 = bytes +i32_9314 = int +list_i32_9187 = _fbthrift_python_types.ListTypeFactory(_fbthrift_python_types.typeinfo_i32) +map_i32_i32_9565 = _fbthrift_python_types.MapTypeFactory(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_i32) +map_i32_string_1261 = _fbthrift_python_types.MapTypeFactory(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_string) +set_i32_7070 = _fbthrift_python_types.SetTypeFactory(_fbthrift_python_types.typeinfo_i32) +set_i32_7194 = _fbthrift_python_types.SetTypeFactory(_fbthrift_python_types.typeinfo_i32) +string_5252 = str diff --git a/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi b/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi index 65bb2b4bc69..3650e65e585 100644 --- a/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi +++ b/thrift/compiler/test/fixtures/types/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi @@ -874,6 +874,15 @@ class StructWithDoubleUnderscores(_fbthrift_python_types.Struct, _fbthrift_compa TBinary = bytes IntTypedef = int UintTypedef = int +SomeListOfTypeMap_2468 = _typing.List[_typing.Mapping[int, str]] +TBinary_8623 = bytes +i32_9314 = int +list_i32_9187 = _typing.List[int] +map_i32_i32_9565 = _typing.Dict[int, int] +map_i32_string_1261 = _typing.Dict[int, str] +set_i32_7070 = _typing.Set[int] +set_i32_7194 = _typing.Set[int] +string_5252 = str class _fbthrift_SomeService_bounce_map_args(_fbthrift_python_types.Struct): diff --git a/thrift/compiler/test/fixtures/types/gen-rust/lib.rs b/thrift/compiler/test/fixtures/types/gen-rust/lib.rs index e9ad7e5211d..f94af605a26 100644 --- a/thrift/compiler/test/fixtures/types/gen-rust/lib.rs +++ b/thrift/compiler/test/fixtures/types/gen-rust/lib.rs @@ -69,7 +69,7 @@ pub(crate) mod r#impl { { fn read(p: &mut P) -> ::anyhow::Result { let (_key_ty, _val_ty, len) = p.read_map_begin()?; - let mut map = <::sorted_vector_map::SortedVectorMap<::std::primitive::i32, ::std::string::String>>::with_capacity(len.unwrap_or_default()); + let mut map = ::with_capacity(len.unwrap_or_default()); if let Some(0) = len { return Ok(LocalImpl(map)); @@ -120,7 +120,7 @@ pub(crate) mod r#impl { { fn read(p: &mut P) -> ::anyhow::Result { let (_elem_ty, len) = p.read_set_begin()?; - let mut set = <::sorted_vector_map::SortedVectorSet<::std::primitive::i32>>::with_capacity(len.unwrap_or_default()); + let mut set = ::with_capacity(len.unwrap_or_default()); if let Some(0) = len { return Ok(LocalImpl(set)); diff --git a/thrift/compiler/test/fixtures/types/gen-rust/types.rs b/thrift/compiler/test/fixtures/types/gen-rust/types.rs index b7236898604..ec0e1fdf78c 100644 --- a/thrift/compiler/test/fixtures/types/gen-rust/types.rs +++ b/thrift/compiler/test/fixtures/types/gen-rust/types.rs @@ -14,6 +14,24 @@ pub type IntTypedef = ::std::primitive::i32; pub type UintTypedef = crate::types::IntTypedef; +pub type SomeListOfTypeMap_2468 = included::types::SomeListOfTypeMap; + +pub type TBinary_8623 = crate::types::TBinary; + +pub type i32_9314 = ::std::primitive::i32; + +pub type list_i32_9187 = ::std::vec::Vec<::std::primitive::i32>; + +pub type map_i32_i32_9565 = ::std::collections::BTreeMap<::std::primitive::i32, ::std::primitive::i32>; + +pub type map_i32_string_1261 = ::sorted_vector_map::SortedVectorMap<::std::primitive::i32, ::std::string::String>; + +pub type set_i32_7070 = ::std::collections::BTreeSet<::std::primitive::i32>; + +pub type set_i32_7194 = ::sorted_vector_map::SortedVectorSet<::std::primitive::i32>; + +pub type string_5252 = ::std::string::String; + #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct empty_struct { // This field forces `..Default::default()` when instantiating this @@ -42,8 +60,8 @@ pub struct ContainerStruct { pub fieldC: ::std::vec::Vec<::std::primitive::i32>, pub fieldD: ::std::vec::Vec<::std::primitive::i32>, pub fieldE: ::std::vec::Vec<::std::primitive::i32>, - pub fieldF: ::sorted_vector_map::SortedVectorSet<::std::primitive::i32>, - pub fieldG: ::sorted_vector_map::SortedVectorMap<::std::primitive::i32, ::std::string::String>, + pub fieldF: crate::types::set_i32_7194, + pub fieldG: crate::types::map_i32_string_1261, pub fieldH: included::types::SomeMap, // This field forces `..Default::default()` when instantiating this // struct, to make code future-proof against new fields added later to @@ -202,8 +220,8 @@ pub struct Renaming { #[derive(Clone, PartialEq)] pub struct AnnotatedTypes { - pub binary_field: crate::types::TBinary, - pub list_field: included::types::SomeListOfTypeMap, + pub binary_field: crate::types::TBinary_8623, + pub list_field: crate::types::SomeListOfTypeMap_2468, // This field forces `..Default::default()` when instantiating this // struct, to make code future-proof against new fields added later to // the definition in Thrift. If you don't want this, add the annotation @@ -376,13 +394,13 @@ pub struct DependentAdaptedListDep { #[derive(Clone, PartialEq)] pub struct AllocatorAware { - pub aa_list: ::std::vec::Vec<::std::primitive::i32>, - pub aa_set: ::std::collections::BTreeSet<::std::primitive::i32>, - pub aa_map: ::std::collections::BTreeMap<::std::primitive::i32, ::std::primitive::i32>, - pub aa_string: ::std::string::String, + pub aa_list: crate::types::list_i32_9187, + pub aa_set: crate::types::set_i32_7070, + pub aa_map: crate::types::map_i32_i32_9565, + pub aa_string: crate::types::string_5252, pub not_a_container: ::std::primitive::i32, - pub aa_unique: ::std::primitive::i32, - pub aa_shared: ::std::primitive::i32, + pub aa_unique: crate::types::i32_9314, + pub aa_shared: crate::types::i32_9314, // This field forces `..Default::default()` when instantiating this // struct, to make code future-proof against new fields added later to // the definition in Thrift. If you don't want this, add the annotation @@ -1190,30 +1208,8 @@ impl ::fbthrift::metadata::ThriftAnnotations for ContainerStruct { } }, 6 => { - - if type_id == ::std::any::TypeId::of::() { - let mut tmp = Some(cpp::types::Type { - name: ::std::default::Default::default(), - template: "folly::sorted_vector_set".to_owned(), - ..::std::default::Default::default() - }); - let r: &mut dyn ::std::any::Any = &mut tmp; - let r: &mut Option = r.downcast_mut().unwrap(); - return r.take(); - } }, 7 => { - - if type_id == ::std::any::TypeId::of::() { - let mut tmp = Some(cpp::types::Type { - name: ::std::default::Default::default(), - template: "folly::sorted_vector_map".to_owned(), - ..::std::default::Default::default() - }); - let r: &mut dyn ::std::any::Any = &mut tmp; - let r: &mut Option = r.downcast_mut().unwrap(); - return r.take(); - } }, 8 => { }, @@ -4951,7 +4947,7 @@ pub(crate) mod r#impl { { fn read(p: &mut P) -> ::anyhow::Result { let (_key_ty, _val_ty, len) = p.read_map_begin()?; - let mut map = <::sorted_vector_map::SortedVectorMap<::std::primitive::i32, ::std::string::String>>::with_capacity(len.unwrap_or_default()); + let mut map = ::with_capacity(len.unwrap_or_default()); if let Some(0) = len { return Ok(LocalImpl(map)); @@ -5002,7 +4998,7 @@ pub(crate) mod r#impl { { fn read(p: &mut P) -> ::anyhow::Result { let (_elem_ty, len) = p.read_set_begin()?; - let mut set = <::sorted_vector_map::SortedVectorSet<::std::primitive::i32>>::with_capacity(len.unwrap_or_default()); + let mut set = ::with_capacity(len.unwrap_or_default()); if let Some(0) = len { return Ok(LocalImpl(set)); diff --git a/thrift/compiler/test/fixtures/types/src/module.thrift b/thrift/compiler/test/fixtures/types/src/module.thrift index a73f47a1ca8..c1987e7e8dc 100644 --- a/thrift/compiler/test/fixtures/types/src/module.thrift +++ b/thrift/compiler/test/fixtures/types/src/module.thrift @@ -38,10 +38,8 @@ struct ContainerStruct { 4: list fieldD; @cpp.Type{template = "folly::small_vector"} 5: list fieldE; - @cpp.Type{template = "folly::sorted_vector_set"} - 6: set (rust.type = "sorted_vector_map::SortedVectorSet") fieldF; - @cpp.Type{template = "folly::sorted_vector_map"} - 7: map (rust.type = "sorted_vector_map::SortedVectorMap") fieldG; + 6: set_i32_7194 fieldF; + 7: map_i32_string_1261 fieldG; 8: included.SomeMap fieldH; } @@ -137,8 +135,8 @@ struct Renaming { } (cpp.name = "Renamed") struct AnnotatedTypes { - 1: TBinary (noop_annotation) binary_field; - 2: included.SomeListOfTypeMap (noop_annotation) list_field; + 1: TBinary_8623 binary_field; + 2: SomeListOfTypeMap_2468 list_field; } # Validates that C++ codegen performes appropriate topological sorting of @@ -207,15 +205,15 @@ struct DependentAdaptedListDep { # Allocator-aware struct with allocator-aware fields struct AllocatorAware { - 1: list (cpp.use_allocator) aa_list; - 2: set (cpp.use_allocator) aa_set; - 3: map (cpp.use_allocator) aa_map; - 4: string (cpp.use_allocator) aa_string; + 1: list_i32_9187 aa_list; + 2: set_i32_7070 aa_set; + 3: map_i32_i32_9565 aa_map; + 4: string_5252 aa_string; 5: i32 not_a_container; @cpp.Ref{type = cpp.RefType.Unique} - 6: i32 (cpp.use_allocator) aa_unique; + 6: i32_9314 aa_unique; @cpp.Ref{type = cpp.RefType.SharedMutable} - 7: i32 (cpp.use_allocator) aa_shared; + 7: i32_9314 aa_shared; } (cpp.allocator = "some_allocator") # Allocator-aware struct with no allocator-aware fields @@ -238,3 +236,20 @@ struct TypedefStruct { struct StructWithDoubleUnderscores { 1: i32 __field; } + +// The following were automatically generated and may benefit from renaming. +typedef included.SomeListOfTypeMap ( + noop_annotation = "1", +) SomeListOfTypeMap_2468 +typedef TBinary (noop_annotation = "1") TBinary_8623 +typedef i32 (cpp.use_allocator = "1") i32_9314 +typedef list (cpp.use_allocator = "1") list_i32_9187 +typedef map (cpp.use_allocator = "1") map_i32_i32_9565 +@cpp.Type{template = "folly::sorted_vector_map"} +typedef map ( + rust.type = "sorted_vector_map::SortedVectorMap", +) map_i32_string_1261 +typedef set (cpp.use_allocator = "1") set_i32_7070 +@cpp.Type{template = "folly::sorted_vector_set"} +typedef set (rust.type = "sorted_vector_map::SortedVectorSet") set_i32_7194 +typedef string (cpp.use_allocator = "1") string_5252