diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/cerl_inline.erl | 39 | ||||
-rw-r--r-- | lib/compiler/src/v3_core.erl | 6 | ||||
-rw-r--r-- | lib/compiler/test/inline_SUITE.erl | 3 | ||||
-rw-r--r-- | lib/compiler/test/inline_SUITE_data/fname.erl | 29 | ||||
-rw-r--r-- | lib/compiler/test/warnings_SUITE.erl | 14 | ||||
-rw-r--r-- | lib/eunit/include/eunit.hrl | 64 | ||||
-rw-r--r-- | lib/inets/doc/src/httpc.xml | 6 | ||||
-rw-r--r-- | lib/inets/doc/src/httpd.xml | 22 | ||||
-rw-r--r-- | lib/inets/doc/src/httpd_util.xml | 4 | ||||
-rw-r--r-- | lib/inets/doc/src/mod_alias.xml | 4 | ||||
-rw-r--r-- | lib/inets/doc/src/notes_history.xml | 2 | ||||
-rw-r--r-- | lib/kernel/src/user_drv.erl | 2 | ||||
-rw-r--r-- | lib/stdlib/src/filelib.erl | 23 | ||||
-rw-r--r-- | lib/stdlib/src/io.erl | 2 |
14 files changed, 155 insertions, 65 deletions
diff --git a/lib/compiler/src/cerl_inline.erl b/lib/compiler/src/cerl_inline.erl index 2e7554c1ff..c6de63c69f 100644 --- a/lib/compiler/src/cerl_inline.erl +++ b/lib/compiler/src/cerl_inline.erl @@ -52,7 +52,7 @@ clause_pats/1, clause_vars/1, concrete/1, cons_hd/1, cons_tl/1, data_arity/1, data_es/1, data_type/1, fun_body/1, fun_vars/1, get_ann/1, int_val/1, - is_c_atom/1, is_c_cons/1, is_c_fun/1, is_c_int/1, + is_c_atom/1, is_c_cons/1, is_c_fname/1, is_c_int/1, is_c_list/1, is_c_seq/1, is_c_tuple/1, is_c_var/1, is_data/1, is_literal/1, is_literal_term/1, let_arg/1, let_body/1, let_vars/1, letrec_body/1, letrec_defs/1, @@ -1578,7 +1578,7 @@ make_let_binding_1(R, E, S) -> %% completely. copy(R, Opnd, E, Ctxt, Env, S) -> - case is_c_var(E) of + case is_c_var(E) andalso not is_c_fname(E) of true -> %% The operand reduces to another variable - get its %% ref-structure and attempt to propagate further. @@ -1628,12 +1628,12 @@ copy_var(R, Ctxt, Env, S) -> end. copy_1(R, Opnd, E, Ctxt, Env, S) -> - %% Fun-expression (lambdas) are a bit special; they are copyable, - %% but should preferably not be duplicated, so they should not be - %% copy propagated except into application contexts, where they can - %% be inlined. - case is_c_fun(E) of - true -> + case type(E) of + 'fun' -> + %% Fun-expression (lambdas) are a bit special; they are copyable, + %% but should preferably not be duplicated, so they should not be + %% copy propagated except into application contexts, where they can + %% be inlined. case Ctxt of #app{} -> %% First test if the operand is "outer-pending"; if @@ -1649,7 +1649,28 @@ copy_1(R, Opnd, E, Ctxt, Env, S) -> _ -> residualize_var(R, S) end; - false -> + var -> + %% Variables at this point only refer to local functions; they are + %% copyable but can't appear in guards, so they should not be + %% copy propagated except into application contexts, where they can + %% be inlined. + case Ctxt of + #app{} -> + %% First test if the operand is "outer-pending"; if + %% so, don't inline. + case st__test_outer_pending(Opnd#opnd.loc, S) of + false -> + R1 = env__get(var_name(E), Opnd#opnd.env), + copy_var(R1, Ctxt, Env, S); + true -> + %% Cyclic reference forced inlining to stop + %% (avoiding infinite unfolding). + residualize_var(R, S) + end; + _ -> + residualize_var(R, S) + end; + _ -> %% We have no other cases to handle here residualize_var(R, S) end. diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl index d6fdcb2b21..1195937d91 100644 --- a/lib/compiler/src/v3_core.erl +++ b/lib/compiler/src/v3_core.erl @@ -956,7 +956,8 @@ lc_tq(Line, E, [Fil0|Qs0], Mc, St0) -> args=[], clauses=[#iclause{anno=LAnno,pats=[], guard=Gs,body=Lps ++ [Lc]}], - fc=#iclause{anno=LAnno,pats=[],guard=[],body=[Mc]}}, + fc=#iclause{anno=LAnno#a{anno=[compiler_generated|LA]}, + pats=[],guard=[],body=[Mc]}}, [],St2}; false -> {Lc,Lps,St1} = lc_tq(Line, E, Qs0, Mc, St0), @@ -1101,7 +1102,8 @@ bc_tq1(Line, E, [Fil0|Qs0], AccVar, St0) -> clauses=[#iclause{anno=LAnno, pats=[], guard=Gs,body=Bps ++ [Bc]}], - fc=#iclause{anno=LAnno,pats=[],guard=[],body=[AccVar]}}, + fc=#iclause{anno=LAnno#a{anno=[compiler_generated|LA]}, + pats=[],guard=[],body=[AccVar]}}, [],St}; false -> {Bc,Bps,St1} = bc_tq1(Line, E, Qs0, AccVar, St0), diff --git a/lib/compiler/test/inline_SUITE.erl b/lib/compiler/test/inline_SUITE.erl index d9b92766e4..e5c2d4f73a 100644 --- a/lib/compiler/test/inline_SUITE.erl +++ b/lib/compiler/test/inline_SUITE.erl @@ -36,7 +36,7 @@ all() -> groups() -> [{p,test_lib:parallel(), - [attribute,bsdecode,bsdes,barnes2,decode1,smith, + [attribute,bsdecode,bsdes,barnes2,decode1,smith,fname, itracer,pseudoknot,comma_splitter,lists,really_inlined,otp_7223, coverage]}]. @@ -84,6 +84,7 @@ attribute(Config) when is_list(Config) -> ?comp(itracer). ?comp(pseudoknot). ?comp(comma_splitter). +?comp(fname). try_inline(Mod, Config) -> Node = ?config(testing_node, Config), diff --git a/lib/compiler/test/inline_SUITE_data/fname.erl b/lib/compiler/test/inline_SUITE_data/fname.erl new file mode 100644 index 0000000000..7ad4446bf3 --- /dev/null +++ b/lib/compiler/test/inline_SUITE_data/fname.erl @@ -0,0 +1,29 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2013. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(fname). +-export([?MODULE/0]). + +?MODULE() -> + F = fun bar/1, + G = lists:last([(fun (X) when F =:= X -> X end)]), + F = G(F), + ok. + +bar(X) -> + X. diff --git a/lib/compiler/test/warnings_SUITE.erl b/lib/compiler/test/warnings_SUITE.erl index f00bfe663b..810b2b48c9 100644 --- a/lib/compiler/test/warnings_SUITE.erl +++ b/lib/compiler/test/warnings_SUITE.erl @@ -37,7 +37,7 @@ -export([pattern/1,pattern2/1,pattern3/1,pattern4/1, guard/1,bad_arith/1,bool_cases/1,bad_apply/1, - files/1,effect/1,bin_opt_info/1,bin_construction/1]). + files/1,effect/1,bin_opt_info/1,bin_construction/1, comprehensions/1]). % Default timetrap timeout (set in init_per_testcase). -define(default_timeout, ?t:minutes(2)). @@ -61,7 +61,7 @@ groups() -> [{p,test_lib:parallel(), [pattern,pattern2,pattern3,pattern4,guard, bad_arith,bool_cases,bad_apply,files,effect, - bin_opt_info,bin_construction]}]. + bin_opt_info,bin_construction,comprehensions]}]. init_per_suite(Config) -> Config. @@ -536,6 +536,16 @@ bin_construction(Config) when is_list(Config) -> ok. +comprehensions(Config) when is_list(Config) -> + Ts = [{tautologic_guards, + <<" + f() -> [ true || true ]. + g() -> << <<1>> || true >>. + ">>, + [], []}], + run(Config, Ts), + ok. + %%% %%% End of test cases. %%% diff --git a/lib/eunit/include/eunit.hrl b/lib/eunit/include/eunit.hrl index 8ebdb6ba16..84242a09aa 100644 --- a/lib/eunit/include/eunit.hrl +++ b/lib/eunit/include/eunit.hrl @@ -102,7 +102,7 @@ %% X gets a new, local binding. %% (Note that lowercase 'let' is a reserved word.) -ifndef(LET). --define(LET(X,Y,Z), ((fun(X)->(Z)end)(Y))). +-define(LET(X,Y,Z), begin ((fun(X)->(Z)end)(Y)) end). -endif. %% It is important that testing code is short and readable. @@ -110,13 +110,13 @@ %% Compare: case f(X) of true->g(X); false->h(X) end %% and: ?IF(f(X), g(Y), h(Z)) -ifndef(IF). --define(IF(B,T,F), (case (B) of true->(T); false->(F) end)). +-define(IF(B,T,F), begin (case (B) of true->(T); false->(F) end) end). -endif. %% This macro yields 'true' if the value of E matches the guarded %% pattern G, otherwise 'false'. -ifndef(MATCHES). --define(MATCHES(G,E), (case (E) of G -> true; _ -> false end)). +-define(MATCHES(G,E), begin (case (E) of G -> true; _ -> false end) end). -endif. %% This macro can be used at any time to check whether or not the code @@ -140,6 +140,7 @@ %% for clauses that cannot match, even if the expression is a constant. -undef(assert). -define(assert(BoolExpr), + begin ((fun () -> case (BoolExpr) of true -> ok; @@ -152,7 +153,8 @@ _ -> {not_a_boolean,__V} end}]}) end - end)())). + end)()) + end). -endif. -define(assertNot(BoolExpr), ?assert(not (BoolExpr))). @@ -168,6 +170,7 @@ -define(assertMatch(Guard, Expr), ok). -else. -define(assertMatch(Guard, Expr), + begin ((fun () -> case (Expr) of Guard -> ok; @@ -178,7 +181,8 @@ {pattern, (??Guard)}, {value, __V}]}) end - end)())). + end)()) + end). -endif. -define(_assertMatch(Guard, Expr), ?_test(?assertMatch(Guard, Expr))). @@ -187,6 +191,7 @@ -define(assertNotMatch(Guard, Expr), ok). -else. -define(assertNotMatch(Guard, Expr), + begin ((fun () -> __V = (Expr), case __V of @@ -198,7 +203,8 @@ {value, __V}]}); _ -> ok end - end)())). + end)()) + end). -endif. -define(_assertNotMatch(Guard, Expr), ?_test(?assertNotMatch(Guard, Expr))). @@ -208,6 +214,7 @@ -define(assertEqual(Expect, Expr), ok). -else. -define(assertEqual(Expect, Expr), + begin ((fun (__X) -> case (Expr) of __X -> ok; @@ -218,7 +225,8 @@ {expected, __X}, {value, __V}]}) end - end)(Expect))). + end)(Expect)) + end). -endif. -define(_assertEqual(Expect, Expr), ?_test(?assertEqual(Expect, Expr))). @@ -227,6 +235,7 @@ -define(assertNotEqual(Unexpected, Expr), ok). -else. -define(assertNotEqual(Unexpected, Expr), + begin ((fun (__X) -> case (Expr) of __X -> erlang:error({assertNotEqual_failed, @@ -236,7 +245,8 @@ {value, __X}]}); _ -> ok end - end)(Unexpected))). + end)(Unexpected)) + end). -endif. -define(_assertNotEqual(Unexpected, Expr), ?_test(?assertNotEqual(Unexpected, Expr))). @@ -247,6 +257,7 @@ -define(assertException(Class, Term, Expr), ok). -else. -define(assertException(Class, Term, Expr), + begin ((fun () -> try (Expr) of __V -> erlang:error({assertException_failed, @@ -271,7 +282,8 @@ {__C, __T, erlang:get_stacktrace()}}]}) end - end)())). + end)()) + end). -endif. -define(assertError(Term, Expr), ?assertException(error, Term, Expr)). @@ -291,6 +303,7 @@ -define(assertNotException(Class, Term, Expr), ok). -else. -define(assertNotException(Class, Term, Expr), + begin ((fun () -> try (Expr) of _ -> ok @@ -316,7 +329,8 @@ _ -> ok end end - end)())). + end)()) + end). -endif. -define(_assertNotException(Class, Term, Expr), ?_test(?assertNotException(Class, Term, Expr))). @@ -327,6 +341,7 @@ %% these can be used for simply running commands in a controlled way -define(_cmd_(Cmd), (eunit_lib:command(Cmd))). -define(cmdStatus(N, Cmd), + begin ((fun () -> case ?_cmd_(Cmd) of {(N), __Out} -> __Out; @@ -337,7 +352,8 @@ {expected_status,(N)}, {status,__N}]}) end - end)())). + end)()) + end). -define(_cmdStatus(N, Cmd), ?_test(?cmdStatus(N, Cmd))). -define(cmd(Cmd), ?cmdStatus(0, Cmd)). -define(_cmd(Cmd), ?_test(?cmd(Cmd))). @@ -348,6 +364,7 @@ -define(assertCmdStatus(N, Cmd), ok). -else. -define(assertCmdStatus(N, Cmd), + begin ((fun () -> case ?_cmd_(Cmd) of {(N), _} -> ok; @@ -358,7 +375,8 @@ {expected_status,(N)}, {status,__N}]}) end - end)())). + end)()) + end). -endif. -define(assertCmd(Cmd), ?assertCmdStatus(0, Cmd)). @@ -366,6 +384,7 @@ -define(assertCmdOutput(T, Cmd), ok). -else. -define(assertCmdOutput(T, Cmd), + begin ((fun () -> case ?_cmd_(Cmd) of {_, (T)} -> ok; @@ -376,7 +395,8 @@ {expected_output,(T)}, {output,__T}]}) end - end)())). + end)()) + end). -endif. -define(_assertCmdStatus(N, Cmd), ?_test(?assertCmdStatus(N, Cmd))). @@ -394,26 +414,30 @@ -define(debugTime(S, E), (E)). -else. -define(debugMsg(S), - (begin - io:fwrite(user, <<"~s:~w:~w: ~s\n">>, - [?FILE, ?LINE, self(), S]), - ok - end)). + begin + io:fwrite(user, <<"~s:~w:~w: ~s\n">>, + [?FILE, ?LINE, self(), S]), + ok + end). -define(debugHere, (?debugMsg("<-"))). -define(debugFmt(S, As), (?debugMsg(io_lib:format((S), (As))))). -define(debugVal(E), + begin ((fun (__V) -> ?debugFmt(<<"~s = ~P">>, [(??E), __V, 15]), __V - end)(E))). + end)(E)) + end). -define(debugTime(S, E), + begin ((fun () -> {__T0, _} = statistics(wall_clock), __V = (E), {__T1, _} = statistics(wall_clock), ?debugFmt(<<"~s: ~.3f s">>, [(S), (__T1-__T0)/1000]), __V - end)())). + end)()) + end). -endif. diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index 741f2abaef..d9a27e7d1e 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -300,11 +300,11 @@ filename() = string() process or to a file. When streaming to the calling process using the option <c>self</c> the following stream messages will be sent to that process: <c>{http, {RequestId, - stream_start, Headers}, {http, {RequestId, stream, - BinBodyPart}, {http, {RequestId, stream_end, Headers}</c>. When + stream_start, Headers}}, {http, {RequestId, stream, + BinBodyPart}}, {http, {RequestId, stream_end, Headers}}</c>. When streaming to to the calling processes using the option <c>{self, once}</c> the first message will have an additional - element e.i. <c>{http, {RequestId, stream_start, Headers, Pid}</c>, + element e.i. <c>{http, {RequestId, stream_start, Headers, Pid}}</c>, this is the process id that should be used as an argument to <c>http:stream_next/1</c> to trigger the next message to be sent to the calling process. </p> diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml index 8438961511..3c132d34fa 100644 --- a/lib/inets/doc/src/httpd.xml +++ b/lib/inets/doc/src/httpd.xml @@ -406,7 +406,7 @@ bytes begins with url-path is mapped to local files that begins with directory-filename, for example: - <code>{alias, {"/image", "/ftp/pub/image"}</code> + <code>{alias, {"/image", "/ftp/pub/image"}}</code> and an access to http://your.server.org/image/foo.gif would refer to the file /ftp/pub/image/foo.gif. </p> @@ -421,7 +421,7 @@ bytes by re:replace/3 to produce a path in the local filesystem. For example: - <code>{re_write, {"^/[~]([^/]+)(.*)$", "/home/\\1/public\\2"}</code> + <code>{re_write, {"^/[~]([^/]+)(.*)$", "/home/\\1/public\\2"}}</code> and an access to http://your.server.org/~bob/foo.gif would refer to the file /home/bob/public/foo.gif. @@ -468,7 +468,7 @@ bytes scripts. URLs with a path beginning with url-path are mapped to scripts beginning with directory-filename, for example: - <code>{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}</code> + <code>{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}}</code> and an access to http://your.server.org/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo. </p> @@ -483,7 +483,7 @@ bytes scripts. URLs with a path beginning with url-path are mapped to scripts beginning with directory-filename, for example: - <code>{script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}</code> + <code>{script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}}</code> and an access to http://your.server.org/cgi-bin/17/foo would cause the server to run the script /web/17/cgi-bin/foo. </p> @@ -517,7 +517,7 @@ bytes the standard CGI PATH_INFO and PATH_TRANSLATED environment variables. - <code>{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}</code> + <code>{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}}</code> </p> </item> @@ -532,7 +532,7 @@ bytes the standard CGI PATH_INFO and PATH_TRANSLATED environment variables. - <code>{script, {"PUT", "/cgi-bin/put"}</code> + <code>{script, {"PUT", "/cgi-bin/put"}}</code> </p> </item> @@ -549,7 +549,7 @@ bytes scheme scripts. A matching URL is mapped into a specific module and function. For example: - <code>{erl_script_alias, {"/cgi-bin/example", [httpd_example]} + <code>{erl_script_alias, {"/cgi-bin/example", [httpd_example]}} </code> and a request to @@ -706,7 +706,7 @@ bytes For example: - <code>{allow_from, ["123.34.56.11", "150.100.23"] </code> + <code>{allow_from, ["123.34.56.11", "150.100.23"]}</code> The host 123.34.56.11 and all machines on the 150.100.23 subnet are allowed access. </p> @@ -719,7 +719,7 @@ bytes which should be denied access to a given directory. For example: - <code>{deny_from, ["123.34.56.11", "150.100.23"] </code> + <code>{deny_from, ["123.34.56.11", "150.100.23"]}</code> The host 123.34.56.11 and all machines on the 150.100.23 subnet are not allowed access. </p> @@ -835,7 +835,7 @@ bytes <p><em>Security properties - requires mod_security </em></p> <marker id="prop_sec_dir"></marker> - <p><em>{security_directory, {path(), [{property(), term()}]}</em></p> + <p><em>{security_directory, {path(), [{property(), term()}]}}</em></p> <marker id="props_sdir"></marker> <p>Here follows the valid properties for security directories</p> @@ -1067,7 +1067,7 @@ bytes <fsummary>Called for each request to the Web server.</fsummary> <type> <v>OldData = list()</v> - <v>NewData = [{response,{StatusCode,Body}}] | [{response,{response,Head,Body}}] | [{response,{already_sent,Statuscode,Size}] </v> + <v>NewData = [{response,{StatusCode,Body}}] | [{response,{response,Head,Body}}] | [{response,{already_sent,Statuscode,Size}}] </v> <v>StausCode = integer()</v> <v>Body = io_list() | nobody | {Fun, Arg}</v> <v>Head = [HeaderOption]</v> diff --git a/lib/inets/doc/src/httpd_util.xml b/lib/inets/doc/src/httpd_util.xml index 9f290084d2..9218ee91e2 100644 --- a/lib/inets/doc/src/httpd_util.xml +++ b/lib/inets/doc/src/httpd_util.xml @@ -337,10 +337,10 @@ <func> <name>rfc1123_date() -> RFC1123Date</name> - <name>rfc1123_date({{YYYY,MM,DD},{Hour,Min,Sec}}}) -> RFC1123Date</name> + <name>rfc1123_date({{YYYY,MM,DD},{Hour,Min,Sec}}) -> RFC1123Date</name> <fsummary>Return the current date in RFC 1123 format.</fsummary> <type> - <v>YYYY = MM = DD = Hour = Min =Sec = integer()</v> + <v>YYYY = MM = DD = Hour = Min = Sec = integer()</v> <v>RFC1123Date = string()</v> </type> <desc> diff --git a/lib/inets/doc/src/mod_alias.xml b/lib/inets/doc/src/mod_alias.xml index 265a1b8e76..b38be5db28 100644 --- a/lib/inets/doc/src/mod_alias.xml +++ b/lib/inets/doc/src/mod_alias.xml @@ -118,7 +118,7 @@ </func> <func> - <name>real_script_name(ConfigDB,RequestURI,ScriptAliases) -> Ret</name> + <name>real_script_name(ConfigDB, RequestURI, ScriptAliases) -> Ret</name> <fsummary>Expand a request uri using ScriptAlias config directives.</fsummary> <type> <v>ConfigDB = config_db()</v> @@ -129,7 +129,7 @@ </type> <desc> <marker id="real_script_name"></marker> - <p><c>real_name/3</c> traverses <c>ScriptAliases</c>, + <p><c>real_script_name/3</c> traverses <c>ScriptAliases</c>, typically extracted from <c>ConfigDB</c>, and matches each <c>FakeName</c> with <c>RequestURI</c>. If a match is found <c>FakeName</c> is replaced with <c>RealName</c> in the diff --git a/lib/inets/doc/src/notes_history.xml b/lib/inets/doc/src/notes_history.xml index bd59c1ba47..4162ab97bb 100644 --- a/lib/inets/doc/src/notes_history.xml +++ b/lib/inets/doc/src/notes_history.xml @@ -834,7 +834,7 @@ <list type="bulleted"> <item> <p>[ftp, client] - A new option {progress, {CBmodule, - CBFunction, InitProgressTerm} has been added to allow + CBFunction, InitProgressTerm}} has been added to allow users to create things such as progress bars in there GUI's. The option affects ftp:send/[3,4] and ftp:recv/[3,4].</p> diff --git a/lib/kernel/src/user_drv.erl b/lib/kernel/src/user_drv.erl index bb654495d3..7b4ffb09ca 100644 --- a/lib/kernel/src/user_drv.erl +++ b/lib/kernel/src/user_drv.erl @@ -418,7 +418,7 @@ list_commands(Iport, Oport) -> true -> []; false -> - [{put_chars,unicode," q - quit erlang\n"}] + [{put_chars, unicode," q - quit erlang\n"}] end, io_requests([{put_chars, unicode," c [nn] - connect to job\n"}, {put_chars, unicode," i [nn] - interrupt job\n"}, 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/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'. |