From 2c9bd527889999223be397c9fb814ae2d873e390 Mon Sep 17 00:00:00 2001 From: UENISHI Kota Date: Thu, 24 Apr 2014 17:10:19 +0900 Subject: [PATCH 1/2] compile in 17.0: clients are compiles with various OTP versions --- src/riak_pb_kv_codec.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riak_pb_kv_codec.erl b/src/riak_pb_kv_codec.erl index c693656e..8de7f583 100644 --- a/src/riak_pb_kv_codec.erl +++ b/src/riak_pb_kv_codec.erl @@ -49,7 +49,7 @@ -type quorum() :: symbolic_quorum() | non_neg_integer(). -type symbolic_quorum() :: one | quorum | all | default. -type value() :: binary(). --type metadata() :: dict(). +-type metadata() :: dict:dict(binary(), binary()). -type contents() :: [{metadata(), value()}]. %% @doc Convert a list of object {MetaData,Value} pairs to protocol From de68a103920c79d370f9cf5334f9bb7771ebe26f Mon Sep 17 00:00:00 2001 From: UENISHI Kota Date: Fri, 25 Apr 2014 12:16:01 +0900 Subject: [PATCH 2/2] introduce version switch, to make dialyzer rather happy --- rebar.config.script | 17 +++++++++++++++++ src/riak_pb_kv_codec.erl | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 rebar.config.script diff --git a/rebar.config.script b/rebar.config.script new file mode 100644 index 00000000..cbcd06ed --- /dev/null +++ b/rebar.config.script @@ -0,0 +1,17 @@ +case erlang:system_info(otp_release) of + + [$R|_] -> + %% Rxx < 17.0, not border inclusive + HashDefine = [{d,pre17}], + case lists:keysearch(erl_opts, 1, CONFIG) of + {value, {erl_opts, Opts}} -> + lists:keyreplace(erl_opts,1,CONFIG,{erl_opts,Opts++HashDefine}); + false -> + CONFIG ++ [{erl_opts, HashDefine}] + end; + + _ -> + %% "17", our future with map + CONFIG + +end. diff --git a/src/riak_pb_kv_codec.erl b/src/riak_pb_kv_codec.erl index 8de7f583..1128f7bb 100644 --- a/src/riak_pb_kv_codec.erl +++ b/src/riak_pb_kv_codec.erl @@ -49,7 +49,13 @@ -type quorum() :: symbolic_quorum() | non_neg_integer(). -type symbolic_quorum() :: one | quorum | all | default. -type value() :: binary(). + +-ifdef(pre17). +-type metadata() :: dict(). +-else. -type metadata() :: dict:dict(binary(), binary()). +-endif. + -type contents() :: [{metadata(), value()}]. %% @doc Convert a list of object {MetaData,Value} pairs to protocol