[erlang-questions] Dialyzer

Frans Schneider fchschneider@REDACTED
Sun Jan 20 17:10:13 CET 2019


Dear lsit,

I have the following function plus specification:

-spec new(Seq_nums, DDS_filter) -> Cfrs when
       Seq_nums :: nonempty_list(rtps:sequence_number()),
       DDS_filter :: fun((rtps:sequence_number()) -> boolean()),
       Cfrs :: nonempty_list(cfr()).

new(Seq_nums, DDS_filter) ->
     [#cfr{sequence_number = N, status = unsent,
           is_relevant = not DDS_filter(N)}
      || N <- Seq_nums].

Dialyzer complains with:

Invalid type specification for function rtps_cfr:new/2. The success 
typing is ([],_) -> []

The filter is an external function,
What is wrong with the spec?

TIA

Frans



More information about the erlang-questions mailing list