<div dir="ltr">Greetings,<div><br></div><div>This is on Erlang 20.3. I am at work, so if anybody could test on 21 that would be nice.</div><div><br></div><div>The source code below (the smallest I could make the original and still get the warning) gives me the Dialyzer warning (line 19 is first/2):</div><div>src/test_dialyzer.erl</div><div>  19 </div><div>: The pattern <_, {'error', _Reason}> can never match the type <boolean() | {'error',_},[atom() | [any()] | char()]></div><div><br></div><div>If I remove the first argument to key/2, Dialyzer is silent.</div><div>Is there anybody that would like to explain why I get the warning?</div><div>Is it some kind of interference between type specs? Ie, is_dets_file/1 hides {error, Reason} from oldest/1 ?</div><div><br></div><div><br></div><div>Best Wishes,</div><div>bengt</div><div><br></div><div><br></div><div><div>-module( test_dialyzer ).</div><div><br></div><div>%% API exports</div><div>-export( [key/1] ).</div><div><br></div><div>%%====================================================================</div><div>%% API functions</div><div>%%====================================================================</div><div><br></div><div>-spec( key(Name::file:filename()) -> ok ).</div><div>key( Name ) -></div><div><span style="white-space:pre">     </span>O = oldest( file:list_dir(Name) ),</div><div><span style="white-space:pre">    </span>key( dets:is_dets_file(O), O ).</div><div><br></div><div>%%====================================================================</div><div>%% Internal functions</div><div>%%====================================================================</div><div><br></div><div>key( _, {error, _Reason} ) -> ok;</div><div>key( _, _ ) -> ok.</div><div><br></div><div>oldest( {ok, [H | _]} ) -> H;</div><div>oldest( {error, Reason} ) -> {error, Reason}.</div><div><br></div></div></div>