Skip to content

Commit

Permalink
Avoid warnings on namespaced types.
Browse files Browse the repository at this point in the history
The solution is taken from https://github.com/eproxus/meck.
  • Loading branch information
kape1395 committed Oct 20, 2014
1 parent 8a90a12 commit 4a9ab0a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions include/hamcrest_internal.hrl
Expand Up @@ -26,6 +26,14 @@
%% @copyright 2010 Tim Watson.
%% -----------------------------------------------------------------------------

-ifdef(namespaced_types).
-type hc_set() :: dict:set().
-type hc_gb_set() :: dict:gb_set().
-else.
-type hc_set() :: set().
-type hc_gb_set() :: gb_set().
-endif.

-record('hamcrest.matchspec', {
matcher = undefined :: fun((term()) -> boolean()),
expected = undefined :: term(),
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
@@ -1,6 +1,6 @@

{lib_dirs, ["deps"]}.
{erl_opts, [debug_info, fail_on_warning]}.
{erl_opts, [debug_info, fail_on_warning, {platform_define, "^[0-9]+", namespaced_types}]}.
{clean_files, ["logs", "build", "include/hamcrest.hrl"]}.

{plugin_dir, "priv/build/plugins"}.
Expand Down
2 changes: 1 addition & 1 deletion src/hamcrest_matchers.erl
Expand Up @@ -75,7 +75,7 @@
%%%============================================================================

-type matchfun(A) :: fun((A) -> boolean()).
-type container_t() :: list() | set() | gb_set().
-type container_t() :: list() | hc_set() | hc_gb_set().

%%%============================================================================
%%% API
Expand Down

0 comments on commit 4a9ab0a

Please sign in to comment.