From 1abe7a395c70c016f1a4ea3c6651ccce3f704d54 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Sat, 30 Apr 2011 10:48:32 +0300 Subject: Fix the argument of erlang:list_to_bitstring/1 --- lib/hipe/cerl/erl_bif_types.erl | 3 ++- lib/hipe/cerl/erl_types.erl | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'lib/hipe/cerl') diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 30b911c41b..c009164f4c 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -45,6 +45,7 @@ t_atom_vals/1, t_binary/0, t_bitstr/0, + t_bitstrlist/0, t_boolean/0, t_byte/0, t_char/0, @@ -3552,7 +3553,7 @@ arg_types(erlang, list_to_binary, 1) -> arg_types(erlang, list_to_bitstr, 1) -> % XXX: TAKE OUT arg_types(erlang, list_to_bitstring, 1); arg_types(erlang, list_to_bitstring, 1) -> - [t_iolist()]; + [t_bitstrlist()]; arg_types(erlang, list_to_existing_atom, 1) -> [t_string()]; arg_types(erlang, list_to_float, 1) -> diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 5f97579c52..f176306772 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -59,6 +59,7 @@ t_bitstr_concat/2, t_bitstr_match/2, t_bitstr_unit/1, + t_bitstrlist/0, t_boolean/0, t_byte/0, t_char/0, @@ -1457,6 +1458,11 @@ t_is_tuple(_) -> false. %% Non-primitive types, including some handy syntactic sugar types %% +-spec t_bitstrlist() -> erl_type(). + +t_bitstrlist() -> + t_iolist(1, t_bitstr()). + -spec t_charlist() -> erl_type(). t_charlist() -> @@ -1546,15 +1552,16 @@ t_iodata() -> -spec t_iolist() -> erl_type(). t_iolist() -> - t_iolist(1). + t_iolist(1, t_binary()). --spec t_iolist(non_neg_integer()) -> erl_type(). +%% Added a second argument which currently is t_binary() | t_bitstr() +-spec t_iolist(non_neg_integer(), erl_type()) -> erl_type(). -t_iolist(N) when N > 0 -> - t_maybe_improper_list(t_sup([t_iolist(N-1), t_binary(), t_byte()]), - t_sup(t_binary(), t_nil())); -t_iolist(0) -> - t_maybe_improper_list(t_any(), t_sup(t_binary(), t_nil())). +t_iolist(N, T) when N > 0 -> + t_maybe_improper_list(t_sup([t_iolist(N-1, T), T, t_byte()]), + t_sup(T, t_nil())); +t_iolist(0, T) -> + t_maybe_improper_list(t_any(), t_sup(T, t_nil())). -spec t_parameterized_module() -> erl_type(). -- cgit v1.2.3