Skip to content

Dialyzer error with NimbleCSV.RFC4180 #79

@sonic182

Description

@sonic182

I have an error with dialyzer, by using this dummy parse_stream, I'm obtaining no local return

defmodule MyMod

  @spec base_stream(binary) :: Enumerable.t()
  def base_stream(srcfile) do
    srcfile
    |> File.stream!([:read, :compressed, :utf8, read_ahead: 10_000])
    |> NimbleCSV.RFC4180.parse_stream(skip_headers: false)
  end

end
Finding suitable PLTs
Checking PLT...
...
PLT is up to date!
No :ignore_warnings opt specified in mix.exs and default does not exist.

Starting Dialyzer
[
  check_plt: false,
  init_plt: ~c"/app/_build/dev/dialyxir_erlang-26.0.2_elixir-1.15.4_deps-dev.plt",
  files: [...],
  warnings: [:unknown]
]
Total errors: 9, Skipped: 0, Unnecessary Skips: 0
done in 0m5.13s

...
________________________________________________________________________________
lib/tasks/image_captioning/prepare_image.ex:166:no_return
Function base_stream/1 has no local return.
________________________________________________________________________________

...

________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
zsh returned exit code 2

My real codes is more or less:

defmodule Foo

  def run(srcfile) do
    [["1", "foo"]]
    # srcfile
    # |> base_stream()
    |> Stream.map(fn [id, image_link] -> %{"id" => id, "image_link" => image_link} end)
    |> ...
  end

end

If I use the dummy example [["1", "foo"]] dialyzer doesn't fail, if I use it with the base_stream it fails. Any idea how to overcome this? I think it is a bug in RFC4180 parser definition

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions