diff options
author | Sölvi Páll Ásgeirsson <[email protected]> | 2018-12-13 13:46:27 +0000 |
---|---|---|
committer | Sölvi Páll Ásgeirsson <[email protected]> | 2018-12-13 14:07:30 +0000 |
commit | f87e53dfd230bdac66cbbc756cb92c2f0957c465 (patch) | |
tree | 631bee8b89597fdcb161d539f0f976c47e0cfedf | |
parent | 56f93ad10f89e6b8d3372e45127ec9fdc3fca35b (diff) | |
download | otp-f87e53dfd230bdac66cbbc756cb92c2f0957c465.tar.gz otp-f87e53dfd230bdac66cbbc756cb92c2f0957c465.tar.bz2 otp-f87e53dfd230bdac66cbbc756cb92c2f0957c465.zip |
gen_statem exports types related to starting & naming
Currently, a user of gen_statem cannot use gen_statem types
related to naming & starting in their behaviour implementations
As an example, we cannot do:
-spec start_link(Options) -> gen_statem:start_ret() when
Options :: some_complex_thing().
start_link(Options) ->
gen_statem:start_link(?MODULE, [Opts], []).
As dialyzer, if configured to complain about unknown types, will
warn that the type gen_statem:start_ret() is unknown.
Likewise, for the same reason, we cannot do:
-spec do_call_to_gen_statem(ServerRef) -> Reply when
ServerRef :: gen_statem:server_ref(),
Reply :: term().
do_call_to_gen_statem(ServerRef) ->
gen_statem:call(ServerRef, do_thing).
This fixes that by exporting the appropriate types
-rw-r--r-- | lib/stdlib/src/gen_statem.erl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/stdlib/src/gen_statem.erl b/lib/stdlib/src/gen_statem.erl index 24b268cd38..5f5af7d38f 100644 --- a/lib/stdlib/src/gen_statem.erl +++ b/lib/stdlib/src/gen_statem.erl @@ -67,6 +67,14 @@ %% Type that is exported just to be documented -export_type([transition_option/0]). +%% Type exports for start_link & friends +-export_type( + [server_name/0, + server_ref/0, + hibernate_after_opt/0, + start_opt/0, + start_ret/0]). + %%%========================================================================== %%% Interface functions. %%%========================================================================== |