aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/io_lib.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2013-08-21 13:50:20 +0200
committerHans Bolinder <[email protected]>2013-08-21 15:53:37 +0200
commita474bdfda30a3b6a520bf2be4b4550b251095703 (patch)
treec898f1d82001871ee851c7a8f2393e6599494485 /lib/stdlib/src/io_lib.erl
parent420fe40a688f88cbcd6c716cc01a5f87908bc5ee (diff)
downloadotp-a474bdfda30a3b6a520bf2be4b4550b251095703.tar.gz
otp-a474bdfda30a3b6a520bf2be4b4550b251095703.tar.bz2
otp-a474bdfda30a3b6a520bf2be4b4550b251095703.zip
Correct the specifications of io_lib:fread/2,3
Thanks to Chris King and Kostis Sagonas for pinpointing the bug.
Diffstat (limited to 'lib/stdlib/src/io_lib.erl')
-rw-r--r--lib/stdlib/src/io_lib.erl9
1 files changed, 6 insertions, 3 deletions
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()}}.