elixir-image / image

Image processing for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image.replace_color dialyzer issue

tielur opened this issue · comments

I'm getting a dialyzer issue with Image.replace_color

lib/replace_with_test.ex:15:no_return
Function hello/0 has no local return.
________________________________________________________________________________
lib/replace_with_test.ex:18:call
The function call will not succeed.

Image.replace_color(%Vix.Vips.Image{:ref => reference()}, [{:replace_with, :white}])

breaks the contract
(Vix.Vips.Image.t(), Image.Options.ChromaKey.chroma_key_options() | map() | :replace_with) ::
  {:ok, Vix.Vips.Image.t()} | {:error, error_message()}

I wrote a small example app that the above output is from:

https://github.com/tielur/replace_with_test

If you run mix dialyzer you'll see that output

Thanks for the report and the test case, very much appreciated. I've pushed a commit to fix the spec. Would you mind checking on your side using {:image, github: "elixir-image/image"} in your mix.exs to confirm before I publish an update?

Hey @kipcole9

It looks like Image.replace_color is fixed but not the bang version Image.replace_color!

Fixed! Sorry about that. Should be good now.

Thanks for the quick fix, both are good now!