<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">I am new to the Erlang ecosystem, so please excuse / assist with my vocabulary. I’ve observed that Dialyzer behaves differently with union types of different cardinality, with a threshold of 13 items. An example is below:</div><div class=""><br class=""></div><div class=""><div class="">    -module(atom_widening).</div><div class="">    -export([example1/1, example2/1, main/0]).</div><div class=""><br class=""></div><div class="">    % Cardinality above 13 -> not checked as expected.</div><div class="">    -type value1() :: 1..14.</div><div class=""><br class=""></div><div class="">    -spec example1(value1()) -> ok | error.</div><div class="">    example1(A) when A >= 1, A =< 10 -> ok;</div><div class="">    example1(_) -> error.</div><div class=""><br class=""></div><div class="">    % Cardinality not above 13 -> checked as expected.</div><div class="">    -type value2() :: 1..13.</div><div class=""><br class=""></div><div class="">    -spec example2(value2()) -> ok | error.</div><div class="">    example2(A) when A >= 1, A =< 10 -> ok;</div><div class="">    example2(_) -> error.</div><div class=""><br class=""></div><div class="">    main() -></div><div class="">      error = example1(15), % Passes successfully.</div><div class="">      error = example2(15). % Warning: breaks the contract.</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Similar behavior occurs with unions of atoms; unions of up to 13 atoms are checked as I expect, but unions of 14 or more atoms are not. This behavior appears to be intentional according to this: <a href="https://github.com/erlang/otp/blob/master/lib/dialyzer/test/small_SUITE_data/src/atom_widen.erl" class="">https://github.com/erlang/otp/blob/master/lib/dialyzer/test/small_SUITE_data/src/atom_widen.erl</a></div><div class=""><br class=""></div><div class="">My questions: where is this threshold defined, and can it be configured? Alternatively, is there a better way of constructing large union types that will allow Dialyzer to check them as “strictly” as types with fewer items?</div><div class=""><br class=""></div><div class="">Thank you for your time,</div><div class="">- AJ</div><div class=""><br class=""></div></body></html>