defmodule A do
def x() do
Meeseeks.parse("<div id=main><p>Hello, Meeseeks!</p></div>")
end
end
This gives me this error:
The call:
Meeseeks.parse(<<_::336>>)
will never return since it differs in arguments with
positions 1 from the success typing arguments:
(
[
binary()
| {:comment, binary()}
| {:pi, binary()}
| {:pi | binary(), binary() | [{_, _}], binary() | [any()]}
| {:doctype, binary(), binary(), binary()}
]
| {:comment, binary()}
| {:pi, binary()}
| {:pi | binary(), binary() | [{binary(), binary()}], binary() | [any()]}
| {:doctype, binary(), binary(), binary()}
)
When the specs for Meeseeks.parse is @spec parse(Parser.source()) :: Document.t() | {:error, Error.t()}
with Parser.source() being @type source :: String.t() | TupleTree.t()
and then TupleTree.t() being
@type comment :: {:comment, String.t()}
@type doctype :: {:doctype, String.t(), String.t(), String.t()}
@type element :: {String.t(), [{String.t(), String.t()}], [node_t]}
@type processing_instruction ::
{:pi, String.t()}
| {:pi, String.t(), [{String.t(), String.t()}]}
| {:pi, String.t(), String.t()}
@type text :: String.t()
@type node_t :: comment | doctype | element | processing_instruction | text
@type t :: node_t | [node_t]
Dialyxir and Dialyzer helped ma lot, but I don’t understand what’s wrong with those specs, or is it bug with tools rather.
If source :: String.t() | TupleTree.t()
or source :: binary() | TupleTree.t() then call Meeseeks.parse(<<_::336>>)
where <<_::336>>
is binary should satisfy those specs. Right?
Beside, even when dialyxir/dialyzer says [...] will never return since [...]
actually when run always returns and simply works OK.