[erlang-bugs] 17.0 : dialyzer issue on boolean type in record.

PAILLEAU Eric eric.pailleau@REDACTED
Tue Jul 29 00:34:55 CEST 2014


Hi Steve,

dialyzer is right, yes, in a sens, because the default value is not 
dynamically set, but what about below code ?

dialyzer raise an error, because too smart, probably,
while code is valid...

This indeed imply to only set the type and not default value...
Regards.

---8<----------------------------------------------------
-module(test).

-export([test/0]).

-ifdef(TEST).
-record(test, { bool   = 'true' :: boolean()} ).
-else.
-record(test, { bool   = 'false' :: boolean()} ).
-endif.

test() -> test(#test{}).

test(R) -> case R#test.bool of
                 true  -> true ;
                 false -> false
            end.
---8<----------------------------------------------------



More information about the erlang-bugs mailing list