... has overlapping domains; such contracts are currently unsupported and are simply ignored

Guys what is the wisdom on function specs that will result in the subj warning from dialyzer?
A poorly made up example :

@spec process_record(atom, any) :: String.t
def process_record(:skip, __), do: “ignored”

@spec process_record(any, some_record) :: String.t
def process_record( __, details), do: do_somecrazy_thing(details)

Combine clauses? Let it be?

3 Likes
@spec process_record(any, any)
def process_record(:skip, __), do: "ignored"
def process_record( _, details), do: dosomecrazy_thing(details)

You want just one @spec per name / arity.

9 Likes

Thank you!

1 Like

hello folks!

apologies for poking old thread, perhaps someone will find useful if we will supplement it with explanation which helped me to get it:

You should be aware of that, even if you define multiple functions of the same arity (accept the same number of arguments), from outside world this is considered only one function. That means, you need to define function signature, and only this one should have type spec defined.

Cheers,
Filip