aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/erl_pp.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-03-27 17:33:43 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-03-27 18:12:33 +0100
commit13d1e7942402ab134a71a12ced551ebb4cbe7cf8 (patch)
treeff353dd5f157b82f33e6e095d58309a1e0f70e8a /lib/stdlib/src/erl_pp.erl
parent5b9ffc724e7c3ffe7c775b5113de059e2e25f755 (diff)
downloadotp-13d1e7942402ab134a71a12ced551ebb4cbe7cf8.tar.gz
otp-13d1e7942402ab134a71a12ced551ebb4cbe7cf8.tar.bz2
otp-13d1e7942402ab134a71a12ced551ebb4cbe7cf8.zip
stdlib: Fix map type listing
Diffstat (limited to 'lib/stdlib/src/erl_pp.erl')
-rw-r--r--lib/stdlib/src/erl_pp.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/stdlib/src/erl_pp.erl b/lib/stdlib/src/erl_pp.erl
index 9dbe89da91..82bc2c1460 100644
--- a/lib/stdlib/src/erl_pp.erl
+++ b/lib/stdlib/src/erl_pp.erl
@@ -256,6 +256,10 @@ ltype({type,_Line,nonempty_list,[T]}) ->
{seq,$[,$],[$,],[ltype(T),leaf("...")]};
ltype({type,Line,nil,[]}) ->
lexpr({nil,Line}, 0, options(none));
+ltype({type,Line,map,any}) ->
+ simple_type({atom,Line,map}, []);
+ltype({type,_Line,map,Pairs}) ->
+ map_type(Pairs);
ltype({type,Line,tuple,any}) ->
simple_type({atom,Line,tuple}, []);
ltype({type,_Line,tuple,Ts}) ->
@@ -289,6 +293,15 @@ binary_type(I1, I2) ->
E2 = [[leaf("_:_*"),lexpr(I2, P, options(none))] || U],
{seq,'<<','>>',[$,],E1++E2}.
+map_type(Fs) ->
+ {first,[$#],map_pair_types(Fs)}.
+
+map_pair_types(Fs) ->
+ tuple_type(Fs, fun map_pair_type/1).
+
+map_pair_type({type,_Line,map_field_assoc,Ktype,Vtype}) ->
+ {seq,[],[]," =>",[ltype(Ktype),ltype(Vtype)]}.
+
record_type(Name, Fields) ->
{first,[record_name(Name)],field_types(Fields)}.