elixir-temp icon indicating copy to clipboard operation
elixir-temp copied to clipboard

Align `Temp.open!/2`'s spec with it's implementation

Open decius7bc opened this issue 3 years ago • 0 comments

When calling Temp.open! with i.e. Temp.open!(%{basedir: "/tmp", suffix: "foo-"}, &IO.write(&1, "")) Dialyzer warns:

The call 'Elixir.Temp':'open!'
         (#{'basedir' := binary(), 'suffix' := binary()},
          fun((_) -> 'ok')) breaks the contract 
          (options(), pid() | 'nil') ->
             'Elixir.Path':t() |
             {'Elixir.File':io_device(), 'Elixir.Path':t()} |
             no_return()

The @spec seems to be outdated. Temp.open!/2 internally calls Temp.open/2 with the same arguments, so the specs for both function's arguments should match.

decius7bc avatar Apr 28 '22 13:04 decius7bc