aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/cerl
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-12-03 15:53:40 +0100
committerPatrik Nyblom <[email protected]>2010-12-03 15:53:40 +0100
commit5a339a8af02acc882e5ba2dbc5674acc085bdd70 (patch)
tree3abe0a587ee170a3caccf6a76e720047c208b362 /lib/hipe/cerl
parent73b53fe24ebc595a81c4ee023bcfef5a71e59db4 (diff)
parent29c23e32a9154ef2feb6a6424647e749ce9acab1 (diff)
downloadotp-5a339a8af02acc882e5ba2dbc5674acc085bdd70.tar.gz
otp-5a339a8af02acc882e5ba2dbc5674acc085bdd70.tar.bz2
otp-5a339a8af02acc882e5ba2dbc5674acc085bdd70.zip
Merge branch 'ks/erl_bif_types-cleanup/OTP-8961' into dev
* ks/erl_bif_types-cleanup/OTP-8961: Fix type information of 'file' and 'code' modules Conflicts: lib/hipe/cerl/erl_bif_types.erl
Diffstat (limited to 'lib/hipe/cerl')
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl113
1 files changed, 8 insertions, 105 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index 57baa8b1dc..ed5bf03804 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -192,7 +192,7 @@ type(binary, referenced_byte_size, 1, Xs) ->
type(code, add_path, 1, Xs) ->
strict(arg_types(code, add_path, 1), Xs,
fun (_) ->
- t_sup(t_boolean(),
+ t_sup(t_atom('true'),
t_tuple([t_atom('error'), t_atom('bad_directory')]))
end);
type(code, add_patha, 1, Xs) ->
@@ -1992,28 +1992,6 @@ type(ets, update_counter, 3, Xs) ->
type(ets, update_element, 3, Xs) ->
strict(arg_types(ets, update_element, 3), Xs, fun (_) -> t_boolean() end);
%%-- file ---------------------------------------------------------------------
-type(file, close, 1, Xs) ->
- strict(arg_types(file, close, 1), Xs, fun (_) -> t_file_return() end);
-type(file, delete, 1, Xs) ->
- strict(arg_types(file, delete, 1), Xs, fun (_) -> t_file_return() end);
-type(file, get_cwd, 0, _) ->
- t_sup(t_tuple([t_atom('ok'), t_string()]),
- t_tuple([t_atom('error'), t_file_posix_error()]));
-type(file, make_dir, 1, Xs) ->
- strict(arg_types(file, make_dir, 1), Xs, fun (_) -> t_file_return() end);
-type(file, read_file, 1, Xs) ->
- strict(arg_types(file, read_file, 1), Xs,
- fun (_) ->
- t_sup([t_tuple([t_atom('ok'), t_binary()]),
- t_tuple([t_atom('error'), t_file_posix_error()])])
- end);
-type(file, set_cwd, 1, Xs) ->
- strict(arg_types(file, set_cwd, 1), Xs,
- fun (_) -> t_sup(t_atom('ok'),
- t_tuple([t_atom('error'), t_file_posix_error()]))
- end);
-type(file, write_file, 2, Xs) ->
- strict(arg_types(file, write_file, 2), Xs, fun (_) -> t_file_return() end);
type(file, native_name_encoding, 0, _) ->
t_file_encoding();
%%-- prim_file ----------------------------------------------------------------
@@ -3369,7 +3347,7 @@ arg_types(code, all_loaded, 0) ->
arg_types(code, compiler_dir, 0) ->
[];
arg_types(code, del_path, 1) ->
- [t_sup(t_string(), t_atom())]; % OBS: doc differs from add_path/1 - why?
+ [t_sup(t_string(), t_atom())]; % OBS: differs from add_path/1
arg_types(code, delete, 1) ->
[t_atom()];
arg_types(code, ensure_loaded, 1) ->
@@ -3417,7 +3395,7 @@ arg_types(code, replace_path, 2) ->
arg_types(code, root_dir, 0) ->
[];
arg_types(code, set_path, 1) ->
- [t_string()];
+ [t_list(t_string())];
arg_types(code, soft_purge, 1) ->
arg_types(code, delete, 1);
arg_types(code, stick_mod, 1) ->
@@ -4212,22 +4190,6 @@ arg_types(ets, update_element, 3) ->
PosValue = t_tuple([t_integer(), t_any()]),
[t_tab(), t_any(), t_sup(PosValue, t_list(PosValue))];
%%------- file ----------------------------------------------------------------
-arg_types(file, close, 1) ->
- [t_file_io_device()];
-arg_types(file, delete, 1) ->
- [t_file_name()];
-arg_types(file, get_cwd, 0) ->
- [];
-arg_types(file, make_dir, 1) ->
- [t_file_name()];
-arg_types(file, read_file, 1) ->
- [t_file_name()];
-arg_types(file, set_cwd, 1) ->
- [t_file_name()];
-arg_types(file, write, 2) ->
- [t_file_io_device(), t_iodata()];
-arg_types(file, write_file, 2) ->
- [t_file_name(), t_sup(t_binary(), t_list())];
arg_types(file, native_name_encoding, 0) ->
[];
%%-- prim_file ----------------------------------------------------------------
@@ -4668,7 +4630,7 @@ t_httppacket() ->
t_HttpHeader(), t_atom('http_eoh'), t_HttpError()]).
t_endian() ->
- t_sup([t_atom('big'), t_atom('little')]).
+ t_sup(t_atom('big'), t_atom('little')).
%% =====================================================================
%% Types for the binary module
@@ -5012,70 +4974,9 @@ t_ets_info_items() ->
t_atom('type')]).
%% =====================================================================
-%% These are used for the built-in functions of 'file'
+%% These are used for the built-in functions of 'prim_file'
%% =====================================================================
-t_file_io_device() ->
- t_sup(t_pid(), t_tuple([t_atom('file_descriptor'), t_atom(), t_any()])).
-
-t_file_name() ->
- t_sup([t_atom(),
- t_string(),
- t_binary(),
- %% DeepList = [char() | atom() | DeepList] -- approximation below
- t_list(t_sup([t_atom(), t_string(), t_list()]))]).
-
-t_file_open_option() ->
- t_sup([t_atom('read'),
- t_atom('write'),
- t_atom('append'),
- t_atom('raw'),
- t_atom('binary'),
- t_atom('delayed_write'),
- t_atom('read_ahead'),
- t_atom('compressed'),
- t_tuple([t_atom('delayed_write'),
- t_pos_integer(), t_non_neg_integer()]),
- t_tuple([t_atom('read_ahead'), t_pos_integer()])]).
-
-%% This lists all Posix errors that can occur in file:*/* functions
-t_file_posix_error() ->
- t_sup([t_atom('eacces'),
- t_atom('eagain'),
- t_atom('ebadf'),
- t_atom('ebusy'),
- t_atom('edquot'),
- t_atom('eexist'),
- t_atom('efault'),
- t_atom('efbig'),
- t_atom('eintr'),
- t_atom('einval'),
- t_atom('eio'),
- t_atom('eisdir'),
- t_atom('eloop'),
- t_atom('emfile'),
- t_atom('emlink'),
- t_atom('enametoolong'),
- t_atom('enfile'),
- t_atom('enodev'),
- t_atom('enoent'),
- t_atom('enomem'),
- t_atom('enospc'),
- t_atom('enotblk'),
- t_atom('enotdir'),
- t_atom('enotsup'),
- t_atom('enxio'),
- t_atom('eperm'),
- t_atom('epipe'),
- t_atom('erofs'),
- t_atom('espipe'),
- t_atom('esrch'),
- t_atom('estale'),
- t_atom('exdev')]).
-
-t_file_return() ->
- t_sup(t_atom('ok'), t_tuple([t_atom('error'), t_file_posix_error()])).
-
t_prim_file_name() ->
t_sup([t_string(),
t_binary()]).
@@ -5280,7 +5181,9 @@ t_ML() -> % a binary or a possibly deep list of integers or binaries
t_sup(t_list(t_sup([t_integer(), t_binary(), t_list()])), t_binary()).
t_encoding() ->
- t_atoms(['latin1', 'unicode', 'utf8', 'utf16', 'utf32']).
+ t_sup([t_atoms(['latin1', 'unicode', 'utf8', 'utf16', 'utf32']),
+ t_tuple([t_atom('utf16'), t_endian()]),
+ t_tuple([t_atom('utf32'), t_endian()])]).
t_file_encoding() ->
t_atoms(['latin1', 'utf8']).