Skip to content

Commit

Permalink
THRIFT-4495: Allow undefined for non-required Erlang records fields.
Browse files Browse the repository at this point in the history
Client: erl

As of Erlang 19, the dialyzer static type-analysis tool no longer
implicitly adds `undefined` to the allowed types for a field.  This
means that dialyzer will now complain about any non-required fields
that are not explicitly initialed when creating a new record.

This closes apache#1494
  • Loading branch information
David Hull authored and jeking3 committed Mar 10, 2018
1 parent c0cf8a0 commit 3e871c7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/cpp/src/thrift/generate/t_erl_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ void t_erl_generator::generate_erl_struct_member(ostream& out, t_field* tmember)
if (has_default_value(tmember))
out << " = " << render_member_value(tmember);
out << " :: " << render_member_type(tmember);
if (tmember->get_req() != t_field::T_REQUIRED)
out << " | 'undefined'";
}

bool t_erl_generator::has_default_value(t_field* field) {
Expand Down

0 comments on commit 3e871c7

Please sign in to comment.