sztosz
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.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
jeremyjh
It looks like Dialyzer is finding the success type of the arg as
list(Parser.source()) | Parser.source(), rather than the defined spec which is justParser.source(). You could try fixing the spec in your local deps to andmix deps.compile meeseeksto try that out.sztosz
I really am not sure how to fix them, any pointers?
jeremyjh
What I’m suggesting is just change above spec to what appears to be the success typing:
jeremyjh
Actually that is a problem but probably not YOUR problem. Your problem appears to be that binary is not accepted unless its in a list, so you’d change your call to
Meeseeks.parse(["<div id=main><p>Hello, Meeseeks!</p></div>"]). I’m not sure why it would work and not generate a compatible success typing, its an issue in that library though.sztosz
Changing it into list does not work sadly
I am not sure why dialyxir thinks that success typings is binary in a list etc `[binary() | … ] that is what I mainly try to understand.
jeremyjh
Its due to a discontinuity in that spec versus the implementation of that function. What happens if you just remove the
@specfromparse?sztosz
I think dialyzer does not recompile its spec internally after commenting specs in meeseks, because errors are the same. I’ll try with fresh environment and simple project later this week, but can’t do it now, too much work
jeremyjh
Did you run
mix deps.compile meeseeks? Dependencies are not recompiled automatically.sztosz
I did
mix deps.compileafter changing and it did recompiled meeseeks.mischov
I’m pretty sure that list in the success typing there is because of
@type t :: node_t | [node_t]in theTupleTree.t(), which should list every node type as contents of a list, but also every node type singularly.However, it’s very interesting that
a) while the list of
node_tproperly contains binaries (representing text nodes),binary()isn’t included as a single node outside of the list as it properly shouldb) a top level
binary()isn’t provided since it should be included because ofString.t() | TupleTree.().Edit: This does highlight a logical problem when it comes to parsing, but I don’t think it should affect Dialyzer.