THRIFT-4868: Golang: Fix compilation for optional set<binary> with default values

This commit is contained in:
Yuri Melnikov 2021-09-08 18:46:12 -04:00 committed by Yuxuan 'fishy' Wang
parent 0cc06506b8
commit 38bd636a18
2 changed files with 7 additions and 2 deletions

View File

@ -1309,7 +1309,7 @@ string t_go_generator::render_const_value(t_type* type, t_const_value* value, co
t_type* ktype = ((t_map*)type)->get_key_type();
t_type* vtype = ((t_map*)type)->get_val_type();
const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
out << "map[" << type_to_go_type(ktype) << "]" << type_to_go_type(vtype) << "{" << endl;
out << "map[" << type_to_go_key_type(ktype) << "]" << type_to_go_type(vtype) << "{" << endl;
indent_up();
map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
@ -1336,7 +1336,7 @@ string t_go_generator::render_const_value(t_type* type, t_const_value* value, co
} else if (type->is_set()) {
t_type* etype = ((t_set*)type)->get_elem_type();
const vector<t_const_value*>& val = value->get_list();
out << "[]" << type_to_go_key_type(etype) << "{" << endl;
out << "[]" << type_to_go_type(etype) << "{" << endl;
indent_up();
vector<t_const_value*>::const_iterator v_iter;

View File

@ -411,3 +411,8 @@ struct StructB {
struct OptionalSetDefaultTest {
1: optional set<string> with_default = [ "test" ]
}
struct OptionalBinary {
1: optional set<binary> bin_set = {}
2: optional map<binary,i32> bin_map = {}
}