File 7413-stdlib-Fix-specs-for-all-documented-functions.patch of Package erlang
From d7710e40a19547201fab4dbf7583660b86f041c0 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 4 Jan 2024 14:27:16 +0100
Subject: [PATCH 3/6] stdlib: Fix specs for all documented functions
---
lib/parsetools/src/yecc.erl | 33 ++++++++++++++++++---------------
lib/stdlib/src/c.erl | 7 +++----
lib/stdlib/src/gen_event.erl | 1 +
lib/stdlib/src/slave.erl | 1 +
scripts/run-dialyzer | 2 +-
5 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/lib/parsetools/src/yecc.erl b/lib/parsetools/src/yecc.erl
index 4fb25142c0..c492f940eb 100644
--- a/lib/parsetools/src/yecc.erl
+++ b/lib/parsetools/src/yecc.erl
@@ -26,6 +26,8 @@
-export([compile/3, file/1, file/2, format_error/1]).
+-export_type([option/0, yecc_ret/0]).
+
%% Kept for compatibility with R10B.
-export([yecc/2, yecc/3, yecc/4]).
@@ -245,6 +247,21 @@ format_error(cannot_parse) ->
-type error_ret() :: 'error'
| {'error', Errors :: errors(), Warnings :: warnings()}.
-type yecc_ret() :: ok_ret() | error_ret().
+-type option() :: {'error_location', 'column' | 'line'}
+ | {'includefile', Includefile :: file:filename()}
+ | {'report_errors', boolean()}
+ | {'report_warnings', boolean()}
+ | {'report', boolean()}
+ | {'return_errors', boolean()}
+ | {'return_warnings', boolean()}
+ | {'return', boolean()}
+ | {'parserfile', Parserfile :: file:filename()}
+ | {'verbose', boolean()}
+ | {'warnings_as_errors', boolean()}
+ | {'deterministic', boolean()}
+ | 'report_errors' | 'report_warnings' | 'report'
+ | 'return_errors' | 'return_warnings' | 'return'
+ | 'verbose' | 'warnings_as_errors'.
-spec file(FileName) -> yecc_ret() when
FileName :: file:filename().
@@ -255,21 +272,7 @@ file(GrammarFile) ->
-spec file(Grammarfile, Options) -> yecc_ret() when
Grammarfile :: file:filename(),
Options :: Option | [Option],
- Option :: {'error_location', 'column' | 'line'}
- | {'includefile', Includefile :: file:filename()}
- | {'report_errors', boolean()}
- | {'report_warnings', boolean()}
- | {'report', boolean()}
- | {'return_errors', boolean()}
- | {'return_warnings', boolean()}
- | {'return', boolean()}
- | {'parserfile', Parserfile :: file:filename()}
- | {'verbose', boolean()}
- | {'warnings_as_errors', boolean()}
- | {'deterministic', boolean()}
- | 'report_errors' | 'report_warnings' | 'report'
- | 'return_errors' | 'return_warnings' | 'return'
- | 'verbose' | 'warnings_as_errors'.
+ Option :: option().
file(File, Options0) when is_list(Options0) ->
case is_filename(File) of
diff --git a/lib/stdlib/src/c.erl b/lib/stdlib/src/c.erl
index b65171a6a5..486a7a96a6 100644
--- a/lib/stdlib/src/c.erl
+++ b/lib/stdlib/src/c.erl
@@ -1177,21 +1177,20 @@ get_uptime() ->
%%
%% Cross Reference Check
%%
-%%-spec xm(module() | file:filename()) -> xref:m/1 return
+-spec xm(module() | file:filename()) -> XRefMRet :: term(). % xref:m/1 return
xm(M) ->
appcall(tools, xref, m, [M]).
%%
%% Call yecc
%%
-%%-spec y(file:name()) -> yecc:file/2 return
+-spec y(file:name()) -> YeccFileRet :: term(). % yecc:file/2 return
y(File) -> y(File, []).
-%%-spec y(file:name(), [yecc:option()]) -> yecc:file/2 return
+-spec y(file:name(), [yecc:option()]) -> YeccFileRet :: yecc:yecc_ret(). % yecc:file/2 return
y(File, Opts) ->
appcall(parsetools, yecc, file, [File, Opts]).
-
%%
%% Avoid creating strong components in xref and dialyzer by making calls
%% from helper functions to other applications indirect.
diff --git a/lib/stdlib/src/gen_event.erl b/lib/stdlib/src/gen_event.erl
index 63dda72232..d9db7104bc 100644
--- a/lib/stdlib/src/gen_event.erl
+++ b/lib/stdlib/src/gen_event.erl
@@ -466,6 +466,7 @@ which_handlers(M) -> rpc(M, which_handlers).
stop(M) ->
gen:stop(M).
+-spec stop(emgr_ref(), term(), timeout()) -> 'ok'.
stop(M, Reason, Timeout) ->
gen:stop(M, Reason, Timeout).
diff --git a/lib/stdlib/src/slave.erl b/lib/stdlib/src/slave.erl
index 342c55e3eb..2d5473e312 100644
--- a/lib/stdlib/src/slave.erl
+++ b/lib/stdlib/src/slave.erl
@@ -52,6 +52,7 @@
%% Start a list of pseudo servers on the local node
+-spec pseudo([Master :: node() | ServerList :: [atom()]]) -> ok.
pseudo([Master | ServerList]) ->
pseudo(Master , ServerList);
pseudo(_) ->
diff --git a/scripts/run-dialyzer b/scripts/run-dialyzer
index cad04a3514..293d415f25 100755
--- a/scripts/run-dialyzer
+++ b/scripts/run-dialyzer
@@ -21,7 +21,7 @@ ALL_APPLICATIONS="erts $ALL_APPLICATIONS"
echo "All applications: $ALL_APPLICATIONS" |tr '\n' ' ' && echo ""
BASE_PLT="compiler crypto erts kernel stdlib syntax_tools"
-APP_PLT="asn1 debugger edoc et ftp inets mnesia observer public_key sasl runtime_tools snmp ssl tftp wx xmerl tools"
+APP_PLT="asn1 debugger edoc et ftp inets mnesia observer parsetools public_key sasl runtime_tools snmp ssl tftp wx xmerl tools"
NO_UNMATCHED="common_test eunit inets megaco mnesia snmp ssh ssl observer reltool"
WARNINGS="diameter"
--
2.35.3