bitwalker / toml-elixir

An implementation of TOML for Elixir projects, compliant with the latest specification
Apache License 2.0
200 stars 24 forks source link

Wrong spec for parse_file? #33

Closed bortzmeyer closed 1 year ago

bortzmeyer commented 2 years ago

The documentation says that parse_file can return {:ok, …} or {:error, [Exception.t]}. But, apparently, parse_file can also return {:error, atom}:

iex(2)> TomlElixir.parse_file("doesnotexist")
{:error, :enoent}

Because of this erroneous spec, Dialyzer complains when I use TOML:

lib/drink/toml.ex:10:pattern_match
The pattern can never match the type.

Pattern:
{:error, :enoent}

Type:
{:error, %{:__exception__ => true, :__struct__ => atom(), atom() => _}}

________________________________________________________________________________

As seen above parse_file can return {:error, :enoent}.

bitwalker commented 1 year ago

This is the :toml library, not :toml_elixir