diff --git a/.travis.yml b/.travis.yml index a4792d9..0f74d91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: erlang otp_release: - - 17.0-rc1 - R16B03-1 - R16B03 - R16B02 diff --git a/rebar.config b/rebar.config index 057e498..07a123c 100644 --- a/rebar.config +++ b/rebar.config @@ -9,7 +9,8 @@ %% Compiler Options ============================================================ {erl_opts, - [debug_info, + [{platform_define, "^[0-9]+", namespaced_types}, + debug_info, warnings_as_errors]}. %% EUnit ======================================================================= diff --git a/src/ec_dict.erl b/src/ec_dict.erl index 49f3d96..0c0b998 100644 --- a/src/ec_dict.erl +++ b/src/ec_dict.erl @@ -34,7 +34,11 @@ %%%=================================================================== %% This should be opaque, but that kills dialyzer so for now we export it %% 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(). +-endif. %%%=================================================================== %%% API diff --git a/src/ec_plists.erl b/src/ec_plists.erl index 7512fdc..4726c18 100644 --- a/src/ec_plists.erl +++ b/src/ec_plists.erl @@ -480,9 +480,17 @@ usort(Fun, List, Malt) -> runmany(Fun2, {recursive, Fuse}, List, Malt). %% @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 MapFunc :: fun((term()) -> DeepListOfKeyValuePairs), DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()}. +-endif. + + mapreduce(MapFunc, List) -> mapreduce(MapFunc, List, 1). @@ -510,10 +518,17 @@ mapreduce(MapFunc, List, MapMalt) -> %% %% mapreduce requires OTP R11B, or it may leave monitoring messages in the %% 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 MapFunc :: fun((term()) -> DeepListOfKeyValuePairs), DeepListOfKeyValuePairs :: [DeepListOfKeyValuePairs] | {Key::term(), Value::term()}, ReduceFunc :: fun((OldState::term(), Key::term(), Value::term()) -> NewState::term()). +-endif. mapreduce(MapFunc, List, InitState, ReduceFunc, MapMalt) -> Parent = self(), {Reducer, ReducerRef} =