bodhilogic
@spec reports false error
I’m trying to define a @spec that looks like this:
@type sql() :: String.t()
@spec query() :: sql()
The function takes no parameters and returns a string representing the SQL code that will be run in a database query.
When I start the phx.server, I am getting this error:
== Compilation error in file lib/mim_core/stuff.ex ==
** (CompileError) lib/mim_core/stuff.ex:108: misplaced operator ::/2
The :: operator is typically used in bitstrings to specify types and sizes of segments:
<<size::32-integer, letter::utf8, rest::binary>>
It is also used in typespecs, such as @type and @spec, to describe inputs and outputs
(elixir 1.13.4) expanding macro: Kernel.@/1
It knows that the :: can be found in a @spec though it doesn’t let my spec’s return typespec get past the error.
Is there a way to define the @spec so that it doesn’t generate a “misplaced operator ::/2” error?
Marked As Solved
bodhilogic
Popular in Questions
Hello, how can I check the Phoenix version ?
Thanks !
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Other popular topics
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something…
Haskell reminds me of Java, and e...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









