I have a function with 2 default parameters
defp foo(bar, baz, qux \\ "", garply \\ nil)
I’ve got two usages, one supplies only the first two parameters, the other all 4. Dialyzer is complaining that Function foo/3 will never be called
. I assume this is because it's private and the two defaults allow for unroll_nodes/2
, unroll_nodes/3
, and unroll_nodes/4
. I could ostensibly drop the defaults and supply them in the current foo/2
invocation, but it seems silly just to placate dialyzer. Is there a way to specify this in the spec?
You can suppress the dialyzer warning using the @dialyzer
attribute:
@dialyzer {:no_unused, [foo: 3]}
All possible options are listed here.