handle deprecated pre-defined types for 17.0 and later
This commit is contained in:
parent
4c97d4a962
commit
523a66ad74
3 changed files with 21 additions and 1 deletions
|
@ -9,7 +9,8 @@
|
||||||
|
|
||||||
%% Compiler Options ============================================================
|
%% Compiler Options ============================================================
|
||||||
{erl_opts,
|
{erl_opts,
|
||||||
[debug_info,
|
[{platform_define, "^[0-9]+", namespaced_types},
|
||||||
|
debug_info,
|
||||||
warnings_as_errors]}.
|
warnings_as_errors]}.
|
||||||
|
|
||||||
%% EUnit =======================================================================
|
%% EUnit =======================================================================
|
||||||
|
|
|
@ -34,7 +34,11 @@
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%% This should be opaque, but that kills dialyzer so for now we export it
|
%% This should be opaque, but that kills dialyzer so for now we export it
|
||||||
%% however you should not rely on the internal representation here
|
%% however you should not rely on the internal representation here
|
||||||
|
-ifdef(namespaced_types).
|
||||||
|
-type dictionary(_K, _V) :: dict:dict().
|
||||||
|
-else.
|
||||||
-type dictionary(_K, _V) :: dict().
|
-type dictionary(_K, _V) :: dict().
|
||||||
|
-endif.
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% API
|
%%% API
|
||||||
|
|
|
@ -480,9 +480,17 @@ usort(Fun, List, Malt) ->
|
||||||
runmany(Fun2, {recursive, Fuse}, List, Malt).
|
runmany(Fun2, {recursive, Fuse}, List, Malt).
|
||||||
|
|
||||||
%% @doc Like below, assumes default MapMalt of 1.
|
%% @doc Like below, assumes default MapMalt of 1.
|
||||||
|
-ifdef(namespaced_types).
|
||||||
|
-spec mapreduce/2 :: (MapFunc, list()) -> dict:dict() when
|
||||||
|
MapFunc :: fun((term()) -> DeepListOfKeyValuePairs),
|
||||||
|
DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()}.
|
||||||
|
-else.
|
||||||
-spec mapreduce/2 :: (MapFunc, list()) -> dict() when
|
-spec mapreduce/2 :: (MapFunc, list()) -> dict() when
|
||||||
MapFunc :: fun((term()) -> DeepListOfKeyValuePairs),
|
MapFunc :: fun((term()) -> DeepListOfKeyValuePairs),
|
||||||
DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()}.
|
DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()}.
|
||||||
|
-endif.
|
||||||
|
|
||||||
|
|
||||||
mapreduce(MapFunc, List) ->
|
mapreduce(MapFunc, List) ->
|
||||||
mapreduce(MapFunc, List, 1).
|
mapreduce(MapFunc, List, 1).
|
||||||
|
|
||||||
|
@ -510,10 +518,17 @@ mapreduce(MapFunc, List, MapMalt) ->
|
||||||
%%
|
%%
|
||||||
%% mapreduce requires OTP R11B, or it may leave monitoring messages in the
|
%% mapreduce requires OTP R11B, or it may leave monitoring messages in the
|
||||||
%% message queue.
|
%% message queue.
|
||||||
|
-ifdef(namespaced_types).
|
||||||
|
-spec mapreduce/5 :: (MapFunc, list(), InitState::term(), ReduceFunc, malt()) -> dict:dict() when
|
||||||
|
MapFunc :: fun((term()) -> DeepListOfKeyValuePairs),
|
||||||
|
DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()},
|
||||||
|
ReduceFunc :: fun((OldState::term(), Key::term(), Value::term()) -> NewState::term()).
|
||||||
|
-else.
|
||||||
-spec mapreduce/5 :: (MapFunc, list(), InitState::term(), ReduceFunc, malt()) -> dict() when
|
-spec mapreduce/5 :: (MapFunc, list(), InitState::term(), ReduceFunc, malt()) -> dict() when
|
||||||
MapFunc :: fun((term()) -> DeepListOfKeyValuePairs),
|
MapFunc :: fun((term()) -> DeepListOfKeyValuePairs),
|
||||||
DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()},
|
DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()},
|
||||||
ReduceFunc :: fun((OldState::term(), Key::term(), Value::term()) -> NewState::term()).
|
ReduceFunc :: fun((OldState::term(), Key::term(), Value::term()) -> NewState::term()).
|
||||||
|
-endif.
|
||||||
mapreduce(MapFunc, List, InitState, ReduceFunc, MapMalt) ->
|
mapreduce(MapFunc, List, InitState, ReduceFunc, MapMalt) ->
|
||||||
Parent = self(),
|
Parent = self(),
|
||||||
{Reducer, ReducerRef} =
|
{Reducer, ReducerRef} =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue