dashbitco / nimble_csv

A simple and fast CSV parsing and dumping library for Elixir
https://hexdocs.pm/nimble_csv
772 stars 51 forks source link

Dialyzer error in newlines_separator! #80

Closed Munksgaard closed 7 months ago

Munksgaard commented 8 months ago

When running dialyzer in my project (which relies on nimble_csv), I get the following error:

deps/nimble_csv/lib/nimble_csv.ex:523:unmatched_return
The expression produces a value of type:

[integer(), ...]

but this value is unmatched.

By adding dialyzer to this repo with the following settings, I can confirm that the problem is in nimble_csv:

dialyzer: [
  flags: [:unmatched_returns, :error_handling, :extra_return, :missing_return, :underspecs],
  plt_file: {:no_warn, "priv/plts/nimble_csv.plt"},
  plt_core_path: "priv/plts/core.plt",
]

While the error points at this line, it's clear the the missing match occurs somewhere within newlines_separator!.

josevalim commented 8 months ago

We don't use dialyzer in this project, but a PR is welcome if you want to address the issue. Maybe adding quote generated: true do to some of the code generation will address it.