diff --git a/lib/dialyzer/src/erl_bif_types.erl b/lib/dialyzer/src/erl_bif_types.erl index 320b6bbcc407..37d9dcec8908 100644 --- a/lib/dialyzer/src/erl_bif_types.erl +++ b/lib/dialyzer/src/erl_bif_types.erl @@ -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'] -> diff --git a/lib/dialyzer/test/small_SUITE_data/results/logical_processors b/lib/dialyzer/test/small_SUITE_data/results/logical_processors new file mode 100644 index 000000000000..d80aa4dac324 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/logical_processors @@ -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() diff --git a/lib/dialyzer/test/small_SUITE_data/src/logical_processors.erl b/lib/dialyzer/test/small_SUITE_data/src/logical_processors.erl new file mode 100644 index 000000000000..4bdf24432d8a --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/logical_processors.erl @@ -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). +