From 5a84514ba9b6933498219a0eabb41dfaca85c373 Mon Sep 17 00:00:00 2001 From: Alper Yoney Date: Thu, 30 Jan 2025 18:20:48 -0800 Subject: [PATCH] Update fixtures to fix the compiler tests on macos Summary: Reorder the struct fields so that `cpp.MinimizePadding` doesn't end up with a different layout due to `alignof(std::max_align_t)` varying across different platforms, such as mac-arm64 and linux-amd64. Reviewed By: praihan Differential Revision: D68926839 fbshipit-source-id: 5aa23d2da81597d53b6ecd9887fd5aa7bc6b5607 --- .../out/cpp2/gen-cpp2/module_constants.cpp | 4 +- .../out/cpp2/gen-cpp2/module_constants.h | 4 +- .../types/out/cpp2/gen-cpp2/module_data.cpp | 12 +- .../out/cpp2/gen-cpp2/module_fatal_struct.h | 40 ++--- .../out/cpp2/gen-cpp2/module_for_each_field.h | 4 +- .../out/cpp2/gen-cpp2/module_metadata.cpp | 2 +- .../types/out/cpp2/gen-cpp2/module_types.cpp | 14 +- .../types/out/cpp2/gen-cpp2/module_types.h | 154 +++++++++--------- .../types/out/cpp2/gen-cpp2/module_types.tcc | 56 +++---- .../module_visit_by_thrift_field_metadata.h | 4 +- .../types/out/go/gen-go/module/codec.go | 16 +- .../types/out/go/gen-go/module/types.go | 64 ++++---- .../types/out/hack/gen-hack/module_types.php | 70 ++++---- .../types/out/py/gen-py/module/ttypes.py | 54 +++--- .../thrift/fixtures/types/module/builders.py | 8 +- .../fixtures/types/module/cbindings.pxd | 4 +- .../thrift/fixtures/types/module/types.pxd | 4 +- .../thrift/fixtures/types/module/types.pyi | 12 +- .../thrift/fixtures/types/module/types.pyx | 16 +- .../fixtures/types/module/types_fields.pyx | 20 +-- .../fixtures/types/module/types_reflection.py | 12 +- .../types/out/py3/gen-py3/module/types.h | 4 +- .../types/module/thrift_abstract_types.py | 4 +- .../fixtures/types/module/thrift_metadata.py | 8 +- .../types/module/thrift_mutable_types.py | 16 +- .../types/module/thrift_mutable_types.pyi | 20 +-- .../fixtures/types/module/thrift_types.py | 16 +- .../fixtures/types/module/thrift_types.pyi | 12 +- .../fixtures/types/out/rust/gen-rust/types.rs | 36 ++-- .../test/fixtures/types/src/module.thrift | 4 +- 30 files changed, 347 insertions(+), 347 deletions(-) diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.cpp b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.cpp index 62abdccccf3..46323b86ffa 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.cpp +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.cpp @@ -15,10 +15,10 @@ namespace apache::thrift::fixtures::types { namespace module_constants { -::std::string_view _fbthrift_schema_cbf7f73e50f28c81() { +::std::string_view _fbthrift_schema_4543be4a92b4107e() { return ""; } -::folly::Range _fbthrift_schema_cbf7f73e50f28c81_includes() { +::folly::Range _fbthrift_schema_4543be4a92b4107e_includes() { return {}; } diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.h b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.h index dafc97ed8a8..a50fe556896 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.h +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_constants.h @@ -14,8 +14,8 @@ namespace apache::thrift::fixtures::types { /** Glean {"file": "thrift/compiler/test/fixtures/types/src/module.thrift"} */ namespace module_constants { - FOLLY_EXPORT ::std::string_view _fbthrift_schema_cbf7f73e50f28c81(); - FOLLY_EXPORT ::folly::Range _fbthrift_schema_cbf7f73e50f28c81_includes(); + FOLLY_EXPORT ::std::string_view _fbthrift_schema_4543be4a92b4107e(); + FOLLY_EXPORT ::folly::Range _fbthrift_schema_4543be4a92b4107e_includes(); } // namespace module_constants } // namespace apache::thrift::fixtures::types diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_data.cpp b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_data.cpp index 5ec1a615bed..5a1b6f5c017 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_data.cpp +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_data.cpp @@ -298,9 +298,9 @@ THRIFT_DATA_MEMBER const std::array TStructDataStorage<::apache::thrift: THRIFT_DATA_MEMBER const std::string_view TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::name = "MinPaddingWithCustomType"; THRIFT_DATA_MEMBER const std::array TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::fields_names = { { "small"sv, - "big"sv, - "medium"sv, "biggish"sv, + "medium"sv, + "big"sv, "tiny"sv, }}; THRIFT_DATA_MEMBER const std::array TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::fields_ids = { { @@ -312,16 +312,16 @@ THRIFT_DATA_MEMBER const std::array TStructDataStorage<::apache::thr }}; THRIFT_DATA_MEMBER const std::array TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::fields_types = { { TType::T_BYTE, - TType::T_I64, - TType::T_I16, TType::T_I32, + TType::T_I16, + TType::T_I64, TType::T_BYTE, }}; THRIFT_DATA_MEMBER const std::array TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::storage_names = { { "__fbthrift_field_small"sv, - "__fbthrift_field_big"sv, - "__fbthrift_field_medium"sv, "__fbthrift_field_biggish"sv, + "__fbthrift_field_medium"sv, + "__fbthrift_field_big"sv, "__fbthrift_field_tiny"sv, }}; THRIFT_DATA_MEMBER const std::array TStructDataStorage<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::isset_indexes = { { diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h index b82fb415526..bcff1303de6 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_fatal_struct.h @@ -730,9 +730,9 @@ class MinPaddingWithCustomType_struct_traits { class __fbthrift_members { public: using small = __fbthrift_refl_impl::reflected_no_annotations; - using big = __fbthrift_refl_impl::reflected_no_annotations; - using medium = __fbthrift_refl_impl::reflected_no_annotations; using biggish = __fbthrift_refl_impl::reflected_no_annotations; + using medium = __fbthrift_refl_impl::reflected_no_annotations; + using big = __fbthrift_refl_impl::reflected_no_annotations; using tiny = __fbthrift_refl_impl::reflected_no_annotations; }; @@ -752,17 +752,17 @@ class MinPaddingWithCustomType_struct_traits { using type_class = ::apache::thrift::type_class::integral; using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::small>; }; - struct __fbthrift_member_big { + struct __fbthrift_member_biggish { using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType; - using name = __fbthrift_strings_module::__fbthrift_hash_2a21fe6d592a19b7de898b50eb53c429608de1a66f3e9f62da19714a770553d1; - using type = ::std::int64_t; - using tag = ::apache::thrift::ident::big; + using name = __fbthrift_strings_module::__fbthrift_hash_7af8f5c4c7c52a8a8bd7151e1a20e8003de8a0f5b4c08676355b69772b2ae1d7; + using type = ::std::int32_t; + using tag = ::apache::thrift::ident::biggish; static constexpr ::apache::thrift::field_id_t id = 2; static constexpr auto optional = ::apache::thrift::optionality::terse; - using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::big>; - using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::big>; + using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::biggish>; + using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::biggish>; using type_class = ::apache::thrift::type_class::integral; - using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::big>; + using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::biggish>; }; struct __fbthrift_member_medium { using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType; @@ -776,17 +776,17 @@ class MinPaddingWithCustomType_struct_traits { using type_class = ::apache::thrift::type_class::integral; using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::medium>; }; - struct __fbthrift_member_biggish { + struct __fbthrift_member_big { using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType; - using name = __fbthrift_strings_module::__fbthrift_hash_7af8f5c4c7c52a8a8bd7151e1a20e8003de8a0f5b4c08676355b69772b2ae1d7; - using type = ::std::int32_t; - using tag = ::apache::thrift::ident::biggish; + using name = __fbthrift_strings_module::__fbthrift_hash_2a21fe6d592a19b7de898b50eb53c429608de1a66f3e9f62da19714a770553d1; + using type = ::std::int64_t; + using tag = ::apache::thrift::ident::big; static constexpr ::apache::thrift::field_id_t id = 4; static constexpr auto optional = ::apache::thrift::optionality::terse; - using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::biggish>; - using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::biggish>; + using getter = __fbthrift_refl_impl::data_member_accessor<::apache::thrift::ident::big>; + using field_ref_getter = ::apache::thrift::access_field_fn<::apache::thrift::ident::big>; using type_class = ::apache::thrift::type_class::integral; - using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::biggish>; + using annotations = ::apache::thrift::reflected_annotations<__fbthrift_annotations::members::big>; }; struct __fbthrift_member_tiny { using owner = ::apache::thrift::fixtures::types::MinPaddingWithCustomType; @@ -803,9 +803,9 @@ class MinPaddingWithCustomType_struct_traits { struct __fbthrift_member { using small = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_small>; - using big = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_big>; - using medium = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_medium>; using biggish = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_biggish>; + using medium = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_medium>; + using big = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_big>; using tiny = ::apache::thrift::reflected_struct_data_member<__fbthrift_member_tiny>; }; public: @@ -814,9 +814,9 @@ class MinPaddingWithCustomType_struct_traits { using member = __fbthrift_member; using members = ::fatal::list< member::small, - member::big, - member::medium, member::biggish, + member::medium, + member::big, member::tiny >; using members_annotations = __fbthrift_annotations::members; diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_for_each_field.h b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_for_each_field.h index 4306477f4ba..64c6814b9e3 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_for_each_field.h +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_for_each_field.h @@ -121,9 +121,9 @@ struct ForEachField<::apache::thrift::fixtures::types::MinPaddingWithCustomType> template void operator()([[maybe_unused]] F&& f, [[maybe_unused]] T&&... t) const { f(0, static_cast(t).small_ref()...); - f(1, static_cast(t).big_ref()...); + f(1, static_cast(t).biggish_ref()...); f(2, static_cast(t).medium_ref()...); - f(3, static_cast(t).biggish_ref()...); + f(3, static_cast(t).big_ref()...); f(4, static_cast(t).tiny_ref()...); } }; diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_metadata.cpp b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_metadata.cpp index 2586bd3fbb5..6c601eec581 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_metadata.cpp +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_metadata.cpp @@ -315,7 +315,7 @@ StructMetadata<::apache::thrift::fixtures::types::MinPaddingWithCustomType>::gen module_MinPaddingWithCustomType.is_union() = false; static const auto* const module_MinPaddingWithCustomType_fields = new std::array{ { - { 1, "small", false, std::make_unique(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector{ }}, { 2, "big", false, std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{ }}, { 3, "medium", false, std::make_unique(ThriftPrimitiveType::THRIFT_I16_TYPE), std::vector{ *cvStruct("cpp.Adapter", { {"name", cvString("::my::Adapter") } }).cv_struct_ref(), }}, { 4, "biggish", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 5, "tiny", false, std::make_unique(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector{ }}, }}; + { 1, "small", false, std::make_unique(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector{ }}, { 2, "biggish", false, std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector{ }}, { 3, "medium", false, std::make_unique(ThriftPrimitiveType::THRIFT_I16_TYPE), std::vector{ *cvStruct("cpp.Adapter", { {"name", cvString("::my::Adapter") } }).cv_struct_ref(), }}, { 4, "big", false, std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE), std::vector{ }}, { 5, "tiny", false, std::make_unique(ThriftPrimitiveType::THRIFT_BYTE_TYPE), std::vector{ }}, }}; for (const auto& f : *module_MinPaddingWithCustomType_fields) { ::apache::thrift::metadata::ThriftField field; field.id() = f.id; diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp index 172c35020af..95f6080748b 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.cpp @@ -1440,7 +1440,7 @@ MinPaddingWithCustomType& MinPaddingWithCustomType::operator=([[maybe_unused]] M } -MinPaddingWithCustomType::MinPaddingWithCustomType(apache::thrift::FragileConstructor, ::std::int8_t small__arg, ::std::int64_t big__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter, 3, ::std::int16_t, MinPaddingWithCustomType> medium__arg, ::std::int32_t biggish__arg, ::std::int8_t tiny__arg) : +MinPaddingWithCustomType::MinPaddingWithCustomType(apache::thrift::FragileConstructor, ::std::int8_t small__arg, ::std::int32_t biggish__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter, 3, ::std::int16_t, MinPaddingWithCustomType> medium__arg, ::std::int64_t big__arg, ::std::int8_t tiny__arg) : __fbthrift_field_medium(std::move(medium__arg)), __fbthrift_field_big(std::move(big__arg)), __fbthrift_field_biggish(std::move(biggish__arg)), @@ -1453,25 +1453,25 @@ MinPaddingWithCustomType::MinPaddingWithCustomType(apache::thrift::FragileConstr void MinPaddingWithCustomType::__fbthrift_clear() { // clear all fields this->__fbthrift_field_small = ::std::int8_t(); - this->__fbthrift_field_big = ::std::int64_t(); - ::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this); this->__fbthrift_field_biggish = ::std::int32_t(); + ::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this); + this->__fbthrift_field_big = ::std::int64_t(); this->__fbthrift_field_tiny = ::std::int8_t(); } void MinPaddingWithCustomType::__fbthrift_clear_terse_fields() { this->__fbthrift_field_small = ::std::int8_t(); - this->__fbthrift_field_big = ::std::int64_t(); - ::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this); this->__fbthrift_field_biggish = ::std::int32_t(); + ::apache::thrift::adapt_detail::clear<::my::Adapter, 3>(__fbthrift_field_medium, *this); + this->__fbthrift_field_big = ::std::int64_t(); this->__fbthrift_field_tiny = ::std::int8_t(); } bool MinPaddingWithCustomType::__fbthrift_is_empty() const { return ::apache::thrift::op::isEmpty<::apache::thrift::type::byte_t>(this->__fbthrift_field_small) && - ::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big) && - ::apache::thrift::op::isEmpty<::apache::thrift::op::get_field_tag>>(this->__fbthrift_field_medium) && ::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish) && + ::apache::thrift::op::isEmpty<::apache::thrift::op::get_field_tag>>(this->__fbthrift_field_medium) && + ::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big) && ::apache::thrift::op::isEmpty<::apache::thrift::type::byte_t>(this->__fbthrift_field_tiny); } diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h index d668e7e770b..f65262f4351 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.h @@ -41,9 +41,9 @@ struct medium; struct biggish; struct tiny; struct small; -struct big; -struct medium; struct biggish; +struct medium; +struct big; struct tiny; struct MyIntField; struct MyStringField; @@ -187,17 +187,17 @@ APACHE_THRIFT_DEFINE_ACCESSOR(tiny); #define APACHE_THRIFT_ACCESSOR_small APACHE_THRIFT_DEFINE_ACCESSOR(small); #endif -#ifndef APACHE_THRIFT_ACCESSOR_big -#define APACHE_THRIFT_ACCESSOR_big -APACHE_THRIFT_DEFINE_ACCESSOR(big); +#ifndef APACHE_THRIFT_ACCESSOR_biggish +#define APACHE_THRIFT_ACCESSOR_biggish +APACHE_THRIFT_DEFINE_ACCESSOR(biggish); #endif #ifndef APACHE_THRIFT_ACCESSOR_medium #define APACHE_THRIFT_ACCESSOR_medium APACHE_THRIFT_DEFINE_ACCESSOR(medium); #endif -#ifndef APACHE_THRIFT_ACCESSOR_biggish -#define APACHE_THRIFT_ACCESSOR_biggish -APACHE_THRIFT_DEFINE_ACCESSOR(biggish); +#ifndef APACHE_THRIFT_ACCESSOR_big +#define APACHE_THRIFT_ACCESSOR_big +APACHE_THRIFT_DEFINE_ACCESSOR(big); #endif #ifndef APACHE_THRIFT_ACCESSOR_tiny #define APACHE_THRIFT_ACCESSOR_tiny @@ -3460,18 +3460,18 @@ class MinPaddingWithCustomType final { } using __fbthrift_reflection_ident_list = folly::tag_t< ::apache::thrift::ident::small, - ::apache::thrift::ident::big, - ::apache::thrift::ident::medium, ::apache::thrift::ident::biggish, + ::apache::thrift::ident::medium, + ::apache::thrift::ident::big, ::apache::thrift::ident::tiny >; static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1,2,3,4,5}; using __fbthrift_reflection_type_tags = folly::tag_t< ::apache::thrift::type::byte_t, - ::apache::thrift::type::i64_t, - ::apache::thrift::type::adapted<::my::Adapter, ::apache::thrift::type::i16_t>, ::apache::thrift::type::i32_t, + ::apache::thrift::type::adapted<::my::Adapter, ::apache::thrift::type::i16_t>, + ::apache::thrift::type::i64_t, ::apache::thrift::type::byte_t >; @@ -3517,7 +3517,7 @@ class MinPaddingWithCustomType final { } // FragileConstructor for use in initialization lists only. [[deprecated("This constructor is deprecated")]] - MinPaddingWithCustomType(apache::thrift::FragileConstructor, ::std::int8_t small__arg, ::std::int64_t big__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter, 3, ::std::int16_t, MinPaddingWithCustomType> medium__arg, ::std::int32_t biggish__arg, ::std::int8_t tiny__arg); + MinPaddingWithCustomType(apache::thrift::FragileConstructor, ::std::int8_t small__arg, ::std::int32_t biggish__arg, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter, 3, ::std::int16_t, MinPaddingWithCustomType> medium__arg, ::std::int64_t big__arg, ::std::int8_t tiny__arg); MinPaddingWithCustomType(MinPaddingWithCustomType&&) noexcept; MinPaddingWithCustomType(const MinPaddingWithCustomType& src); @@ -3589,52 +3589,52 @@ class MinPaddingWithCustomType final { return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_small)}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() const& { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() const& { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() const&& { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() const&& { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() & { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() & { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() && { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() && { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big() const& { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() const& { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big() const&& { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() const&& { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big() & { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() & { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; } - /** Glean { "field": "big" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref big() && { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; + /** Glean { "field": "biggish" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() && { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; } /** Glean { "field": "medium" } */ @@ -3685,52 +3685,52 @@ class MinPaddingWithCustomType final { return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_medium)}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() const& { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() const& { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() const&& { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() const&& { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() & { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() & { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish_ref() && { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big_ref() && { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() const& { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big() const& { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() const&& { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big() const&& { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() & { - return ::apache::thrift::terse_field_ref{this->__fbthrift_field_biggish}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big() & { + return ::apache::thrift::terse_field_ref{this->__fbthrift_field_big}; } - /** Glean { "field": "biggish" } */ - template - FOLLY_ERASE ::apache::thrift::terse_field_ref biggish() && { - return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_biggish)}; + /** Glean { "field": "big" } */ + template + FOLLY_ERASE ::apache::thrift::terse_field_ref big() && { + return ::apache::thrift::terse_field_ref{static_cast(this->__fbthrift_field_big)}; } /** Glean { "field": "tiny" } */ diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.tcc b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.tcc index 18b1be7abfb..b5b277bd470 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.tcc +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_types.tcc @@ -2170,12 +2170,12 @@ _readField_small: iprot, 1, 2, - apache::thrift::protocol::T_I64))) { + apache::thrift::protocol::T_I32))) { goto _advance_failure; } -_readField_big: +_readField_biggish: { - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::readWithContext(*iprot, this->__fbthrift_field_big, _readState); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::readWithContext(*iprot, this->__fbthrift_field_biggish, _readState); } if (UNLIKELY(!_readState.advanceToNextField( @@ -2194,12 +2194,12 @@ _readField_medium: iprot, 3, 4, - apache::thrift::protocol::T_I32))) { + apache::thrift::protocol::T_I64))) { goto _advance_failure; } -_readField_biggish: +_readField_big: { - ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::readWithContext(*iprot, this->__fbthrift_field_biggish, _readState); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::readWithContext(*iprot, this->__fbthrift_field_big, _readState); } if (UNLIKELY(!_readState.advanceToNextField( @@ -2249,8 +2249,8 @@ _loop: } case 2: { - if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_I64))) { - goto _readField_big; + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_I32))) { + goto _readField_biggish; } else { goto _skip; } @@ -2265,8 +2265,8 @@ _loop: } case 4: { - if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_I32))) { - goto _readField_biggish; + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_I64))) { + goto _readField_big; } else { goto _skip; } @@ -2298,17 +2298,17 @@ uint32_t MinPaddingWithCustomType::serializedSize(Protocol_ const* prot_) const xfer += prot_->serializedFieldSize("small", apache::thrift::protocol::T_BYTE, 1); xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int8_t>::serializedSize(*prot_, this->__fbthrift_field_small); } - if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big))) { - xfer += prot_->serializedFieldSize("big", apache::thrift::protocol::T_I64, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::serializedSize(*prot_, this->__fbthrift_field_big); + if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish))) { + xfer += prot_->serializedFieldSize("biggish", apache::thrift::protocol::T_I32, 2); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, this->__fbthrift_field_biggish); } if (!(::apache::thrift::op::isEmpty<::apache::thrift::op::get_field_tag>>(this->__fbthrift_field_medium))) { xfer += prot_->serializedFieldSize("medium", apache::thrift::protocol::T_I16, 3); xfer += ::apache::thrift::op::serialized_size>(*prot_, this->__fbthrift_field_medium); } - if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish))) { - xfer += prot_->serializedFieldSize("biggish", apache::thrift::protocol::T_I32, 4); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, this->__fbthrift_field_biggish); + if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big))) { + xfer += prot_->serializedFieldSize("big", apache::thrift::protocol::T_I64, 4); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::serializedSize(*prot_, this->__fbthrift_field_big); } if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::byte_t>(this->__fbthrift_field_tiny))) { xfer += prot_->serializedFieldSize("tiny", apache::thrift::protocol::T_BYTE, 5); @@ -2326,17 +2326,17 @@ uint32_t MinPaddingWithCustomType::serializedSizeZC(Protocol_ const* prot_) cons xfer += prot_->serializedFieldSize("small", apache::thrift::protocol::T_BYTE, 1); xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int8_t>::serializedSize(*prot_, this->__fbthrift_field_small); } - if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big))) { - xfer += prot_->serializedFieldSize("big", apache::thrift::protocol::T_I64, 2); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::serializedSize(*prot_, this->__fbthrift_field_big); + if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish))) { + xfer += prot_->serializedFieldSize("biggish", apache::thrift::protocol::T_I32, 2); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, this->__fbthrift_field_biggish); } if (!(::apache::thrift::op::isEmpty<::apache::thrift::op::get_field_tag>>(this->__fbthrift_field_medium))) { xfer += prot_->serializedFieldSize("medium", apache::thrift::protocol::T_I16, 3); xfer += ::apache::thrift::op::serialized_size>(*prot_, this->__fbthrift_field_medium); } - if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish))) { - xfer += prot_->serializedFieldSize("biggish", apache::thrift::protocol::T_I32, 4); - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::serializedSize(*prot_, this->__fbthrift_field_biggish); + if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big))) { + xfer += prot_->serializedFieldSize("big", apache::thrift::protocol::T_I64, 4); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::serializedSize(*prot_, this->__fbthrift_field_big); } if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::byte_t>(this->__fbthrift_field_tiny))) { xfer += prot_->serializedFieldSize("tiny", apache::thrift::protocol::T_BYTE, 5); @@ -2360,11 +2360,11 @@ uint32_t MinPaddingWithCustomType::write(Protocol_* prot_) const { } else { previousFieldHasValue = false; } - if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big))) { + if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish))) { constexpr int16_t kPrevFieldId = 1; - xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "big", previousFieldHasValue); + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "biggish", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::write(*prot_, this->__fbthrift_field_big); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::write(*prot_, this->__fbthrift_field_biggish); xfer += prot_->writeFieldEnd(); } else { previousFieldHasValue = false; @@ -2378,11 +2378,11 @@ uint32_t MinPaddingWithCustomType::write(Protocol_* prot_) const { } else { previousFieldHasValue = false; } - if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i32_t>(this->__fbthrift_field_biggish))) { + if (!(::apache::thrift::op::isEmpty<::apache::thrift::type::i64_t>(this->__fbthrift_field_big))) { constexpr int16_t kPrevFieldId = 3; - xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "biggish", previousFieldHasValue); + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "big", previousFieldHasValue); previousFieldHasValue = true; - xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int32_t>::write(*prot_, this->__fbthrift_field_biggish); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::integral, ::std::int64_t>::write(*prot_, this->__fbthrift_field_big); xfer += prot_->writeFieldEnd(); } else { previousFieldHasValue = false; diff --git a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h index 76be1746896..5429ff3c3d6 100644 --- a/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h +++ b/thrift/compiler/test/fixtures/types/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h @@ -194,11 +194,11 @@ struct VisitByFieldId<::apache::thrift::fixtures::types::MinPaddingWithCustomTyp case 1: return f(0, static_cast(t).small_ref()); case 2: - return f(1, static_cast(t).big_ref()); + return f(1, static_cast(t).biggish_ref()); case 3: return f(2, static_cast(t).medium_ref()); case 4: - return f(3, static_cast(t).biggish_ref()); + return f(3, static_cast(t).big_ref()); case 5: return f(4, static_cast(t).tiny_ref()); default: diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/codec.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/codec.go index 8847f4ff0e7..cdc905f4d93 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/codec.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/codec.go @@ -1189,11 +1189,11 @@ var ( MustBeSetToSerialize: false, }, { ID: 2, - WireType: thrift.I64, - Name: "big", + WireType: thrift.I32, + Name: "biggish", ReflectIndex: 1, IsOptional: false, - ValueTypeSpec: premadeCodecTypeSpec_i64, + ValueTypeSpec: premadeCodecTypeSpec_i32, MustBeSetToSerialize: false, }, { ID: 3, @@ -1205,11 +1205,11 @@ var ( MustBeSetToSerialize: false, }, { ID: 4, - WireType: thrift.I32, - Name: "biggish", + WireType: thrift.I64, + Name: "big", ReflectIndex: 3, IsOptional: false, - ValueTypeSpec: premadeCodecTypeSpec_i32, + ValueTypeSpec: premadeCodecTypeSpec_i64, MustBeSetToSerialize: false, }, { ID: 5, @@ -1229,9 +1229,9 @@ var ( }, FieldSpecNameToIndex: map[string]int{ "small": 0, - "big": 1, + "biggish": 1, "medium": 2, - "biggish": 3, + "big": 3, "tiny": 4, }, } diff --git a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go index bbf85dc26e0..57ad990f245 100644 --- a/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go +++ b/thrift/compiler/test/fixtures/types/out/go/gen-go/module/types.go @@ -3011,9 +3011,9 @@ func (x *MinPadding) setDefaults() *MinPadding { type MinPaddingWithCustomType struct { Small int8 `thrift:"small,1" json:"small" db:"small"` - Big int64 `thrift:"big,2" json:"big" db:"big"` + Biggish int32 `thrift:"biggish,2" json:"biggish" db:"biggish"` Medium int16 `thrift:"medium,3" json:"medium" db:"medium"` - Biggish int32 `thrift:"biggish,4" json:"biggish" db:"biggish"` + Big int64 `thrift:"big,4" json:"big" db:"big"` Tiny int8 `thrift:"tiny,5" json:"tiny" db:"tiny"` } // Compile time interface enforcer @@ -3027,16 +3027,16 @@ func (x *MinPaddingWithCustomType) GetSmall() int8 { return x.Small } -func (x *MinPaddingWithCustomType) GetBig() int64 { - return x.Big +func (x *MinPaddingWithCustomType) GetBiggish() int32 { + return x.Biggish } func (x *MinPaddingWithCustomType) GetMedium() int16 { return x.Medium } -func (x *MinPaddingWithCustomType) GetBiggish() int32 { - return x.Biggish +func (x *MinPaddingWithCustomType) GetBig() int64 { + return x.Big } func (x *MinPaddingWithCustomType) GetTiny() int8 { @@ -3053,13 +3053,13 @@ func (x *MinPaddingWithCustomType) SetSmall(value int8) *MinPaddingWithCustomTyp return x } -func (x *MinPaddingWithCustomType) SetBigNonCompat(value int64) *MinPaddingWithCustomType { - x.Big = value +func (x *MinPaddingWithCustomType) SetBiggishNonCompat(value int32) *MinPaddingWithCustomType { + x.Biggish = value return x } -func (x *MinPaddingWithCustomType) SetBig(value int64) *MinPaddingWithCustomType { - x.Big = value +func (x *MinPaddingWithCustomType) SetBiggish(value int32) *MinPaddingWithCustomType { + x.Biggish = value return x } @@ -3073,13 +3073,13 @@ func (x *MinPaddingWithCustomType) SetMedium(value int16) *MinPaddingWithCustomT return x } -func (x *MinPaddingWithCustomType) SetBiggishNonCompat(value int32) *MinPaddingWithCustomType { - x.Biggish = value +func (x *MinPaddingWithCustomType) SetBigNonCompat(value int64) *MinPaddingWithCustomType { + x.Big = value return x } -func (x *MinPaddingWithCustomType) SetBiggish(value int32) *MinPaddingWithCustomType { - x.Biggish = value +func (x *MinPaddingWithCustomType) SetBig(value int64) *MinPaddingWithCustomType { + x.Big = value return x } @@ -3109,13 +3109,13 @@ func (x *MinPaddingWithCustomType) writeField1(p thrift.Encoder) error { // Sma return nil } -func (x *MinPaddingWithCustomType) writeField2(p thrift.Encoder) error { // Big - if err := p.WriteFieldBegin("big", thrift.I64, 2); err != nil { +func (x *MinPaddingWithCustomType) writeField2(p thrift.Encoder) error { // Biggish + if err := p.WriteFieldBegin("biggish", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) } - item := x.Big - if err := p.WriteI64(item); err != nil { + item := x.Biggish + if err := p.WriteI32(item); err != nil { return err } @@ -3141,13 +3141,13 @@ func (x *MinPaddingWithCustomType) writeField3(p thrift.Encoder) error { // Med return nil } -func (x *MinPaddingWithCustomType) writeField4(p thrift.Encoder) error { // Biggish - if err := p.WriteFieldBegin("biggish", thrift.I32, 4); err != nil { +func (x *MinPaddingWithCustomType) writeField4(p thrift.Encoder) error { // Big + if err := p.WriteFieldBegin("big", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err) } - item := x.Biggish - if err := p.WriteI32(item); err != nil { + item := x.Big + if err := p.WriteI64(item); err != nil { return err } @@ -3184,13 +3184,13 @@ func (x *MinPaddingWithCustomType) readField1(p thrift.Decoder) error { // Smal return nil } -func (x *MinPaddingWithCustomType) readField2(p thrift.Decoder) error { // Big - result, err := p.ReadI64() +func (x *MinPaddingWithCustomType) readField2(p thrift.Decoder) error { // Biggish + result, err := p.ReadI32() if err != nil { return err } - x.Big = result + x.Biggish = result return nil } @@ -3204,13 +3204,13 @@ func (x *MinPaddingWithCustomType) readField3(p thrift.Decoder) error { // Medi return nil } -func (x *MinPaddingWithCustomType) readField4(p thrift.Decoder) error { // Biggish - result, err := p.ReadI32() +func (x *MinPaddingWithCustomType) readField4(p thrift.Decoder) error { // Big + result, err := p.ReadI64() if err != nil { return err } - x.Biggish = result + x.Big = result return nil } @@ -3277,11 +3277,11 @@ func (x *MinPaddingWithCustomType) Read(p thrift.Decoder) error { switch { case ((id == 1 && wireType == thrift.BYTE) || (id == thrift.NO_FIELD_ID && fieldName == "small")): // small fieldReadErr = x.readField1(p) - case ((id == 2 && wireType == thrift.I64) || (id == thrift.NO_FIELD_ID && fieldName == "big")): // big + case ((id == 2 && wireType == thrift.I32) || (id == thrift.NO_FIELD_ID && fieldName == "biggish")): // biggish fieldReadErr = x.readField2(p) case ((id == 3 && wireType == thrift.I16) || (id == thrift.NO_FIELD_ID && fieldName == "medium")): // medium fieldReadErr = x.readField3(p) - case ((id == 4 && wireType == thrift.I32) || (id == thrift.NO_FIELD_ID && fieldName == "biggish")): // biggish + case ((id == 4 && wireType == thrift.I64) || (id == thrift.NO_FIELD_ID && fieldName == "big")): // big fieldReadErr = x.readField4(p) case ((id == 5 && wireType == thrift.BYTE) || (id == thrift.NO_FIELD_ID && fieldName == "tiny")): // tiny fieldReadErr = x.readField5(p) @@ -3312,9 +3312,9 @@ func (x *MinPaddingWithCustomType) String() string { func (x *MinPaddingWithCustomType) setDefaults() *MinPaddingWithCustomType { return x. SetSmallNonCompat(0). - SetBigNonCompat(0). - SetMediumNonCompat(0). SetBiggishNonCompat(0). + SetMediumNonCompat(0). + SetBigNonCompat(0). SetTinyNonCompat(0) } diff --git a/thrift/compiler/test/fixtures/types/out/hack/gen-hack/module_types.php b/thrift/compiler/test/fixtures/types/out/hack/gen-hack/module_types.php index 8db91169161..45d07dd9f01 100644 --- a/thrift/compiler/test/fixtures/types/out/hack/gen-hack/module_types.php +++ b/thrift/compiler/test/fixtures/types/out/hack/gen-hack/module_types.php @@ -2027,9 +2027,9 @@ class MinPaddingWithCustomType implements \IThriftSyncStruct, \IThriftStructMeta 'type' => \TType::BYTE, ), 2 => shape( - 'var' => 'big', + 'var' => 'biggish', 'is_terse' => true, - 'type' => \TType::I64, + 'type' => \TType::I32, ), 3 => shape( 'var' => 'medium', @@ -2037,9 +2037,9 @@ class MinPaddingWithCustomType implements \IThriftSyncStruct, \IThriftStructMeta 'type' => \TType::I16, ), 4 => shape( - 'var' => 'biggish', + 'var' => 'big', 'is_terse' => true, - 'type' => \TType::I32, + 'type' => \TType::I64, ), 5 => shape( 'var' => 'tiny', @@ -2049,21 +2049,21 @@ class MinPaddingWithCustomType implements \IThriftSyncStruct, \IThriftStructMeta ]; const dict FIELDMAP = dict[ 'small' => 1, - 'big' => 2, + 'biggish' => 2, 'medium' => 3, - 'biggish' => 4, + 'big' => 4, 'tiny' => 5, ]; const type TConstructorShape = shape( ?'small' => ?int, - ?'big' => ?int, - ?'medium' => ?int, ?'biggish' => ?int, + ?'medium' => ?int, + ?'big' => ?int, ?'tiny' => ?int, ); - const int STRUCTURAL_ID = 7925816223011912416; + const int STRUCTURAL_ID = 3599217345572234846; /** * Original thrift field:- * 1: byte small @@ -2071,9 +2071,9 @@ class MinPaddingWithCustomType implements \IThriftSyncStruct, \IThriftStructMeta public int $small; /** * Original thrift field:- - * 2: i64 big + * 2: i32 biggish */ - public int $big; + public int $biggish; /** * Original thrift field:- * 3: i16 medium @@ -2081,20 +2081,20 @@ class MinPaddingWithCustomType implements \IThriftSyncStruct, \IThriftStructMeta public int $medium; /** * Original thrift field:- - * 4: i32 biggish + * 4: i64 big */ - public int $biggish; + public int $big; /** * Original thrift field:- * 5: byte tiny */ public int $tiny; - public function __construct(?int $small = null, ?int $big = null, ?int $medium = null, ?int $biggish = null, ?int $tiny = null)[] { + public function __construct(?int $small = null, ?int $biggish = null, ?int $medium = null, ?int $big = null, ?int $tiny = null)[] { $this->small = $small ?? 0; - $this->big = $big ?? 0; - $this->medium = $medium ?? 0; $this->biggish = $biggish ?? 0; + $this->medium = $medium ?? 0; + $this->big = $big ?? 0; $this->tiny = $tiny ?? 0; } @@ -2105,9 +2105,9 @@ public static function withDefaultValues()[]: this { public static function fromShape(self::TConstructorShape $shape)[]: this { return new static( Shapes::idx($shape, 'small'), - Shapes::idx($shape, 'big'), - Shapes::idx($shape, 'medium'), Shapes::idx($shape, 'biggish'), + Shapes::idx($shape, 'medium'), + Shapes::idx($shape, 'big'), Shapes::idx($shape, 'tiny'), ); } @@ -2118,9 +2118,9 @@ public function getName()[]: string { public function clearTerseFields()[write_props]: void { $this->small = 0; - $this->big = 0; - $this->medium = 0; $this->biggish = 0; + $this->medium = 0; + $this->big = 0; $this->tiny = 0; } @@ -2145,10 +2145,10 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 2, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, ) ), - "name" => "big", + "name" => "biggish", ) ), \tmeta_ThriftField::fromShape( @@ -2167,10 +2167,10 @@ public static function getStructMetadata()[]: \tmeta_ThriftStruct { "id" => 4, "type" => \tmeta_ThriftType::fromShape( shape( - "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, + "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, ) ), - "name" => "biggish", + "name" => "big", ) ), \tmeta_ThriftField::fromShape( @@ -2240,25 +2240,25 @@ public function readFromJson(string $jsonText): void { $this->small = (int)$_tmp0; } } - if (idx($parsed, 'big') !== null) { - $this->big = HH\FIXME\UNSAFE_CAST($parsed['big']); - } - if (idx($parsed, 'medium') !== null) { - $_tmp1 = (int)HH\FIXME\UNSAFE_CAST($parsed['medium']); - if ($_tmp1 > 0x7fff) { + if (idx($parsed, 'biggish') !== null) { + $_tmp1 = (int)HH\FIXME\UNSAFE_CAST($parsed['biggish']); + if ($_tmp1 > 0x7fffffff) { throw new \TProtocolException("number exceeds limit in field"); } else { - $this->medium = (int)$_tmp1; + $this->biggish = (int)$_tmp1; } } - if (idx($parsed, 'biggish') !== null) { - $_tmp2 = (int)HH\FIXME\UNSAFE_CAST($parsed['biggish']); - if ($_tmp2 > 0x7fffffff) { + if (idx($parsed, 'medium') !== null) { + $_tmp2 = (int)HH\FIXME\UNSAFE_CAST($parsed['medium']); + if ($_tmp2 > 0x7fff) { throw new \TProtocolException("number exceeds limit in field"); } else { - $this->biggish = (int)$_tmp2; + $this->medium = (int)$_tmp2; } } + if (idx($parsed, 'big') !== null) { + $this->big = HH\FIXME\UNSAFE_CAST($parsed['big']); + } if (idx($parsed, 'tiny') !== null) { $_tmp3 = (int)HH\FIXME\UNSAFE_CAST($parsed['tiny']); if ($_tmp3 > 0x7f) { diff --git a/thrift/compiler/test/fixtures/types/out/py/gen-py/module/ttypes.py b/thrift/compiler/test/fixtures/types/out/py/gen-py/module/ttypes.py index 9ffe91beea7..423ebae3edc 100644 --- a/thrift/compiler/test/fixtures/types/out/py/gen-py/module/ttypes.py +++ b/thrift/compiler/test/fixtures/types/out/py/gen-py/module/ttypes.py @@ -1536,9 +1536,9 @@ class MinPaddingWithCustomType: r""" Attributes: - small - - big - - medium - biggish + - medium + - big - tiny """ @@ -1568,8 +1568,8 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.I64: - self.big = iprot.readI64() + if ftype == TType.I32: + self.biggish = iprot.readI32() else: iprot.skip(ftype) elif fid == 3: @@ -1578,8 +1578,8 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 4: - if ftype == TType.I32: - self.biggish = iprot.readI32() + if ftype == TType.I64: + self.big = iprot.readI64() else: iprot.skip(ftype) elif fid == 5: @@ -1604,17 +1604,17 @@ def write(self, oprot): oprot.writeFieldBegin('small', TType.BYTE, 1) oprot.writeByte(self.small) oprot.writeFieldEnd() - if self.big != None: - oprot.writeFieldBegin('big', TType.I64, 2) - oprot.writeI64(self.big) + if self.biggish != None: + oprot.writeFieldBegin('biggish', TType.I32, 2) + oprot.writeI32(self.biggish) oprot.writeFieldEnd() if self.medium != None: oprot.writeFieldBegin('medium', TType.I16, 3) oprot.writeI16(self.medium) oprot.writeFieldEnd() - if self.biggish != None: - oprot.writeFieldBegin('biggish', TType.I32, 4) - oprot.writeI32(self.biggish) + if self.big != None: + oprot.writeFieldBegin('big', TType.I64, 4) + oprot.writeI64(self.big) oprot.writeFieldEnd() if self.tiny != None: oprot.writeFieldBegin('tiny', TType.BYTE, 5) @@ -1630,18 +1630,18 @@ def __repr__(self): value = pprint.pformat(self.small, indent=0) value = padding.join(value.splitlines(True)) L.append(' small=%s' % (value)) - if self.big is not None: - value = pprint.pformat(self.big, indent=0) + if self.biggish is not None: + value = pprint.pformat(self.biggish, indent=0) value = padding.join(value.splitlines(True)) - L.append(' big=%s' % (value)) + L.append(' biggish=%s' % (value)) if self.medium is not None: value = pprint.pformat(self.medium, indent=0) value = padding.join(value.splitlines(True)) L.append(' medium=%s' % (value)) - if self.biggish is not None: - value = pprint.pformat(self.biggish, indent=0) + if self.big is not None: + value = pprint.pformat(self.big, indent=0) value = padding.join(value.splitlines(True)) - L.append(' biggish=%s' % (value)) + L.append(' big=%s' % (value)) if self.tiny is not None: value = pprint.pformat(self.tiny, indent=0) value = padding.join(value.splitlines(True)) @@ -1660,9 +1660,9 @@ def __ne__(self, other): def __dir__(self): return ( 'small', - 'big', - 'medium', 'biggish', + 'medium', + 'big', 'tiny', ) @@ -4543,9 +4543,9 @@ def MinPadding__setstate__(self, state): all_structs.append(MinPaddingWithCustomType) MinPaddingWithCustomType.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (1, TType.BYTE, 'small', None, None, 3, ), # 1 - (2, TType.I64, 'big', None, None, 3, ), # 2 + (2, TType.I32, 'biggish', None, None, 3, ), # 2 (3, TType.I16, 'medium', None, None, 3, ), # 3 - (4, TType.I32, 'biggish', None, None, 3, ), # 4 + (4, TType.I64, 'big', None, None, 3, ), # 4 (5, TType.BYTE, 'tiny', None, None, 3, ), # 5 ))) @@ -4554,20 +4554,20 @@ def MinPadding__setstate__(self, state): MinPaddingWithCustomType.thrift_field_annotations = { } -def MinPaddingWithCustomType__init__(self, small=None, big=None, medium=None, biggish=None, tiny=None,): +def MinPaddingWithCustomType__init__(self, small=None, biggish=None, medium=None, big=None, tiny=None,): self.small = small - self.big = big - self.medium = medium self.biggish = biggish + self.medium = medium + self.big = big self.tiny = tiny MinPaddingWithCustomType.__init__ = MinPaddingWithCustomType__init__ def MinPaddingWithCustomType__setstate__(self, state): state.setdefault('small', None) - state.setdefault('big', None) - state.setdefault('medium', None) state.setdefault('biggish', None) + state.setdefault('medium', None) + state.setdefault('big', None) state.setdefault('tiny', None) self.__dict__ = state diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/builders.py b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/builders.py index bcc53612cdb..0873fd7f4e5 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/builders.py +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/builders.py @@ -162,16 +162,16 @@ class MinPaddingWithCustomType_Builder(thrift.py3.builder.StructBuilder): def __init__(self): self.small: _typing.Optional[int] = None - self.big: _typing.Optional[int] = None - self.medium: _typing.Optional[int] = None self.biggish: _typing.Optional[int] = None + self.medium: _typing.Optional[int] = None + self.big: _typing.Optional[int] = None self.tiny: _typing.Optional[int] = None def __iter__(self): yield "small", self.small - yield "big", self.big - yield "medium", self.medium yield "biggish", self.biggish + yield "medium", self.medium + yield "big", self.big yield "tiny", self.tiny _fbthrift_struct_type__MyStruct = _apache_thrift_fixtures_types_module_types.MyStruct diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/cbindings.pxd b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/cbindings.pxd index 092e4cd2db2..9014fb830c8 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/cbindings.pxd +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/cbindings.pxd @@ -593,9 +593,9 @@ cdef extern from "thrift/compiler/test/fixtures/types/gen-cpp2/module_types_cust bint operator<=(cMinPaddingWithCustomType&) bint operator>=(cMinPaddingWithCustomType&) __terse_field_ref[cint8_t] small_ref "small_ref" () - __terse_field_ref[cint64_t] big_ref "big_ref" () - __terse_field_ref[cint16_t] medium_ref "medium_ref" () __terse_field_ref[cint32_t] biggish_ref "biggish_ref" () + __terse_field_ref[cint16_t] medium_ref "medium_ref" () + __terse_field_ref[cint64_t] big_ref "big_ref" () __terse_field_ref[cint8_t] tiny_ref "tiny_ref" () diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd index 630950ffb20..0de23c98ea6 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pxd @@ -197,9 +197,9 @@ cdef class MinPaddingWithCustomType(thrift.py3.types.Struct): cdef shared_ptr[_apache_thrift_fixtures_types_module_cbindings.cMinPaddingWithCustomType] _cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE cdef _fbthrift_types_fields.__MinPaddingWithCustomType_FieldsSetter _fields_setter cdef inline object small_impl(self) - cdef inline object big_impl(self) - cdef inline object medium_impl(self) cdef inline object biggish_impl(self) + cdef inline object medium_impl(self) + cdef inline object big_impl(self) cdef inline object tiny_impl(self) @staticmethod diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyi b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyi index 0229bfeb1fa..2805ee4f4fa 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyi +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyi @@ -445,26 +445,26 @@ class MinPaddingWithCustomType(thrift.py3.types.Struct, _typing.Hashable): pass small: _typing.Final[int] = ... - big: _typing.Final[int] = ... - medium: _typing.Final[int] = ... biggish: _typing.Final[int] = ... + medium: _typing.Final[int] = ... + big: _typing.Final[int] = ... tiny: _typing.Final[int] = ... def __init__( self, *, small: _typing.Optional[int]=None, - big: _typing.Optional[int]=None, - medium: _typing.Optional[int]=None, biggish: _typing.Optional[int]=None, + medium: _typing.Optional[int]=None, + big: _typing.Optional[int]=None, tiny: _typing.Optional[int]=None ) -> None: ... def __call__( self, *, small: _typing.Union[int, None]=None, - big: _typing.Union[int, None]=None, - medium: _typing.Union[int, None]=None, biggish: _typing.Union[int, None]=None, + medium: _typing.Union[int, None]=None, + big: _typing.Union[int, None]=None, tiny: _typing.Union[int, None]=None ) -> MinPaddingWithCustomType: ... diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyx b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyx index eb5d43378de..3321781ca8f 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyx +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types.pyx @@ -1535,12 +1535,12 @@ cdef class MinPaddingWithCustomType(thrift.py3.types.Struct): def small(self): return self.small_impl() - cdef inline big_impl(self): - return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).big_ref().value() + cdef inline biggish_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).biggish_ref().value() @property - def big(self): - return self.big_impl() + def biggish(self): + return self.biggish_impl() cdef inline medium_impl(self): return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).medium_ref().value() @@ -1549,12 +1549,12 @@ cdef class MinPaddingWithCustomType(thrift.py3.types.Struct): def medium(self): return self.medium_impl() - cdef inline biggish_impl(self): - return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).biggish_ref().value() + cdef inline big_impl(self): + return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).big_ref().value() @property - def biggish(self): - return self.biggish_impl() + def big(self): + return self.big_impl() cdef inline tiny_impl(self): return deref(self._cpp_obj_FBTHRIFT_ONLY_DO_NOT_USE).tiny_ref().value() diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_fields.pyx b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_fields.pyx index f344f0d8f30..3266ef1fff1 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_fields.pyx +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_fields.pyx @@ -473,9 +473,9 @@ cdef class __MinPaddingWithCustomType_FieldsSetter(__StructFieldsSetter): cdef __MinPaddingWithCustomType_FieldsSetter __fbthrift_inst = __MinPaddingWithCustomType_FieldsSetter.__new__(__MinPaddingWithCustomType_FieldsSetter) __fbthrift_inst._struct_cpp_obj = struct_cpp_obj __fbthrift_inst._setters[__cstring_view("small")] = __MinPaddingWithCustomType_FieldsSetter._set_field_0 - __fbthrift_inst._setters[__cstring_view("big")] = __MinPaddingWithCustomType_FieldsSetter._set_field_1 + __fbthrift_inst._setters[__cstring_view("biggish")] = __MinPaddingWithCustomType_FieldsSetter._set_field_1 __fbthrift_inst._setters[__cstring_view("medium")] = __MinPaddingWithCustomType_FieldsSetter._set_field_2 - __fbthrift_inst._setters[__cstring_view("biggish")] = __MinPaddingWithCustomType_FieldsSetter._set_field_3 + __fbthrift_inst._setters[__cstring_view("big")] = __MinPaddingWithCustomType_FieldsSetter._set_field_3 __fbthrift_inst._setters[__cstring_view("tiny")] = __MinPaddingWithCustomType_FieldsSetter._set_field_4 return __fbthrift_inst @@ -497,14 +497,14 @@ cdef class __MinPaddingWithCustomType_FieldsSetter(__StructFieldsSetter): deref(self._struct_cpp_obj).small_ref().assign(_fbthrift_value) cdef void _set_field_1(self, _fbthrift_value) except *: - # for field big + # for field biggish if _fbthrift_value is None: __reset_field[_apache_thrift_fixtures_types_module_cbindings.cMinPaddingWithCustomType](deref(self._struct_cpp_obj), 1) return if not isinstance(_fbthrift_value, int): - raise TypeError(f'big is not a { int !r}.') - _fbthrift_value = _fbthrift_value - deref(self._struct_cpp_obj).big_ref().assign(_fbthrift_value) + raise TypeError(f'biggish is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).biggish_ref().assign(_fbthrift_value) cdef void _set_field_2(self, _fbthrift_value) except *: # for field medium @@ -517,14 +517,14 @@ cdef class __MinPaddingWithCustomType_FieldsSetter(__StructFieldsSetter): deref(self._struct_cpp_obj).medium_ref().assign(_fbthrift_value) cdef void _set_field_3(self, _fbthrift_value) except *: - # for field biggish + # for field big if _fbthrift_value is None: __reset_field[_apache_thrift_fixtures_types_module_cbindings.cMinPaddingWithCustomType](deref(self._struct_cpp_obj), 3) return if not isinstance(_fbthrift_value, int): - raise TypeError(f'biggish is not a { int !r}.') - _fbthrift_value = _fbthrift_value - deref(self._struct_cpp_obj).biggish_ref().assign(_fbthrift_value) + raise TypeError(f'big is not a { int !r}.') + _fbthrift_value = _fbthrift_value + deref(self._struct_cpp_obj).big_ref().assign(_fbthrift_value) cdef void _set_field_4(self, _fbthrift_value) except *: # for field tiny diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_reflection.py b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_reflection.py index b8b769e8aab..1d06f9fd16f 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_reflection.py +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/apache/thrift/fixtures/types/module/types_reflection.py @@ -477,10 +477,10 @@ def get_reflection__MinPaddingWithCustomType() -> __StructSpec: spec.add_field( __FieldSpec._fbthrift_create( id=2, - name="big", - py_name="big", + name="biggish", + py_name="biggish", type=int, - kind=__NumberType.I64, + kind=__NumberType.I32, qualifier=__Qualifier.UNQUALIFIED, default=None, annotations={ @@ -503,10 +503,10 @@ def get_reflection__MinPaddingWithCustomType() -> __StructSpec: spec.add_field( __FieldSpec._fbthrift_create( id=4, - name="biggish", - py_name="biggish", + name="big", + py_name="big", type=int, - kind=__NumberType.I32, + kind=__NumberType.I64, qualifier=__Qualifier.UNQUALIFIED, default=None, annotations={ diff --git a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/module/types.h b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/module/types.h index d29fdf7d6fd..e51abadd8a7 100644 --- a/thrift/compiler/test/fixtures/types/out/py3/gen-py3/module/types.h +++ b/thrift/compiler/test/fixtures/types/out/py3/gen-py3/module/types.h @@ -181,13 +181,13 @@ inline void reset_field<::apache::thrift::fixtures::types::MinPaddingWithCustomT obj.small_ref().copy_from(default_inst<::apache::thrift::fixtures::types::MinPaddingWithCustomType>().small_ref()); return; case 1: - obj.big_ref().copy_from(default_inst<::apache::thrift::fixtures::types::MinPaddingWithCustomType>().big_ref()); + obj.biggish_ref().copy_from(default_inst<::apache::thrift::fixtures::types::MinPaddingWithCustomType>().biggish_ref()); return; case 2: obj.medium_ref().copy_from(default_inst<::apache::thrift::fixtures::types::MinPaddingWithCustomType>().medium_ref()); return; case 3: - obj.biggish_ref().copy_from(default_inst<::apache::thrift::fixtures::types::MinPaddingWithCustomType>().biggish_ref()); + obj.big_ref().copy_from(default_inst<::apache::thrift::fixtures::types::MinPaddingWithCustomType>().big_ref()); return; case 4: obj.tiny_ref().copy_from(default_inst<::apache::thrift::fixtures::types::MinPaddingWithCustomType>().tiny_ref()); diff --git a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_abstract_types.py b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_abstract_types.py index 8174a728714..d4d55722c9f 100644 --- a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_abstract_types.py +++ b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_abstract_types.py @@ -275,7 +275,7 @@ def small(self) -> int: ... # pyre-ignore[16]: Module `_fbthrift_builtins` has no attribute `property`. @_fbthrift_builtins.property @_abc.abstractmethod - def big(self) -> int: ... + def biggish(self) -> int: ... # pyre-ignore[16]: Module `_fbthrift_builtins` has no attribute `property`. @_fbthrift_builtins.property @_abc.abstractmethod @@ -283,7 +283,7 @@ def medium(self) -> int: ... # pyre-ignore[16]: Module `_fbthrift_builtins` has no attribute `property`. @_fbthrift_builtins.property @_abc.abstractmethod - def biggish(self) -> int: ... + def big(self) -> int: ... # pyre-ignore[16]: Module `_fbthrift_builtins` has no attribute `property`. @_fbthrift_builtins.property @_abc.abstractmethod diff --git a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py index 35d5f049cee..0efa594c1c2 100644 --- a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py +++ b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_metadata.py @@ -345,12 +345,12 @@ def _fbthrift_gen_metadata_struct_MinPaddingWithCustomType(metadata_struct: _fbt fields = [ _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_BYTE_TYPE), name="small", is_optional=False, structured_annotations=[ ]), - _fbthrift_metadata.ThriftField(id=2, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I64_TYPE), name="big", is_optional=False, structured_annotations=[ + _fbthrift_metadata.ThriftField(id=2, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE), name="biggish", is_optional=False, structured_annotations=[ ]), _fbthrift_metadata.ThriftField(id=3, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I16_TYPE), name="medium", is_optional=False, structured_annotations=[ _fbthrift_metadata.ThriftConstStruct(type=_fbthrift_metadata.ThriftStructType(name="cpp.Adapter"), fields= { "name": _fbthrift_metadata.ThriftConstValue(cv_string="::my::Adapter"), }), ]), - _fbthrift_metadata.ThriftField(id=4, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE), name="biggish", is_optional=False, structured_annotations=[ + _fbthrift_metadata.ThriftField(id=4, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I64_TYPE), name="big", is_optional=False, structured_annotations=[ ]), _fbthrift_metadata.ThriftField(id=5, type=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_BYTE_TYPE), name="tiny", is_optional=False, structured_annotations=[ ]), @@ -366,9 +366,9 @@ def _fbthrift_gen_metadata_struct_MinPaddingWithCustomType(metadata_struct: _fbt new_struct = metadata_struct(structs=struct_dict) # small - # big - # medium # biggish + # medium + # big # tiny return new_struct diff --git a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.py b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.py index be8692587fa..b087312cf0c 100644 --- a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.py +++ b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.py @@ -830,13 +830,13 @@ class MinPaddingWithCustomType(metaclass=_fbthrift_python_mutable_types.MutableS _fbthrift_python_types.FieldInfo( 2, # id _fbthrift_python_types.FieldQualifier.Terse, # qualifier - "big", # name - "big", # python name (from @python.Name annotation) - _fbthrift_python_types.typeinfo_i64, # typeinfo + "biggish", # name + "biggish", # python name (from @python.Name annotation) + _fbthrift_python_types.typeinfo_i32, # typeinfo None, # default value None, # adapter info True, # field type is primitive - 5, # IDL type (see BaseTypeEnum) + 4, # IDL type (see BaseTypeEnum) ), _fbthrift_python_types.FieldInfo( 3, # id @@ -852,13 +852,13 @@ class MinPaddingWithCustomType(metaclass=_fbthrift_python_mutable_types.MutableS _fbthrift_python_types.FieldInfo( 4, # id _fbthrift_python_types.FieldQualifier.Terse, # qualifier - "biggish", # name - "biggish", # python name (from @python.Name annotation) - _fbthrift_python_types.typeinfo_i32, # typeinfo + "big", # name + "big", # python name (from @python.Name annotation) + _fbthrift_python_types.typeinfo_i64, # typeinfo None, # default value None, # adapter info True, # field type is primitive - 4, # IDL type (see BaseTypeEnum) + 5, # IDL type (see BaseTypeEnum) ), _fbthrift_python_types.FieldInfo( 5, # id diff --git a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.pyi b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.pyi index d2b89f282ca..a8f7198a3d7 100644 --- a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.pyi +++ b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_mutable_types.pyi @@ -433,9 +433,9 @@ class MinPaddingWithCustomType(_fbthrift_python_mutable_types.MutableStruct, _fb def small(self, value: int) -> None: ... @property - def big(self) -> int: ... - @big.setter - def big(self, value: int) -> None: ... + def biggish(self) -> int: ... + @biggish.setter + def biggish(self, value: int) -> None: ... @property def medium(self) -> int: ... @@ -443,9 +443,9 @@ class MinPaddingWithCustomType(_fbthrift_python_mutable_types.MutableStruct, _fb def medium(self, value: int) -> None: ... @property - def biggish(self) -> int: ... - @biggish.setter - def biggish(self, value: int) -> None: ... + def big(self) -> int: ... + @big.setter + def big(self, value: int) -> None: ... @property def tiny(self) -> int: ... @@ -455,18 +455,18 @@ class MinPaddingWithCustomType(_fbthrift_python_mutable_types.MutableStruct, _fb def __init__( self, *, small: _typing.Optional[int]=..., - big: _typing.Optional[int]=..., - medium: _typing.Optional[int]=..., biggish: _typing.Optional[int]=..., + medium: _typing.Optional[int]=..., + big: _typing.Optional[int]=..., tiny: _typing.Optional[int]=... ) -> None: ... def __call__( self, *, small: _typing.Optional[int]=..., - big: _typing.Optional[int]=..., - medium: _typing.Optional[int]=..., biggish: _typing.Optional[int]=..., + medium: _typing.Optional[int]=..., + big: _typing.Optional[int]=..., tiny: _typing.Optional[int]=... ) -> _typing.Self: ... def __iter__(self) -> _typing.Iterator[_typing.Tuple[str, _typing.Union[int, int, int, int, int]]]: ... diff --git a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.py b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.py index 9158af9b14a..acf2d5aab52 100644 --- a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.py +++ b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.py @@ -861,13 +861,13 @@ class MinPaddingWithCustomType(metaclass=_fbthrift_python_types.StructMeta): _fbthrift_python_types.FieldInfo( 2, # id _fbthrift_python_types.FieldQualifier.Terse, # qualifier - "big", # name - "big", # python name (from @python.Name annotation) - _fbthrift_python_types.typeinfo_i64, # typeinfo + "biggish", # name + "biggish", # python name (from @python.Name annotation) + _fbthrift_python_types.typeinfo_i32, # typeinfo None, # default value None, # adapter info True, # field type is primitive - 5, # IDL type (see BaseTypeEnum) + 4, # IDL type (see BaseTypeEnum) ), _fbthrift_python_types.FieldInfo( 3, # id @@ -883,13 +883,13 @@ class MinPaddingWithCustomType(metaclass=_fbthrift_python_types.StructMeta): _fbthrift_python_types.FieldInfo( 4, # id _fbthrift_python_types.FieldQualifier.Terse, # qualifier - "biggish", # name - "biggish", # python name (from @python.Name annotation) - _fbthrift_python_types.typeinfo_i32, # typeinfo + "big", # name + "big", # python name (from @python.Name annotation) + _fbthrift_python_types.typeinfo_i64, # typeinfo None, # default value None, # adapter info True, # field type is primitive - 4, # IDL type (see BaseTypeEnum) + 5, # IDL type (see BaseTypeEnum) ), _fbthrift_python_types.FieldInfo( 5, # id diff --git a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi index 01e7e473866..82693b2fcef 100644 --- a/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi +++ b/thrift/compiler/test/fixtures/types/out/python/gen-python/apache/thrift/fixtures/types/module/thrift_types.pyi @@ -322,25 +322,25 @@ class _fbthrift_compatible_with_MinPaddingWithCustomType: class MinPaddingWithCustomType(_fbthrift_python_types.Struct, _fbthrift_compatible_with_MinPaddingWithCustomType, _fbthrift_python_abstract_types.MinPaddingWithCustomType): small: _typing.Final[int] = ... - big: _typing.Final[int] = ... - medium: _typing.Final[int] = ... biggish: _typing.Final[int] = ... + medium: _typing.Final[int] = ... + big: _typing.Final[int] = ... tiny: _typing.Final[int] = ... def __init__( self, *, small: _typing.Optional[int]=..., - big: _typing.Optional[int]=..., - medium: _typing.Optional[int]=..., biggish: _typing.Optional[int]=..., + medium: _typing.Optional[int]=..., + big: _typing.Optional[int]=..., tiny: _typing.Optional[int]=... ) -> None: ... def __call__( self, *, small: _typing.Optional[int]=..., - big: _typing.Optional[int]=..., - medium: _typing.Optional[int]=..., biggish: _typing.Optional[int]=..., + medium: _typing.Optional[int]=..., + big: _typing.Optional[int]=..., tiny: _typing.Optional[int]=... ) -> _typing.Self: ... def __iter__(self) -> _typing.Iterator[_typing.Tuple[str, _typing.Union[int, int, int, int, int]]]: ... diff --git a/thrift/compiler/test/fixtures/types/out/rust/gen-rust/types.rs b/thrift/compiler/test/fixtures/types/out/rust/gen-rust/types.rs index f4fbbb3bd7e..5e7c3b8ca42 100644 --- a/thrift/compiler/test/fixtures/types/out/rust/gen-rust/types.rs +++ b/thrift/compiler/test/fixtures/types/out/rust/gen-rust/types.rs @@ -173,9 +173,9 @@ pub struct MinPadding { #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MinPaddingWithCustomType { pub small: ::std::primitive::i8, - pub big: ::std::primitive::i64, - pub medium: ::std::primitive::i16, pub biggish: ::std::primitive::i32, + pub medium: ::std::primitive::i16, + pub big: ::std::primitive::i64, pub tiny: ::std::primitive::i8, // This field forces `..Default::default()` when instantiating this // struct, to make code future-proof against new fields added later to @@ -2309,9 +2309,9 @@ impl ::std::default::Default for self::MinPaddingWithCustomType { fn default() -> Self { Self { small: ::std::default::Default::default(), - big: ::std::default::Default::default(), - medium: ::std::default::Default::default(), biggish: ::std::default::Default::default(), + medium: ::std::default::Default::default(), + big: ::std::default::Default::default(), tiny: ::std::default::Default::default(), _dot_dot_Default_default: self::dot_dot::OtherFields(()), } @@ -2323,9 +2323,9 @@ impl ::std::fmt::Debug for self::MinPaddingWithCustomType { formatter .debug_struct("MinPaddingWithCustomType") .field("small", &self.small) - .field("big", &self.big) - .field("medium", &self.medium) .field("biggish", &self.biggish) + .field("medium", &self.medium) + .field("big", &self.big) .field("tiny", &self.tiny) .finish() } @@ -2363,14 +2363,14 @@ where p.write_field_begin("small", ::fbthrift::TType::Byte, 1); ::fbthrift::Serialize::write(&self.small, p); p.write_field_end(); - p.write_field_begin("big", ::fbthrift::TType::I64, 2); - ::fbthrift::Serialize::write(&self.big, p); + p.write_field_begin("biggish", ::fbthrift::TType::I32, 2); + ::fbthrift::Serialize::write(&self.biggish, p); p.write_field_end(); p.write_field_begin("medium", ::fbthrift::TType::I16, 3); ::fbthrift::Serialize::write(&self.medium, p); p.write_field_end(); - p.write_field_begin("biggish", ::fbthrift::TType::I32, 4); - ::fbthrift::Serialize::write(&self.biggish, p); + p.write_field_begin("big", ::fbthrift::TType::I64, 4); + ::fbthrift::Serialize::write(&self.big, p); p.write_field_end(); p.write_field_begin("tiny", ::fbthrift::TType::Byte, 5); ::fbthrift::Serialize::write(&self.tiny, p); @@ -2387,16 +2387,16 @@ where #[inline] fn read(p: &mut P) -> ::anyhow::Result { static FIELDS: &[::fbthrift::Field] = &[ - ::fbthrift::Field::new("big", ::fbthrift::TType::I64, 2), - ::fbthrift::Field::new("biggish", ::fbthrift::TType::I32, 4), + ::fbthrift::Field::new("big", ::fbthrift::TType::I64, 4), + ::fbthrift::Field::new("biggish", ::fbthrift::TType::I32, 2), ::fbthrift::Field::new("medium", ::fbthrift::TType::I16, 3), ::fbthrift::Field::new("small", ::fbthrift::TType::Byte, 1), ::fbthrift::Field::new("tiny", ::fbthrift::TType::Byte, 5), ]; let mut field_small = ::std::option::Option::None; - let mut field_big = ::std::option::Option::None; - let mut field_medium = ::std::option::Option::None; let mut field_biggish = ::std::option::Option::None; + let mut field_medium = ::std::option::Option::None; + let mut field_big = ::std::option::Option::None; let mut field_tiny = ::std::option::Option::None; let _ = ::anyhow::Context::context(p.read_struct_begin(|_| ()), "Expected a MinPaddingWithCustomType")?; loop { @@ -2404,9 +2404,9 @@ where match (fty, fid as ::std::primitive::i32) { (::fbthrift::TType::Stop, _) => break, (::fbthrift::TType::Byte, 1) => field_small = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), - (::fbthrift::TType::I64, 2) => field_big = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), + (::fbthrift::TType::I32, 2) => field_biggish = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::I16, 3) => field_medium = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), - (::fbthrift::TType::I32, 4) => field_biggish = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), + (::fbthrift::TType::I64, 4) => field_big = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (::fbthrift::TType::Byte, 5) => field_tiny = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?), (fty, _) => p.skip(fty)?, } @@ -2415,9 +2415,9 @@ where p.read_struct_end()?; ::std::result::Result::Ok(Self { small: field_small.unwrap_or_default(), - big: field_big.unwrap_or_default(), - medium: field_medium.unwrap_or_default(), biggish: field_biggish.unwrap_or_default(), + medium: field_medium.unwrap_or_default(), + big: field_big.unwrap_or_default(), tiny: field_tiny.unwrap_or_default(), _dot_dot_Default_default: self::dot_dot::OtherFields(()), }) diff --git a/thrift/compiler/test/fixtures/types/src/module.thrift b/thrift/compiler/test/fixtures/types/src/module.thrift index 248d757bc89..c1aaf8aee53 100644 --- a/thrift/compiler/test/fixtures/types/src/module.thrift +++ b/thrift/compiler/test/fixtures/types/src/module.thrift @@ -115,10 +115,10 @@ struct MinPadding { @thrift.TerseWrite struct MinPaddingWithCustomType { 1: byte small; - 2: i64 big; + 2: i32 biggish; @cpp.Adapter{name = "::my::Adapter"} 3: i16 medium; - 4: i32 biggish; + 4: i64 big; 5: byte tiny; }