Skip to content

Commit

Permalink
THRIFT-4497: Use map() field type for Erlang type for map struct fi…
Browse files Browse the repository at this point in the history
…elds.

Client: erl

The Thrift Erlang code generator previously generated fields with the
`#{}` Erlang type for maps fields.  In the Erlang type specification
languages, however, `#{}` specifically means an empty map.  This commit
fixes the code to emit `map()` instead, which means the maps keys and
values may be of any type.

It would be possible to emit a field type such as
`${keytype() => maptype()}`, but this commit does not do that.

This closes apache#1495
  • Loading branch information
David Hull authored and jeking3 committed Mar 10, 2018
1 parent 3e871c7 commit c0de141
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/cpp/src/thrift/generate/t_erl_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ string t_erl_generator::render_member_type(t_field* field) {
return type_name(type) + "()";
} else if (type->is_map()) {
if (maps_) {
return "#{}";
return "map()";
} else if (otp16_) {
return "dict()";
} else {
Expand Down

0 comments on commit c0de141

Please sign in to comment.