aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-09-11 19:01:58 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-09-11 19:01:58 +0200
commitec09f59a9e055d947c9bc0790e726c5e80724068 (patch)
treedbf89f5dac990dc9dd7d7ca4d30c5a15cc7fbb82 /lib/stdlib
parent832625e71879f83e1f3f391cd65e42b8b7da5750 (diff)
downloadotp-ec09f59a9e055d947c9bc0790e726c5e80724068.tar.gz
otp-ec09f59a9e055d947c9bc0790e726c5e80724068.tar.bz2
otp-ec09f59a9e055d947c9bc0790e726c5e80724068.zip
stdlib: Fix maps type pretty printing
Properly align union typed assoc values.
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/erl_pp.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/stdlib/src/erl_pp.erl b/lib/stdlib/src/erl_pp.erl
index 82bc2c1460..3dbb5ab64c 100644
--- a/lib/stdlib/src/erl_pp.erl
+++ b/lib/stdlib/src/erl_pp.erl
@@ -300,7 +300,15 @@ 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)]}.
+ map_assoc_typed(lexpr(Ktype, options(none)), Vtype).
+
+map_assoc_typed(B, {type,_,union,Ts}) ->
+ {first,[B,$\s],{seq,[],[],[],map_assoc_union_type(Ts)}};
+map_assoc_typed(B, Type) ->
+ {list,[{cstep,[B," =>"],ltype(Type)}]}.
+
+map_assoc_union_type([T|Ts]) ->
+ [[leaf("=> "),ltype(T)] | ltypes(Ts, fun union_elem/1)].
record_type(Name, Fields) ->
{first,[record_name(Name)],field_types(Fields)}.