jeremyjh / dialyxir

Mix tasks to simplify use of Dialyzer in Elixir projects.
Apache License 2.0
1.69k stars 141 forks source link

Failed to parse #467

Closed smt116 closed 10 months ago

smt116 commented 2 years ago

Environment

Current behavior

Please file a bug in https://github.com/jeremyjh/dialyxir/issues with this message.

Failed to format warning:
"@spec a({:ok, %{<<100, 97, 116, 97>> => %{<<114, 101, 108, 97, 116, 105, 111, 110, 115, 104, 105, 112, 115>> => %{<<97, 99, 99, 111, 117, 110, 116>> => %{<<108, 105, 110, 107, 115>> => %{<<114, 101, 108, 97, 116, 101, 100>> => <<47, 118, 50, 47, 97, 99, 99, 111, 117, 110, 116, 115, 47, _account_id@1/binary>>}}}}}}) :: :ok\ndef a() do\n  :ok\nend\n"

Legacy warning:
lib/[filtered]/resources/counterparty.ex:43: The pattern {'ok', #{<<100,97,116,97>>:=#{<<114,101,108,97,116,105,111,110,115,104,105,112,115>>:=#{<<97,99,99,111,117,110,116>>:=#{<<108,105,110,107,115>>:=#{<<114,101,108,97,116,101,100>>:=<<47,118,50,47,97,99,99,111,117,110,116,115,47,_account_id@1/binary>>}}}}}} can never match the type {'error',_} | {'ok',#{'__client__':=#{'__struct__':='Elixir.Tesla.Client', 'adapter':='nil' | {_,_} | {_,_,_}, 'fun':=_, 'post':=[any()], 'pre':=[any()]}, '__module__':=atom(), '__struct__':='Elixir.Tesla.Env', 'body':=_, 'headers':=[{_,_}], 'method':='delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace', 'opts':=[{_,_}], 'query':=[{_,_}], 'status':='nil' | integer(), 'url':=binary()}}
epinault commented 10 months ago

same for OTP26 and 1.15

Please file a bug in https://github.com/jeremyjh/dialyxir/issues with this message.
Unknown error occurred: %FunctionClauseError{module: Dialyxir.Warnings.InvalidContract, function: :format_long, arity: 1, kind: nil, args: nil, clauses: nil}
Legacy warning:
lib/halberd_client/http_client.ex:10: Invalid type specification for function 'Elixir.HalberdClient.HTTPClient':get/2.
 The success typing is 'Elixir.HalberdClient.HTTPClient':get(binary(),'nil' | maybe_improper_list() | map()) -> {'error',_} | {'ok',#{'__client__':=#{'__struct__':='Elixir.Tesla.Client', 'adapter':='nil' | {_,_} | {_,_,_}, 'fun':=_, 'post':=[any()], 'pre':=[any()]}, '__module__':=atom(), '__struct__':='Elixir.Tesla.Env', 'body':=_, 'headers':=[{_,_}], 'method':='delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace', 'opts':=[{_,_}], 'query':=[{_,_}], 'status':='nil' | integer(), 'url':=binary()}}
 But the spec is 'Elixir.HalberdClient.HTTPClient':get('Elixir.Tesla.Env':url(),'Elixir.Tesla':option()) -> 'Elixir.Tesla.Env':result()
 They do not overlap in the 2nd argument

@jeremyjh , any idea?

jeremyjh commented 10 months ago

@epinault that's a completely different error, please open a new issue and include a link to a repo that I could reproduce it with if possible.

epinault commented 9 months ago

unfortunately code is private code . Would need to figure out how I can abstract code and repo that situation then. I ll opena. new issue and see if I can provide a repro case