Skip to content

Commit

Permalink
Add not_a_map_passed_as_map() test and rename module to avoid name clash
Browse files Browse the repository at this point in the history
  • Loading branch information
erszcz committed Feb 25, 2022
1 parent 5a8de10 commit f5b2468
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
-module(map_pattern).
-export([f/1, badkey/1, map_term/1]).
-module(map_pattern_fail).
-export([f/1,
badkey/1,
map_term/1,
not_a_map_passed_as_map/0]).

-type t() :: #{apa := integer(), bepa := boolean()}.

Expand All @@ -14,3 +17,14 @@ badkey(#{bepa := _Bepa}) -> ok.
map_term(#{k := V}) ->
%% at this point V :: term()
atom_to_list(V).

not_a_map_passed_as_map() ->
G = g(),
h(G).

-spec g() -> {tup, le}.
g() -> {tup, le}.

-spec h(map()) -> ok.
h(#{k := v} = _Map) ->
ok.
8 changes: 7 additions & 1 deletion test/should_pass/map_pattern.erl
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
-module(map_pattern).

-compile([export_all, nowarn_export_all]).
-export([f/1,
key_subtype/1,
map_union/1,
any_map/1,
map_term/1,
map_type_var/1,
map_pattern_no_spec/1]).

-type t() :: #{apa := integer(), bepa := boolean()}.

Expand Down

0 comments on commit f5b2468

Please sign in to comment.