// Copyright (c) 2006- Facebook
// Distributed under the Thrift Software License
//
// See accompanying file LICENSE or visit the Thrift site at:
// http://developers.facebook.com/thrift/

namespace cpp apache.thrift
namespace php thrift
namespace py apache.thrift.dynamic

cpp_include "thrift/lib/thrift/SerializableDynamic.h"

union Dynamic {
  1: bool boolean;
  2: i64 integer;
  3: double doubl;
  4: binary str;
  5: list<Dynamic> arr;
  6: map<string, Dynamic> object;
} (cpp.type = "::apache::thrift::SerializableDynamic")

// Copyright (c) 2006- Facebook
// Distributed under the Thrift Software License
//
// See accompanying file LICENSE or visit the Thrift site at:
// http://developers.facebook.com/thrift/

namespace cpp apache.thrift
namespace php thrift
namespace py apache.thrift.dynamic

cpp_include "thrift/lib/thrift/SerializableDynamic.h"

union DynamicType {
  1: bool boolean;
  2: i64 integer;
  3: double doubl;
  4: binary str;
  5: list<Dynamic> arr;
  6: map<string, Dynamic> object;
}

typedef DynamicType
  (cpp.type = "::apache::thrift::SerializableDynamic") Dynamic

Move cpp.type from union to typedef

Summary:
cpp.type should only be used in a typedef or a field not a struct/union. Thus, cpp.type does not have an effect on this particular union - therefore it is misplaced.

When attempting to port to mstch-cpp2, it turned out that t_cpp_generator would check if the struct/union contained a cpp.type. This is not consistent, we should only expect a cpp.type from a typedef or a field. This moves the cpp.type to a typedef to be consistent.

Reviewed By: yfeldblum

Differential Revision: D5481401

fbshipit-source-id: f35446de26429dbb4769823ff6a4214087f1c8e6

facebook/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,facebook/fbthrift,facebook/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,facebook/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,getyourguide/fbthrift,facebook/fbthrift,facebook/fbthrift,getyourguide/fbthrift