17.0 : dialyzer issue on boolean type in record.

PAILLEAU Eric <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
Hi,
please considere below minimal module :
---8<----------------------------------------------------
-module(test).

-export([test/0]).

-record(test, { bool   = 'true' :: boolean()} ).

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

test(R) -> case R#test.bool of
                 true  -> ok ;
                 false -> ok
            end.
---8<----------------------------------------------------
dialyzer raise an error :

test.erl:11: The pattern 'false' can never match the type 'true'.

Looks like dialyzer considere #test.bool to be of type 'true' while it 
is of type boolean() and default value to 'true'.

Documentation says :
"In the presence of initial values for fields, the type must be declared 
after the initialization as in the following:

   -record(rec, {field1 = [] :: Type1, field2, field3 = 42 :: Type3}).

Naturally, the initial values for fields should be compatible with (i.e. 
a member of) the corresponding types. "


A bug, isn't it ?

Regards.

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.