|
Hi,
I get a warning from dialyzer when using ets:select (test case attached), but it seems like a false warning. The fact that the key (#r.k) is a tuple rather than an atom seems important - there's no warning if it's an atom. This is on R14B (as well as earlier versions). Any ideas? Thanks, Klas ________________________________________________________________ erlang-bugs (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:[hidden email] |
|
Klas Johansson wrote:
> Hi, > > I get a warning from dialyzer when using ets:select (test case > attached), but it seems like a false warning. The fact that the key > (#r.k) is a tuple rather than an atom seems important - there's no > warning if it's an atom. > > This is on R14B (as well as earlier versions). > > Any ideas? You are sort of right that this is related to the declaration of #r{} and its fields. But this is not a dialyzer bug! Instead, it's a bug in the ms_transform parse transformation which is not aware of type declarations in records and messes up things. To verify that this is the case either comment out the line: -include_lib("stdlib/include/ms_transform.hrl"). which enables the parse transform, or simply take out the type declaration from the record. Dialyzer will then like your module :-) I am leaving this to the person responsible for the ms parse transform to fix. Kostis ________________________________________________________________ erlang-bugs (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:[hidden email] |
|
On Thu, Nov 4, 2010 at 11:22 PM, Kostis Sagonas <[hidden email]> wrote:
> Klas Johansson wrote: >> >> Hi, >> >> I get a warning from dialyzer when using ets:select (test case >> attached), but it seems like a false warning. The fact that the key >> (#r.k) is a tuple rather than an atom seems important - there's no >> warning if it's an atom. >> >> This is on R14B (as well as earlier versions). >> >> Any ideas? > > You are sort of right that this is related to the declaration of #r{} and > its fields. But this is not a dialyzer bug! > > Instead, it's a bug in the ms_transform parse transformation which is not > aware of type declarations in records and messes up things. > > To verify that this is the case either comment out the line: > > -include_lib("stdlib/include/ms_transform.hrl"). > > which enables the parse transform, or simply take out the type declaration > from the record. Dialyzer will then like your module :-) > > I am leaving this to the person responsible for the ms parse transform to > fix. Ah, I see what's happening here. The parse transform generates this match specification for me: [{{r,'_'},[],['$_']}] which is the same as [{#r{_='_'},[],['$_']}] ... but this doesn't match the type specs ('_' is an atom, not a tuple): -type k() :: {term(), term()}. -record(r, {k :: k()}). Tricky. Thanks for your help. BR, Klas ________________________________________________________________ erlang-bugs (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:[hidden email] |
| Powered by Nabble | Edit this page |
