Hi folks.
I am running dialyzer on my project and getting the following error:
employee.ex:77: Invalid type specification for function 'Elixir.Employee':employees_with_contacts_query/0. The success typing is () -> #{}
Here is a snippet of my code (what I believe to be the relevant parts only):
defmodule Employee do
require Ecto.Query
import Ecto.Query
@doc ~S"""
Query to select the employees with contact number.
"""
@spec employees_with_contacts_query :: Ecto.Query.t
def employees_with_contacts_query do
from e in Employee,
join: cb in ContactBook,
where: cb.employee_id == e.id
end
end
Does anyone see anything wrong here?
(I tried looking at the docs for Ecto.Query.from/2
, to check if maybe it doesn’t actually return an Ecto.Query.t
, and I noticed that none of the functions in Ecto.Query
have a type annotation. Is this because they are not functions, but macros? What does that mean when I am trying to add type annotations to my own functions?)