This is probably an error on my part but I'm not sure what it could be.
I tried adding typespecs to some of the functions created by the generator and I'm getting a warning from dialyzer that I just can't seem to figure out why it's occurring. I generated the files by using the example in the readme i.e. mix phx.gen.auth Accounts User users and then added the following:
The @spec for the function does not match the success typing of the function.
Success typing:
@spec build_session_token(atom() | %{:id => _, _ => _}) ::
{binary(),
%TempAuthExperiment.Accounts.UserToken{
:__meta__ => %Ecto.Schema.Metadata{
:context => nil,
:prefix => nil,
:schema => TempAuthExperiment.Accounts.UserToken,
:source => <<_::96>>,
:state => :built
},
:context => <<_::56>>,
:id => nil,
:inserted_at => nil,
:sent_to => nil,
:token => binary(),
:user => %Ecto.Association.NotLoaded{
:__cardinality__ => :one,
:__field__ => :user,
:__owner__ => TempAuthExperiment.Accounts.UserToken
},
:user_id => _
}}
I feel like I barely added any code to get this to mess up. I get it has to do with the user type but I don't see why it's resolving to atom() | %{:id => _, _ => _}
Looking at the code, it seems you should have tagged inserted_at as being possibly nil too. I am not a heavy Dialyzer though, so I recommend using the ElixirForum if you have more questions around this. :)
This is probably an error on my part but I'm not sure what it could be.
I tried adding typespecs to some of the functions created by the generator and I'm getting a warning from dialyzer that I just can't seem to figure out why it's occurring. I generated the files by using the example in the readme i.e.
mix phx.gen.auth Accounts User users
and then added the following:user.ex
user_token.ex
The warning I get is
I feel like I barely added any code to get this to mess up. I get it has to do with the user type but I don't see why it's resolving to
atom() | %{:id => _, _ => _}