[erlang-questions] dialyzer -Wunderspecs and the binary() type

James Aimonetti <>
Thu Sep 29 20:27:02 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

We use -Wunderspecs a lot in our Dialyzing and the only minor complaint
I have is when I get warnings that the success typing is more specfic
with the binary() type.

We see a lot of:

foo.erl:123: Type specfication foo:a_fun(BinVal) -> 'ok' when
is_subtype(BinVal, binary()) is a supertype of the success typing:
foo:a_fun(<<_:8,_:_*8>>) -> 'ok'.

In foo.erl, a_fun/1 is defined as:

- -spec a_fun(BinVal) -> 'ok' when
  BinVal :: binary().
a_fun(BinVal) ->
  %% do something with BinVal
  ok.

This is obviously a simplified, trivial example. Just curious if its
possible to have Dialyzer *not* output the -Wunderspecs warnings for
binaries? Or if there's a better way to specify binary inputs/outputs
(since not all of our functions using binary() in the spec have this issue).

This is in R14B03, if that makes a difference.

Thanks,

James

- -- 
James Aimonetti
Distributed Systems Engineer / DJ MC_

2600hz | http://2600hz.com
sip:
tel: 415.886.7905
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOhLh2AAoJENc77s1OYoGg9m8H/iiILocPGlrCEwpg1xdVsQEO
E6AZbrvjJHSpieJUfCLmuSUH7K3qQxdDPNA1l2S9QIzCm+TmeBSj37GVdW5gj5i3
SGTQoCYEgUmDqJISK7QgmGePms+3PmpN1HDw18Y1QwddXcbznSl05bCgGOhyFKee
At7zjLDbuhONzU8gB8aoCdzetSzUxbs0CzNggi7y1qdzLY7POuCVOa6+g8Oo7HY/
kd0490D7By68vlp2ALGcW1fSVZk8Zb5MFd+dA3TFgyXzfEPtKx6xvX/lTzi2COdc
5T3hk1jxCeUkTsvLcUq2ZtrjXzwWhPrDjPoThPMWr3DiO++y6j8TCwV3F/e1tJA=
=kdk0
-----END PGP SIGNATURE-----



More information about the erlang-questions mailing list