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 Workbook.append_sheet() #146

Open
ktekinay opened this issue Mar 22, 2024 · 0 comments
Open

Dialyzer warning on Workbook.append_sheet() #146

ktekinay opened this issue Mar 22, 2024 · 0 comments

Comments

@ktekinay
Copy link

This code, as given in the doc example, works but generates a dialyzer warning about breaking the contract:

Workbook.append_sheet(%Workbook{}, Sheet.with_name("blah"))

This does not:

bogus_sheet = Sheet.with_name("Unused")
Workbook.append_sheet(%Workbook{sheets: [bogus_sheet]}, Sheet.with_name("blah))

But of course that gives us two sheets.

The problem appears to be in the Workbook module, line 16, which defines sheets as nonempty_list. This makes sense once the sheet is created, but not during creation.

The workaround might be to avoid append_sheet for creation and use %Workbook{sheets: [sheet]} instead.

Suggestion: add a Workbook.new(sheet) function.

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

1 participant