aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2013-02-11 15:38:05 +0100
committerKostis Sagonas <[email protected]>2013-02-11 15:38:05 +0100
commit5900758f7bc5727a68a575459f50e6c5a0dd2514 (patch)
treefa60d2083f5cb79aaa7a6782cb66c23e182f1703
parent63d2a28c4e6a868da0f7a4117c615fe05593990d (diff)
downloadotp-5900758f7bc5727a68a575459f50e6c5a0dd2514.tar.gz
otp-5900758f7bc5727a68a575459f50e6c5a0dd2514.tar.bz2
otp-5900758f7bc5727a68a575459f50e6c5a0dd2514.zip
Add support for printing <<_:_*1>> as bitstring()
-rw-r--r--lib/hipe/cerl/erl_types.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl
index 532b2e43cd..b1a41cd816 100644
--- a/lib/hipe/cerl/erl_types.erl
+++ b/lib/hipe/cerl/erl_types.erl
@@ -3241,6 +3241,8 @@ t_to_string(?bitstr(0, 0), _RecDict) ->
"<<>>";
t_to_string(?bitstr(8, 0), _RecDict) ->
"binary()";
+t_to_string(?bitstr(1, 0), _RecDict) ->
+ "bitstring()";
t_to_string(?bitstr(0, B), _RecDict) ->
lists:flatten(io_lib:format("<<_:~w>>", [B]));
t_to_string(?bitstr(U, 0), _RecDict) ->
@@ -3870,12 +3872,14 @@ t_form_to_string({type, _L, binary, [Base, Unit]} = Type) ->
case {U, B} of
{0, 0} -> "<<>>";
{8, 0} -> "binary()";
+ {1, 0} -> "bitstring()";
{0, B} -> lists:flatten(io_lib:format("<<_:~w>>", [B]));
{U, 0} -> lists:flatten(io_lib:format("<<_:_*~w>>", [U]));
{U, B} -> lists:flatten(io_lib:format("<<_:~w,_:_*~w>>", [B, U]))
end;
_ -> io_lib:format("Badly formed bitstr type ~w", [Type])
end;
+t_form_to_string({type, _L, bitstring, []}) -> "bitstring()";
t_form_to_string({type, _L, 'fun', []}) -> "fun()";
t_form_to_string({type, _L, 'fun', [{type, _, any}, Range]}) ->
"fun(...) -> " ++ t_form_to_string(Range);