case Sqlitex.query!(conn, "pragma #{clause};") do
[[{^key, value}]] ->
single_value(key, value)
values when is_list(values) ->
multiple_values(key, values)
end
...I get this Dialyzer error:
lib/yourapp/yourapp.ex:100:pattern_match
The pattern can never match the type.
Pattern:
[[{_, _value}]]
Type:
[[]]
Upon inspecting Sqlitex's code, I noticed that the query / query! functions have two specs each (to cover for the default and non-default parameters) but where a list of zero or more keyword lists is expected to be returned, the spec says the function should return [[]].
This PR modifies the [[]] specs to the more accurate [keyword].
Coverage remained the same at 93.627% when pulling 0804760b589eab72d96273f90bccfc2f1136b2a4 on dimitarvp:fix-double-specs into 9c94469b862a43b7a36e31d1d295ff3d6f320491 on elixir-sqlite:master.
When doing something as simple as:
...I get this Dialyzer error:
Upon inspecting Sqlitex's code, I noticed that the
query
/query!
functions have two specs each (to cover for the default and non-default parameters) but where a list of zero or more keyword lists is expected to be returned, the spec says the function should return[[]]
.This PR modifies the
[[]]
specs to the more accurate[keyword]
.