Skip to content

Commit

Permalink
Merge pull request #8954 from hizel/logical-processors-type
Browse files Browse the repository at this point in the history
dialyzer: update erlang:system_info logical_processors type

OTP-19307
  • Loading branch information
jhogberg authored Oct 21, 2024
2 parents 2f9fdcd + acb8f6e commit 299e3b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/dialyzer/src/erl_bif_types.erl
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,10 @@ type(erlang, system_info, 1, Xs, Opaques) ->
t_internal_cpu_topology();
['loaded'] ->
t_binary();
['logical_processors'] ->
t_non_neg_fixnum();
[P] when P == 'logical_processors'
orelse P == 'logical_processors_available'
orelse P == 'logical_processors_online' ->
t_sup([t_non_neg_fixnum(),t_atom('unknown')]);
['machine'] ->
t_string();
['multi_scheduling'] ->
Expand Down
5 changes: 5 additions & 0 deletions lib/dialyzer/test/small_SUITE_data/results/logical_processors
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

logical_processors.erl:11:1: Function t1/0 has no local return
logical_processors.erl:12:7: The pattern 'ok' can never match the type 'unknown' | non_neg_integer()
logical_processors.erl:14:1: Function t2/0 has no local return
logical_processors.erl:15:7: The pattern 'ok' can never match the type 'unknown' | non_neg_integer()
16 changes: 16 additions & 0 deletions lib/dialyzer/test/small_SUITE_data/src/logical_processors.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-module(logical_processors).

-export([t0/0,t1/0,t2/0]).

t0() ->
unknown = erlang:system_info(logical_processors),
unknown = erlang:system_info(logical_processors_available),
unknown = erlang:system_info(logical_processors_online),
ok.

t1() ->
ok = erlang:system_info(logical_processors_available).

t2() ->
ok = erlang:system_info(logical_processors_online).

0 comments on commit 299e3b8

Please sign in to comment.