Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialyzer warning on Elixlsx.write_to_memory/2 #72

Open
nkezhaya opened this issue Dec 26, 2018 · 2 comments
Open

Dialyzer warning on Elixlsx.write_to_memory/2 #72

nkezhaya opened this issue Dec 26, 2018 · 2 comments

Comments

@nkezhaya
Copy link
Contributor

The pattern {'ok', {__filename@1, _binary@1}} can never match the type {'error',_}

Using Elixir 1.7.3 and Elixlsx 0.4.0:

 defmodule Foo do
   require Elixlsx

   alias Elixlsx.Sheet
   alias Elixlsx.Workbook

   @spec generate_report() :: binary()
   def generate_report() do
     sheet =
       Sheet.with_name("OSHA")
       |> Sheet.set_cell("B1", "wat")

     filename = "filename.xlsx"

     {:ok, {_filename, binary}} =
       %Workbook{sheets: [sheet]}
       |> Elixlsx.write_to_memory(filename)

     binary
   end
 end
@unti1x
Copy link
Collaborator

unti1x commented Dec 27, 2018

Well, that means that something wrong in :zip.create/2. Try to figure it out by using pattern {:error, reason}

@nkezhaya
Copy link
Contributor Author

What's odd is, if I replace the call to write_to_memory/1 with wci = ...; :zip.create the warning goes away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants