Skip to content

Fix File.open/2 and variants specs to accept :directory option - #15890

Open
aiotter wants to merge 3 commits into
elixir-lang:mainfrom
aiotter:fix/file_open_type
Open

Fix File.open/2 and variants specs to accept :directory option#15890
aiotter wants to merge 3 commits into
elixir-lang:mainfrom
aiotter:fix/file_open_type

Conversation

@aiotter

@aiotter aiotter commented Sep 13, 2026

Copy link
Copy Markdown

File.open/2 forwards :directory option to :file.open/2, which has supported it since OTP 23.
However, the option was missing from the specs, causing Dialyzer to reject valid calls.

This PR adds :directory option to the specs of File.open/2 and its variants.
It also adds a regression test.

Comment thread lib/elixir/test/elixir/fixtures/dialyzer/regressions.ex Outdated
Comment thread lib/elixir/test/elixir/kernel/dialyzer_test.exs Outdated
Co-authored-by: José Valim <jose.valim@gmail.com>
@josevalim

Copy link
Copy Markdown
Member

@aiotter thank you! Can you please add a unit test to file_test.exs that opens up a directory?

The dialyzer tests were not needed, since they were just duplicating the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants