diff options
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/doc/src/filelib.xml | 6 | ||||
-rw-r--r-- | lib/stdlib/doc/src/io_lib.xml | 3 | ||||
-rw-r--r-- | lib/stdlib/doc/src/supervisor.xml | 2 | ||||
-rw-r--r-- | lib/stdlib/src/dets.erl | 4 | ||||
-rw-r--r-- | lib/stdlib/src/erl_lint.erl | 3 | ||||
-rw-r--r-- | lib/stdlib/src/filelib.erl | 23 | ||||
-rw-r--r-- | lib/stdlib/src/gen_server.erl | 4 | ||||
-rw-r--r-- | lib/stdlib/src/io.erl | 2 | ||||
-rw-r--r-- | lib/stdlib/src/io_lib.erl | 9 | ||||
-rw-r--r-- | lib/stdlib/src/io_lib_fread.erl | 9 | ||||
-rw-r--r-- | lib/stdlib/test/dets_SUITE.erl | 26 | ||||
-rw-r--r-- | lib/stdlib/test/erl_lint_SUITE.erl | 18 | ||||
-rw-r--r-- | lib/stdlib/vsn.mk | 2 |
13 files changed, 82 insertions, 29 deletions
diff --git a/lib/stdlib/doc/src/filelib.xml b/lib/stdlib/doc/src/filelib.xml index bd780b2b2f..d24d17be80 100644 --- a/lib/stdlib/doc/src/filelib.xml +++ b/lib/stdlib/doc/src/filelib.xml @@ -49,6 +49,12 @@ <datatype> <name name="dirname"/> </datatype> + <datatype> + <name name="dirname_all"/> + </datatype> + <datatype> + <name name="filename_all"/> + </datatype> </datatypes> <funcs> diff --git a/lib/stdlib/doc/src/io_lib.xml b/lib/stdlib/doc/src/io_lib.xml index 3dac259477..68352ffeb1 100644 --- a/lib/stdlib/doc/src/io_lib.xml +++ b/lib/stdlib/doc/src/io_lib.xml @@ -54,6 +54,9 @@ <name name="fread_error"/> </datatype> <datatype> + <name name="fread_item"/> + </datatype> + <datatype> <name name="latin1_string"/> </datatype> </datatypes> diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index ed09f6e1f2..e2c9c14e6a 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -371,7 +371,7 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} children.</p> <p>If the supervisor is <c>simple_one_for_one</c>, <c><anno>Id</anno></c> - must be the child process' <c>pid()</c>. I the specified + must be the child process' <c>pid()</c>. If the specified process is alive, but is not a child of the given supervisor, the function will return <c>{error,not_found}</c>. If the child specification diff --git a/lib/stdlib/src/dets.erl b/lib/stdlib/src/dets.erl index 50812cc532..68b157c13c 100644 --- a/lib/stdlib/src/dets.erl +++ b/lib/stdlib/src/dets.erl @@ -951,10 +951,10 @@ do_trav(Proc, Acc, Fun) -> Error end. -do_trav(#dets_cont{bin = eof}, _Proc, Acc, _Fun) -> - Acc; do_trav(State, Proc, Acc, Fun) -> case req(Proc, {match_init, State, safe}) of + '$end_of_table'-> + Acc; {cont, {Bins, NewState}} -> do_trav_bins(NewState, Proc, Acc, Fun, lists:reverse(Bins)); Error -> diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index 08b8541014..8f07750b9b 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -3219,7 +3219,8 @@ modify_line(T, F0) -> %% Forms. modify_line1({function,F,A}, _Mf) -> {function,F,A}; -modify_line1({function,M,F,A}, _Mf) -> {function,M,F,A}; +modify_line1({function,M,F,A}, Mf) -> + {function,modify_line1(M, Mf),modify_line1(F, Mf),modify_line1(A, Mf)}; modify_line1({attribute,L,record,{Name,Fields}}, Mf) -> {attribute,Mf(L),record,{Name,modify_line1(Fields, Mf)}}; modify_line1({attribute,L,spec,{Fun,Types}}, Mf) -> diff --git a/lib/stdlib/src/filelib.erl b/lib/stdlib/src/filelib.erl index 42ef3679a2..9ef4954194 100644 --- a/lib/stdlib/src/filelib.erl +++ b/lib/stdlib/src/filelib.erl @@ -41,6 +41,9 @@ -type filename() :: file:name(). -type dirname() :: filename(). +-type filename_all() :: file:name_all(). +-type dirname_all() :: filename_all(). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -spec wildcard(Wildcard) -> [file:filename()] when @@ -62,29 +65,29 @@ wildcard(Pattern, Cwd, Mod) ?HANDLE_ERROR(do_wildcard(Pattern, Cwd, Mod)). -spec is_dir(Name) -> boolean() when - Name :: filename() | dirname(). + Name :: filename_all() | dirname_all(). is_dir(Dir) -> do_is_dir(Dir, file). --spec is_dir(file:name(), atom()) -> boolean(). +-spec is_dir(file:name_all(), atom()) -> boolean(). is_dir(Dir, Mod) when is_atom(Mod) -> do_is_dir(Dir, Mod). -spec is_file(Name) -> boolean() when - Name :: filename() | dirname(). + Name :: filename_all() | dirname_all(). is_file(File) -> do_is_file(File, file). --spec is_file(file:name(), atom()) -> boolean(). +-spec is_file(file:name_all(), atom()) -> boolean(). is_file(File, Mod) when is_atom(Mod) -> do_is_file(File, Mod). -spec is_regular(Name) -> boolean() when - Name :: filename(). + Name :: filename_all(). is_regular(File) -> do_is_regular(File, file). --spec is_regular(file:name(), atom()) -> boolean(). +-spec is_regular(file:name_all(), atom()) -> boolean(). is_regular(File, Mod) when is_atom(Mod) -> do_is_regular(File, Mod). @@ -103,16 +106,16 @@ fold_files(Dir, RegExp, Recursive, Fun, Acc, Mod) when is_atom(Mod) -> do_fold_files(Dir, RegExp, Recursive, Fun, Acc, Mod). -spec last_modified(Name) -> file:date_time() | 0 when - Name :: filename() | dirname(). + Name :: filename_all() | dirname_all(). last_modified(File) -> do_last_modified(File, file). --spec last_modified(file:name(), atom()) -> file:date_time() | 0. +-spec last_modified(file:name_all(), atom()) -> file:date_time() | 0. last_modified(File, Mod) when is_atom(Mod) -> do_last_modified(File, Mod). -spec file_size(Filename) -> non_neg_integer() when - Filename :: filename(). + Filename :: filename_all(). file_size(File) -> do_file_size(File, file). @@ -218,7 +221,7 @@ do_file_size(File, Mod) -> %% ensures that the directory name required to create D exists -spec ensure_dir(Name) -> 'ok' | {'error', Reason} when - Name :: filename() | dirname(), + Name :: filename_all() | dirname_all(), Reason :: file:posix(). ensure_dir("/") -> ok; diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index bc76c9fd10..7f65131f67 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -124,7 +124,7 @@ {noreply, NewState :: term()} | {noreply, NewState :: term(), timeout() | hibernate} | {stop, Reason :: term(), NewState :: term()}. --callback handle_info(Info :: timeout() | term(), State :: term()) -> +-callback handle_info(Info :: timeout | term(), State :: term()) -> {noreply, NewState :: term()} | {noreply, NewState :: term(), timeout() | hibernate} | {stop, Reason :: term(), NewState :: term()}. @@ -217,7 +217,7 @@ reply({To, Tag}, Reply) -> catch To ! {Tag, Reply}. %% ----------------------------------------------------------------- -%% Asyncronous broadcast, returns nothing, it's just send'n prey +%% Asynchronous broadcast, returns nothing, it's just send 'n' pray %%----------------------------------------------------------------- abcast(Name, Request) when is_atom(Name) -> do_abcast([node() | nodes()], Name, cast_msg(Request)). diff --git a/lib/stdlib/src/io.erl b/lib/stdlib/src/io.erl index 53728237ca..b11d41e2eb 100644 --- a/lib/stdlib/src/io.erl +++ b/lib/stdlib/src/io.erl @@ -40,7 +40,7 @@ %%------------------------------------------------------------------------- -type device() :: atom() | pid(). --type prompt() :: atom() | string(). +-type prompt() :: atom() | unicode:chardata(). %% ErrorDescription is whatever the I/O-server sends. -type server_no_data() :: {'error', ErrorDescription :: term()} | 'eof'. diff --git a/lib/stdlib/src/io_lib.erl b/lib/stdlib/src/io_lib.erl index a9b6d4131e..92a086b077 100644 --- a/lib/stdlib/src/io_lib.erl +++ b/lib/stdlib/src/io_lib.erl @@ -83,7 +83,8 @@ -export([write_unicode_string/1, write_unicode_char/1, deep_unicode_char_list/1]). --export_type([chars/0, latin1_string/0, continuation/0, fread_error/0]). +-export_type([chars/0, latin1_string/0, continuation/0, + fread_error/0, fread_item/0]). %%---------------------------------------------------------------------- @@ -106,6 +107,8 @@ | 'string' | 'unsigned'. +-type fread_item() :: string() | atom() | integer() | float(). + %%---------------------------------------------------------------------- %% Interface calls to sub-modules. @@ -120,7 +123,7 @@ fwrite(Format, Args) -> -spec fread(Format, String) -> Result when Format :: string(), String :: string(), - Result :: {'ok', InputList :: [term()], LeftOverChars :: string()} + Result :: {'ok', InputList :: [fread_item()], LeftOverChars :: string()} | {'more', RestFormat :: string(), Nchars :: non_neg_integer(), InputStack :: chars()} @@ -135,7 +138,7 @@ fread(Chars, Format) -> Format :: string(), Return :: {'more', Continuation1 :: continuation()} | {'done', Result, LeftOverChars :: string()}, - Result :: {'ok', InputList :: [term()]} + Result :: {'ok', InputList :: [fread_item()]} | 'eof' | {'error', {'fread', What :: fread_error()}}. diff --git a/lib/stdlib/src/io_lib_fread.erl b/lib/stdlib/src/io_lib_fread.erl index 92a34995b8..491e1f40d7 100644 --- a/lib/stdlib/src/io_lib_fread.erl +++ b/lib/stdlib/src/io_lib_fread.erl @@ -41,9 +41,9 @@ Format :: string(), Return :: {'more', Continuation1 :: io_lib:continuation()} | {'done', Result, LeftOverChars :: string()}, - Result :: {'ok', InputList :: io_lib:chars()} + Result :: {'ok', InputList :: [io_lib:fread_item()]} | 'eof' - | {'error', {'read', What :: io_lib:fread_error()}}. + | {'error', {'fread', What :: io_lib:fread_error()}}. fread([], Chars, Format) -> %%io:format("FREAD: ~w `~s'~n", [Format,Chars]), @@ -101,11 +101,12 @@ fread_line(Format0, Line, N0, Results0, More, Newline) -> -spec fread(Format, String) -> Result when Format :: string(), String :: string(), - Result :: {'ok', InputList :: io_lib:chars(), LeftOverChars :: string()} + Result :: {'ok', InputList :: [io_lib:fread_item()], + LeftOverChars :: string()} | {'more', RestFormat :: string(), Nchars :: non_neg_integer(), InputStack :: io_lib:chars()} - | {'error', What :: term()}. + | {'error', {'fread', What :: io_lib:fread_error()}}. fread(Format, Line) -> fread(Format, Line, 0, []). diff --git a/lib/stdlib/test/dets_SUITE.erl b/lib/stdlib/test/dets_SUITE.erl index 8ff7c3ccc9..059d553b00 100644 --- a/lib/stdlib/test/dets_SUITE.erl +++ b/lib/stdlib/test/dets_SUITE.erl @@ -52,7 +52,7 @@ simultaneous_open/1, insert_new/1, repair_continuation/1, otp_5487/1, otp_6206/1, otp_6359/1, otp_4738/1, otp_7146/1, otp_8070/1, otp_8856/1, otp_8898/1, otp_8899/1, otp_8903/1, - otp_8923/1, otp_9282/1]). + otp_8923/1, otp_9282/1, otp_11245/1]). -export([dets_dirty_loop/0]). @@ -109,7 +109,7 @@ all() -> many_clients, otp_4906, otp_5402, simultaneous_open, insert_new, repair_continuation, otp_5487, otp_6206, otp_6359, otp_4738, otp_7146, otp_8070, otp_8856, otp_8898, - otp_8899, otp_8903, otp_8923, otp_9282 + otp_8899, otp_8903, otp_8923, otp_9282, otp_11245 ]. groups() -> @@ -3898,6 +3898,28 @@ some_calls(Tab, Config) -> file:delete(File). +otp_11245(doc) -> + ["OTP-11245. Tables remained fixed after traversal"]; +otp_11245(suite) -> + []; +otp_11245(Config) when is_list(Config) -> + Tab = otp_11245, + File = filename(Tab, Config), + {ok, Tab} = dets:open_file(Tab, [{file,File}]), + N = 1024, + ins(Tab, N), + N = length(dets:match(Tab, '_')), + false = dets:info(Tab, safe_fixed), + dets:traverse(Tab, fun(_) -> continue end), + false = dets:info(Tab, safe_fixed), + N = dets:foldl(fun(_, N2) -> N2+1 end, 0, Tab), + false = dets:info(Tab, safe_fixed), + N = dets:foldr(fun(_, N2) -> N2+1 end, 0, Tab), + false = dets:info(Tab, safe_fixed), + ok = dets:close(Tab), + file:delete(File), + ok. + %% %% Parts common to several test cases %% diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index f8345559c4..4dc7a44064 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -50,7 +50,7 @@ unsafe_vars_try/1, guard/1, otp_4886/1, otp_4988/1, otp_5091/1, otp_5276/1, otp_5338/1, otp_5362/1, otp_5371/1, otp_7227/1, otp_5494/1, otp_5644/1, otp_5878/1, - otp_5917/1, otp_6585/1, otp_6885/1, otp_10436/1, + otp_5917/1, otp_6585/1, otp_6885/1, otp_10436/1, otp_11254/1, export_all/1, bif_clash/1, behaviour_basic/1, behaviour_multiple/1, @@ -82,7 +82,7 @@ all() -> unsafe_vars, unsafe_vars2, unsafe_vars_try, guard, otp_4886, otp_4988, otp_5091, otp_5276, otp_5338, otp_5362, otp_5371, otp_7227, otp_5494, otp_5644, - otp_5878, otp_5917, otp_6585, otp_6885, otp_10436, export_all, + otp_5878, otp_5917, otp_6585, otp_6885, otp_10436, otp_11254,export_all, bif_clash, behaviour_basic, behaviour_multiple, otp_7550, otp_8051, format_warn, {group, on_load}, too_many_arguments, basic_errors, bin_syntax_errors]. @@ -2418,6 +2418,20 @@ otp_10436(Config) when is_list(Config) -> run_test2(Config, Ts2, []), ok. +otp_11254(doc) -> + "OTP-11254. Warnings for opaque types."; +otp_11254(suite) -> []; +otp_11254(Config) when is_list(Config) -> + Ts = <<"-module(p2). + -export([manifest/2]). + manifest(Module, Name) -> + fun Module:Nine/1. + ">>, + {error,[{4,erl_lint,{unbound_var,'Nine'}}], + [{3,erl_lint,{unused_var,'Name'}}]} = + run_test2(Config, Ts, []), + ok. + export_all(doc) -> "OTP-7392. Warning for export_all."; export_all(Config) when is_list(Config) -> diff --git a/lib/stdlib/vsn.mk b/lib/stdlib/vsn.mk index fbb838c686..ba6f7cdb8a 100644 --- a/lib/stdlib/vsn.mk +++ b/lib/stdlib/vsn.mk @@ -1 +1 @@ -STDLIB_VSN = 1.19.2 +STDLIB_VSN = 1.19.3 |