<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><br><span></span></div><div>Hi,</div><div><br></div><div>typer seems to be producing wrong spec for the below code. </div><div><br></div><div>Also, dialyzer with "-Wunmatched_returns -Werror_handling -Wbehaviours -Wunderspecs -Woverspecs" shows no warnings.<br></div><div><br></div><div>I am wondering ... is this a bug ?<br></div><div><br></div><div>Thanks,<br></div><div>-ARUN<br></div><div><br></div><div><br></div><div>-------------------------------------------------------------------------------<br></div><div>%% File: "test.erl"<br>
%% ----------------<br>
-spec is_valid(_) -> boolean().<br>
-spec start(_,_) -> {['abs_n1_minus_n2_gt_5' | 'both_are_invalid' |
'n1_is_invalid' | 'n2_is_invalid' | 'this_could_be_a_bug'],_,'not_ok' |
'ok'}.<br>
</div><div><br></div><div> -module(test).<br><br>-export([start/2]).<br><br>is_valid (N) -><br> N > 10.<br><br>start ( N1 , N2) -><br><br> Is_valid_N1 = is_valid (N1),<br> Is_valid_N2 = is_valid (N2),<br><br> case {Is_valid_N1, Is_valid_N2} of<br><br> { false, true } -> <br> { [n1_is_invalid], N2 , ok};<br><br> { true, false } -> <br> { [n2_is_invalid], N1, ok};<br> { false, false } -> <br> {
[<br> n1_is_invalid, <br> n2_is_invalid,<br> both_are_invalid,<br> this_could_be_a_bug<br> ],<br> invalid, not_ok };<br> { true, true } -> <br> case
N1 < N2 of<br> true -> Minimum = N1;<br> false -> Minimum = N2 <br> end,<br><br> case abs(N1- N2) > 5.0 of<br> false -> { [], Minimum, ok }; <br> true -> {
[abs_n1_minus_n2_gt_5], Minimum, ok } <br> end<br> end.<br>-------------------------------------------------------------------------------<br></div></div></body></html>