aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2019-04-22 13:54:12 +0200
committerHans Bolinder <[email protected]>2019-04-29 12:00:31 +0200
commita1e51d125944ad840a306d0cddec681848808f4c (patch)
treee491a87f73e5082bfaed365226cea3329e56085d /lib/hipe
parent19e8e534cc26d890378265907ff0a56c101f2625 (diff)
downloadotp-a1e51d125944ad840a306d0cddec681848808f4c.tar.gz
otp-a1e51d125944ad840a306d0cddec681848808f4c.tar.bz2
otp-a1e51d125944ad840a306d0cddec681848808f4c.zip
dialyzer: Add parentheses around annotated union elements
In contracts, annotated elements of unions are printed with parentheses around them. They are not parseable otherwise.
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/cerl/erl_types.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl
index d61cd8664c..badf58936f 100644
--- a/lib/hipe/cerl/erl_types.erl
+++ b/lib/hipe/cerl/erl_types.erl
@@ -5338,7 +5338,15 @@ t_form_to_string({type, _L, tuple, any}) -> "tuple()";
t_form_to_string({type, _L, tuple, Args}) ->
"{" ++ flat_join(t_form_to_string_list(Args), ",") ++ "}";
t_form_to_string({type, _L, union, Args}) ->
- flat_join(t_form_to_string_list(Args), " | ");
+ flat_join(lists:map(fun(Arg) ->
+ case Arg of
+ {ann_type, _AL, _} ->
+ "(" ++ t_form_to_string(Arg) ++ ")";
+ _ ->
+ t_form_to_string(Arg)
+ end
+ end, Args),
+ " | ");
t_form_to_string({type, _L, Name, []} = T) ->
try
M = mod,